MagicDraw OpenAPI, scripting related questions and discussions
Moderator: Moderators
by thomas.simon31@gmx.de » Sat Mar 18, 2023 5:16 am
Hey,
I create multiple elements and connect them via PathElement. Unfortunately I can't manage to change the style of the Path element to RECTILINEAR. How can I do this?
Code: Select all // Create Presentation Element Element1 = ... Element2 = ... PresentationElement1 = presentationElementesManager.createShapeElement(Element1, Diagram) PresentationElement2 = presentationElementesManager.createShapeElement(Element2, Diagram) // Create Dependency Dependency = project.getElementsFactory().createDependencyInstance() ModelElementsManager.getInstance().addElement(Dependency, Parent) ModelHelper.setClientElement(Dependency, Element1) ModelHelper.setSupplierElement(Dependency, Element2) // Create Path ShowPathElement = presentationElementesManager.createPathElement(Dependency,PresentationElement1,PresentationElement2)
Thanks
thomas.simon31@gmx.de
Forum Newbie
Posts: 3
Posts Rating: 0
Joined: Thu Feb 10, 2022 4:47 am
by yu3333 » Wed Mar 29, 2023 6:20 am
I suppose you want to Changing properties of presentation elements. Read its documentation here
https://docs.nomagic.com/display/MD190/Changing+properties+of+presentation+elements You can also refer to the following codes, in which
presentationElement is the path's PresentationElement
Code: Select all ChoiceProperty pathStyle = presentationElement.getProperty(PropertyID.LINK_LINE_STYLE); pathStyle.setValue("RECTILINEAR"); PropertyManager properties = new PropertyManager(); properties.addProperty(pathStyle); PresentationElementsManager.getInstance().setPresentationElementProperties(presentationElement, properties);
Hope it helps!
yu3333
Forum Newbie
Posts: 7
Posts Rating: 0
Joined: Wed Mar 29, 2023 1:09 am
Return to Programmatic Extendibility
Who is online
Users browsing this forum: No registered users and 0 guests