To create a com.nomagic.magicdraw.uml.symbols.paths.PathElement for given ModelLink between given client and supplier elements, use method com.nomagic.magicdraw.openapi.uml.PresentationElementsManager.createPathElement(Element, PresentationElement, PresentationElement):
com.nomagic.uml2.ext.magicdraw.classes.mddependencies.Dependency link = ...; PresentationElement clientPE = ...; PresentationElement supplierPE = ...; SessionManager.getInstance().createSession("Test"); PathElement path = PresentationElementsManager.getInstance().createPathElement(link, clientPE, supplierPE); SessionManager.getInstance().closeSession();
The diagram is not passed into createPathElement(Element, PresentationElement, PresentationElement) method. A new path element is created in the same diagram as client or supplier presentation elements.
You can find the code examples in
- <installation_directory>\openapi\examples\symbolcreation
- <installation_directory>\openapi\examples\sequencecreation