Unable to create a Line by open api

Hi

I can successfully create a Polygon by open api, but since it must be a closed one, and since it is not drawn if all point are on a line, it looks bad if i set the third point some pixel apart…
image
Another problem is that it is hard to select it by mouse click to manipulate it.

i can draw a line in an EPC-Diagram by using the VP UI. A line is simple to select by mouse.
image
image
image
“Line” is shown in the Window Tile when i open the Specification.
What are the objects (IModelElement, IDiagramUiModel) in open api to create and how?
The modelType of the element ist “Freehand”, the Shapetype of the UIModel is “Freehand”.
Seems that IFreehand and IFreehandUIModel do not have appropriate api to configure a line.
How can i create them for a line and set the starting point and the end point?

Thanks
Guido

Hi Guido,

Thank you for your post. I have relayed your question to our engineers to study. When there is an answer, I will post here.

Best regards,
Jick Yeung

Hi Jick

any news from your engineers?

Best regards,
Guido

Hi Guido,

We have just released a new version. Now, you can create a line with the following code:

ApplicationManager.instance().getProjectManager().getProject();
DiagramManager dm = ApplicationManager.instance().getDiagramManager();
IDiagramUIModel diagram = ApplicationManager.instance().getDiagramManager().getActiveDiagram();
IFreehand model = IModelElementFactory.instance().createFreehand();
IFreehandUIModel shape = (IFreehandUIModel) dm.createDiagramElement(diagram, model);
shape.setPoints(new Point {
new Point (0, 0);
new Point (10, 150);
new Point (0, 200)
});
shape.setBounds(100, 100, 10, 200);

Result:
image

Hope this helps.

Best regards,
Jick Yeung

Thank you very much :slight_smile: