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

  • <installation_directory>\openapi\examples\symbolcreation
  • <installation_directory>\openapi\examples\sequencecreation
Related pages