Author Topic: How to set CompositeDiagram on an Element  (Read 1713 times)

Arnoud_B

  • EA User
  • **
  • Posts: 76
  • Karma: +0/-0
    • View Profile
How to set CompositeDiagram on an Element
« on: May 11, 2022, 05:08:47 pm »
In the GUI you can easily add a ChildDiagram to an Element by using "New Child Diagram" either by creating a new Diagram with "Composite Structure Diagram" or linking an existing with "Select Composite Diagram".

I am generating a skeleton set of Diagrams based on my model and I would like to link the created diagrams to 'their' Element. However in the API the attribute CompositeDiagram is Readonly

Notes: Read only
If the element is Composite, returns its associated diagram; otherwise returns null.
Diagram Class

Also from the other side; Diagram object I do not find a way to set this, anybody did this before?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13282
  • Karma: +556/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to set CompositeDiagram on an Element
« Reply #1 on: May 11, 2022, 05:20:52 pm »

Arnoud_B

  • EA User
  • **
  • Posts: 76
  • Karma: +0/-0
    • View Profile
Re: How to set CompositeDiagram on an Element
« Reply #2 on: May 11, 2022, 05:39:48 pm »
Thanks Geert,
Well actually the SetCompositeDiagram() works in my case so I do not have to use your more dangerous query solution.

I am a bit ashamed to say that I just did not scroll down enough in the help text to find this myself.

In my defense I have now completed a kickstart script that will generate a basic set of diagrams with navigation between them based on an well structure model.
It is really amazing at times what you can do with the scripts although it is hard to get them dummy proof, as a mistake in your script (or in my case an unanticipated use of a script in a different context) can do a lot of harm to your repository. So my kickstart script is heavy user only ;-)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13282
  • Karma: +556/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to set CompositeDiagram on an Element
« Reply #3 on: May 11, 2022, 06:27:45 pm »
(or in my case an unanticipated use of a script in a different context)
I feel your pain. I even wrote safety guards in some scripts that allow them to be executed only by a few users.

Geert