2

I googled it all but not able to find the tool to convert PLANTUML to the sequence diagram in python

Is there any library / tool for converting the plantuml to sequence diagram using python?

I understand this online tool does this : https://www.planttext.com/ but I want to automate the process so I don't want to use the online tool

Edit :

@startuml
participant ClassA as Class_UmlA
participant ClassB as Class_UmlB

note right of Class_UmlA: Function to test
    Class_UmlA -> Class_UmlB  : Function1 
    activate Class_UmlA
@enduml

Thanks,
Harry

Harry
  • 3,072
  • 6
  • 43
  • 100
  • 1
    I don't know how to do this in a python native way (but with a system or pipe command it should be possible) . See for the plantuml package: http://plantuml.com/download – albert Jul 08 '19 at 09:21
  • @albert, Could you point me to the example please – Harry Jul 08 '19 at 10:06
  • What kind of example? – albert Jul 08 '19 at 10:15
  • @albert Check the edit section, If I have a plantuml script like this, How do I convert this to sequence diagram? – Harry Jul 08 '19 at 10:20
  • 1
    The give code is the input for plantuml. This you have to place in a file, say aa.pu, and feed this to file to plantuml and retrieve the generated image, say you want a png file you can retrieve aa.png. The used command here would be e.g. `java -Djava.awt.headless=true -jar %PLANTUML_JAR% aa.pu` (with %PLANTUML_JAR% set appropriately). – albert Jul 08 '19 at 10:54

1 Answers1

3

PlantUML is a Java program, so you need a Java Runtime installed as pre-requirement, but on the other hand you don't need Python.

1) download plantuml.jar from http://plantuml.com/de/download

2) run from commandline java -jar path/to/downloaded/plantuml.jar path/to/your/plantUMLfile.txt

your file is generated as plantUMLfile.png in the directory of execution.

Use java -jar plantuml.jar -help for a full list of parameters to make full use of the commandline tool.

Simulant
  • 19,190
  • 8
  • 63
  • 98