Skip to content

How to show Activity Diagram, using Python? #3017

Answered by danyeaw
AlexanderScheqolev asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @AlexanderScheqolev, thanks for the question!

You can get a certain type of diagram by setting the diagram's diagramType attribute. For example, to create a UML Activity Diagram with an actvity drawn in it:

from gaphor import UML
from gaphor.core.modeling import Diagram, ElementFactory
from gaphor.diagram.drop import drop
from gaphor.extensions.ipython import auto_layout, draw

element_factory = ElementFactory()

act_diagram = element_factory.create(Diagram)
act_diagram.name = "Process Controller"
act_diagram.diagramType = "act"

activity = element_factory.create(UML.Activity)
activity.name = "Control Process"
drop(activity, act_diagram, 0, 0)

auto_layout(act_diagram)
draw(act_diagram…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by AlexanderScheqolev
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants