Thanks to java camunda-bpmn-model library it is convenient to build bpmn models on a fly.But generated BPMN models are without diagram data and cannot be displayed as diagram, it would be very nice to have bpmn diagram as well.Is there any library already which does the magic?

right now there are no projects that allow generation of DI for a diagram. We had multiple prototypes, but they never made it to production. You can always create feature request in our JIRA or vote for existing feature, like this one CAM-1472.

If you really want this done fast, you could also provide implementation in form of pull request or community extension.

I'm new to camunda bpmn and the forum and this post seems the closest (maybe identical?) to what I would like to ask.

People at my company start using camunda modeler to create diagrams (but usage of the engine would be a long way to go still...). For documentation purposes I'd like to convert the *.bpmn files of the modeler to *.svg automatically, ideally using some command line tool. The tool chain would look something like camunda modeler -> commit via git -> trigger svg generation via cli -> upload to wiki. If there's some cli, I could use, that would be great. Otherwise a pointer to the right place in the source would be appreciated.

For the time being: The svg-export in the modeler works just fine, but what I would like to do is take a .bpmn file as saved by the modeler and generate an svg file using some kind of shell script. Maybe I don't know enough yet to do a smart search for what I need -- I googled for cli options of the modeler or something similar.Something like

$> camunda-modeler --svgexport --input some.bpmn --output some.svg

I guess, it's not that easy, but worst case: it's somewhere in the code...So my emphasis would be on 'automatically' convert to svg. If that would be possible, I could setup a repo just for the bpmn files and all the boring conversion stuff and wiki update would happen somewhere else. The user wouldn't need to create a new svg everytime they change the model (which still happens a lot...).

I think the only thing you can do right now is grab the BPMN.IO library and build yourself a custom solution. You'd have find where it reads in the BPMN XML files and hook that into some sort of interface or command line tool. I'd speculate that there's probably a rendering component in there that might do this.

Without this code, how would the display component know where to put each element. What is the "right" way to do that? It's rather arbitrary, though there are layout and routing algorithms out there, their efficacy is pretty subjective. What looks good to me may not look good to someone else. Moreover layout and routing is a fairly complex thing to do as there are an arbitrary number of elements in a process and thus you can't predict the performance of your algorithm.

If you're using Camunda Modeler, you can output the file in 3 different graphic formats. Because modeler uses BPMN.IO, the ability to do this dynamically is in there somewhere.