Book a Demo

Author Topic: Getting/setting a diagram property on an element using script?  (Read 3877 times)

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Getting/setting a diagram property on an element using script?
« on: November 06, 2019, 10:00:27 am »
Hello all

I have a bunch of stereotypes that have diagram properties within them <<diagram property>> and am trying to get and set their values within Sparx scripting.

Given that their scope is limited to diagrams, I am assuming that I need to access them via the Diagram Object rather than the Element Object.
However, looking at the object model for Diagram Objects I cannot for the life of me see a natural way to do this.

Is this possible to do this?

Cheers

Jays :-)

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Getting/setting a diagram property on an element using script?
« Reply #1 on: November 06, 2019, 10:30:48 am »
Can you be more specific about what kind of properties you are trying to get/set? If you are trying to change some aspect of the appearance of an Element on a specific diagram, then yes, DiagramObject would be the best place to look.
https://sparxsystems.com/enterprise_architect_user_guide/15.0/automation/diagramobjects.html

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Getting/setting a diagram property on an element using script?
« Reply #2 on: November 06, 2019, 10:38:45 am »
Hey Aaron

Thanks for your reply!
I have added custom diagram properties to my stereotype by applying the <<diagram property>> stereotype to one of the element stereotype's attributes by following the example given in the link below.

These custom diagram properties have a scope restricted to a specific diagram, meaning that you can set the same property to two different values on different diagrams.

However, what I can't figure out is how to access them using the scripting language.

Cheers :-)

https://www.sparxsystems.com.au/enterprise_architect_user_guide/14.0/modeling_tools/query_methods.html