labs4capella / python4capella

Python for Capella
Eclipse Public License 2.0
53 stars 10 forks source link

OES cloning #220

Open mm-capella opened 2 months ago

mm-capella commented 2 months ago

Hi, I was creating Operational Entity Scenarios and was wanting to create a copy of a diagram to save time and make a minor change. How do we unsync the new diagram from the old one. All changes I make in the new diagram adjusts the old one.

ylussaud commented 2 months ago

I guess the new diagram is a reference to the same Java diagram object. You need to create a copy of the representation first:

e_object_query = org.eclipse.sirius.business.api.query.EObjectQuery(myDiagram.get_java_object())
org.eclipse.sirius.business.api.dialect.DialectManager.INSTANCE.copyRepresentation(myDiagram.get_java_object(), 'My representation Copy', e_object_query.getSession(), None)

At the moment we don't have APIs to modify diagrams but you can use the Java API from your Python4Capella script just like in the above example. You can also find some example of modifications on the Capella scripting forum:

Nelson1905 commented 2 months ago

Hi,

Are there a website to find all eclipse function like for instante org.eclipse.sirius.business.api.query.EObjectQuery(myDiagram.get_java_object()) ?

ylussaud commented 2 months ago

That's an API from Sirius. Most code is on github: