closed Is there ability to collapse participants using include files

0 votes
asked Mar 4, 2013 in To be sorted by anonymous
closed Mar 6, 2013
So I have a diagram like this:

@startuml

!define DETAILS

!include myParticipants.cfg

...

CAT_PAW -> MOUSE: Catch

CAT_MOUTH -> MOUSE: Eat

 

@enduml

 

The myParticipants.cfg file is the following:

/' Define participants '/

!if DETAILS

    participant "CAT's PAW" as CAT_PAW

    participant "CAT's MOUTH" as CAT_MOUTH

!else

    participant "CAT" as CAT_PAW

    participant "CAT" as CAT_MOUTH

!endif

/' EOF '/

 

I only want one CAT to show up as it is really the same participant.  I tried multiple methods:

    1. participant "CAT" as CAT_PAW as CAT_MOUTH

    2. participant CAT_PAW as CAT_MOUTH

    3. CAT_PAW as CAT_MOUTH

    4. participant "CAT as CAT_PAW CAT_MOUTH

    5. participant "CAT as CAT_PAW && CAT_MOUTH

 

The goal here is if someone includes the .cfg file and they want to perhaps use the same diagram but with two different audiences (think engineers vs architects vs management) the level of detail int he diagram can be configured with the !define.

Anyone know if this is supported?
closed with the note: This question was answered with a method that worked.

1 Answer

0 votes
answered Mar 5, 2013 by plantuml (295,000 points)
 
Best answer

Hi,

You can try this :

myParticipants.cfg :
/' Define participants '/
!if DETAILS
    participant "CAT's PAW" as CAT_PAW
    participant "CAT's MOUTH" as CAT_MOUTH
!else

    participant "The whole CAT" as CAT
    /' Replace CAT_PAW and CAT_MOUTH by CAT '/

    !define CAT_PAW CAT
    !define CAT_MOUTH CAT
!endif

This has not been tested, but this should work.
Is this what you are trying to do ?

 

commented Mar 5, 2013 by anonymous
That worked beautifully and is exactly what I was trying to do!  Thanks so much!
...