Direct python API to generate a diagram

1,422 views
Skip to first unread message

Al

unread,
May 1, 2012, 7:04:47 PM5/1/12
to blockdiag-discuss
Is there any documentation (or doxygen) for creating sequence diagrams
directly from python code?
When all the relevant information (sequence diagram interactions) are
already available in native form in python, it is simpler to call the
API to build the diagram rather then generate a .diag file and call
seqdiag to generate the image.

Thanks

~ Al

Komiya Takeshi

unread,
May 2, 2012, 11:22:40 PM5/2/12
to blockdia...@googlegroups.com
Hi

Sorry, there are no documents for python codes.

You can use blockdiag API like this::

from blockdiag import parser, builder, drawer

tree = parser.parse_string(source)
diagram = builder.ScreenNodeBuilder.build(tree)
draw = drawer.DiagramDraw('PNG', diagram, filename="foo.png")
draw.draw()
draw.save()

This is another example using blockdiag API
(works at http://interactive.blockdiag.com/ )
https://bitbucket.org/tk0miya/blockdiag_interactive_shell

Regards,
Takeshi KOMIYA

2012/5/2 Al <aho...@gmail.com>:

Al

unread,
May 4, 2012, 5:23:17 PM5/4/12
to blockdiag-discuss
Hi Takeshi

Yes this works well after building the text description into a string.
Thanks and great library!

~Al

Guy Halfon

unread,
Sep 3, 2012, 5:31:58 AM9/3/12
to blockdia...@googlegroups.com

בתאריך יום שבת, 5 במאי 2012 00:23:17 UTC+3, מאת Al:

Guy Halfon

unread,
Sep 3, 2012, 5:37:03 AM9/3/12
to blockdia...@googlegroups.com
Hi, i have the same need,but these code end with an error: "
shape = r(node, self.metrics)
TypeError: 'NoneType' object is not callable
 
I used blockdiag-1.1.6
Do you know what is the cause of this error
can you help with send me more details about the code with blockdiag

בתאריך יום שבת, 5 במאי 2012 00:23:17 UTC+3, מאת Al:
Hi Takeshi

Komiya Takeshi

unread,
Sep 7, 2012, 7:56:34 AM9/7/12
to blockdia...@googlegroups.com
Hi,

This problem looks like no setuptools. Are you using it for setup?
blockdiag needs it for pluggable structure (entry_point feature).


2012/9/3 Guy Halfon <guy.ben...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages