How to auto-layout the ModelInstance created by BPMN model API (the full API)


#1

Could anyone tell me how to auto-layout the BPMN model created by BPMN model API (the full API)? After saving the modelInstance to a file, There is no DI information. How to automatically created that?

Thank you!


#2

https://docs.camunda.org/manual/7.9/user-guide/model-api/bpmn-model-api/fluent-builder-api/#generation-of-diagram-interchange


#3

Thank you for your answer. But that is for the fluent API. I use the Full API to generate my model. So could you tell me how to create DI information automatically for the model?


#4

THen this: Generating bpmndi for Model API processes ?


#5

Thank you Stephen! That is a great material. But using that approach, I will still have to calculate the x, y, heights and width. And these information has to be specified during generation. Is there a way to auto-layout and generate the DI for an existing BPMN file without DI information. I mean I give it a bpmn XML file without DI, it will output an bpmn XML with proper DI in it and I can use the output bpmn file to display a beautiful diagram.

Actually Eclipse BPMN2 Modeler can and DI information to and display bpmn xml without DI info beautifully. But I don’t know which part of their code does the work.


#6

Can you explain why you need to use the core model api, vs fluent api ?


#7

The reason I use core model api (Full) API instead of the fluent api is that I am actually drawing BPMN diagrams for comments in our code. I that process I need to draw different small parts first then connect them, based on some conditions, into large parts and put the large parts into sub-process and connect the sub-processes. The fluent api isn’t convenient for me to draw in this way. The fluent api only allow to draw according to certain flow. Using the fluent api you are not able to first draw independent parts and then connect them.

Another reason I don’t use fluent api is that it does not support collaboration related elements such as pools and participants.

I really want camunda to have an api to automatically layout diagram and generate DI information for bpmn file generated by the full model api.