Add capability to nest state diagrams in package or frame

+1 vote
asked Jan 25, 2022 in Wanted features by Bob Cavanaugh
It would make my drawings easier to integrate with SYSML requirements if I could do something like the following:

@startuml

frame "state_machine" {

    state foo

    state bar

    [*] -> foo

    foo -> bar

}

@enduml

Frame or package would meet the request

Thanks!

3 Answers

0 votes
answered Jan 25, 2022 by The-Lu (64,340 points)

Hello B.,

A possible workaround is to use sub-diagram and label, as:

@startuml
frame  "state_machine" {
label l [
{{
    state foo
    state bar
    [*] -> foo
    foo -> bar
}}
]
}
@enduml

Or simply `mainframe`, as:

@startuml
mainframe  "state_machine"
state foo
state bar
[*] -> foo
foo -> bar
@enduml

If that can help,
Regards,
Th.

0 votes
answered Jan 26, 2022 by plantuml (295,000 points)

You can also simply have:

@startuml
state state_machine {
    state foo
    state bar
    [*] --> foo
    foo --> bar
}
@enduml

Does it help?

0 votes
answered Jan 26, 2022 by plantuml (295,000 points)

With last snapshot, you can have this:

Does it sound good?

...