Book a Demo

Author Topic: adding and removing objects on diagrams with scripting  (Read 3278 times)

Arnoud_B

  • EA User
  • **
  • Posts: 76
  • Karma: +0/-0
    • View Profile
adding and removing objects on diagrams with scripting
« on: June 02, 2020, 09:14:46 pm »
Is it possible to add or remove (diagram)objects to a diagram using (java)script? You can change a large number of attributes of an diagram and you can also retrieve the objects already on a diagram but I fail to find how you can remove items from a diagram or add new items to a diagram.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: adding and removing objects on diagrams with scripting
« Reply #1 on: June 02, 2020, 09:18:00 pm »
See EA.Diagram.DiagramObjects.

You can call Add and Remove on that collection.
I believe there are a couple of examples in the local scripts group, and definitely some examples on my github script library: https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library

Geert

Arnoud_B

  • EA User
  • **
  • Posts: 76
  • Karma: +0/-0
    • View Profile
Re: adding and removing objects on diagrams with scripting
« Reply #2 on: June 03, 2020, 01:30:32 am »
Thanks for helping me out again, that indeed worked and I found another threat to refresh my diagram. I now manage to remove all items form the diagram and then recreate them. Ok not very useful but I am mostly searching what is possible with scripting and what is not to see it is worthwhile to invest in some proper work to create a maintainable repository.