Creating shape elements
To create a com.nomagic.magicdraw.uml.symbols.shapes.ShapeElement for given ModelElement in the given com.nomagic.magicdraw.uml.symbols.DiagramPresentationElement, use method com.nomagic.magicdraw.openapi.uml.PresentationElementsManager#createShapeElement(...). The location of the created shape will be (0,0).
The following code example shows how to do this:
com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class clazz = ...;
DiagramPresentationElement diagram = ...;
SessionManager.getInstance().createSession(
"Test"
);
ShapeElement shape = PresentationElementsManager.getInstance().createShapeElement(clazz, diagram);
SessionManager.getInstance().closeSession();
You can find the code examples in
<programinstallation directory>\openapi\examples\symbolcreation
<programinstallation directory>\openapi\examples\sequencecreation
Related pages