Book a Demo

Author Topic: How to open diagram to a specific element or spot  (Read 4448 times)

isaacjoh

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
How to open diagram to a specific element or spot
« on: January 17, 2015, 06:50:09 pm »
I know how to work the database (i.e. Repository.OpenDiagram) and how to pick which elements I need from the repository. One thing I am trying to do is make a script to open diagrams up where certain conveyed items show up. I know that EA currently does not have this feature but I am close to having it work. I can pull which diagrams I need that have a certain conveyed item but I would like to make it easier for the user to find which element is the source of the connector on which the conveyed item. Thus, back to my question but is there any way I can set in my script what element or spot to focus on when selecting that specific diagram? Any help is much appreciated, thank you so much!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to open diagram to a specific element or s
« Reply #1 on: January 18, 2015, 06:51:38 am »
Just a quick answer at the weekend: there are a couple of threads dealing with the SQL to find those elements. You can use the query described there together with Repository.SQLQuery.

q.

isaacjoh

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: How to open diagram to a specific element or s
« Reply #2 on: January 18, 2015, 09:25:40 am »
thank you for the quick response q! i have been able to actually pull the right elements from SQL queries. the issue i have though is i want to be able to have the user pick a certain element which would open the diagram and zoom into that element, kind of like how EA has the "find in diagram" option. i was trying to see how i could use the DiagramObjects database and Diagram.Scale function but no luck yet :(

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to open diagram to a specific element or s
« Reply #3 on: January 18, 2015, 12:01:06 pm »
Well, you can open a diagram via API and you can select certain element(s). But AFAIK you can not zoom.

q.
« Last Edit: January 18, 2015, 12:01:25 pm by qwerty »

isaacjoh

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: How to open diagram to a specific element or s
« Reply #4 on: January 18, 2015, 04:08:01 pm »
oh really? so i know Repository.OpenDiagram(diagramID) will open the diagram from API but may i ask what the select element function would be?  :)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to open diagram to a specific element or s
« Reply #5 on: January 18, 2015, 09:46:25 pm »
In the EADiagram object:

Quote
EaCollection SelectedObjects —
Returns a collection representing the currently selected elements on the diagram. You can remove objects from this collection to deselect them, and add elements to the collection by passing the Object ID as a name to select them.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to open diagram to a specific element or s
« Reply #6 on: January 19, 2015, 06:43:46 pm »
If you really really want this you can simulate scrolling using the windows keypress events and other dirty tricks like that.

But I guess you must be desperate before trying a workaround like that.

Geert