Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: masstq on June 22, 2012, 07:18:55 pm

Title: Open diagram and go to selected object
Post by: masstq on June 22, 2012, 07:18:55 pm
Hi,
I want to use same functionality as in Find in Diagrams, so I want to open diagram, set perspective at some object and select it. Is it possible?

Thanks,

Artur
Title: Re: Open diagram and go to selected object
Post by: Makulik on June 22, 2012, 07:46:41 pm
Yes, this is possible.
Title: Re: Open diagram and go to selected object
Post by: masstq on June 22, 2012, 07:49:06 pm
Could You give me some tips, how it can be done?

Thanks,
Artur
Title: Re: Open diagram and go to selected object
Post by: Makulik on June 22, 2012, 08:57:19 pm
Take a look at the EA Automation API reference:
http://www.sparxsystems.com/enterprise_architect_user_guide/9.3/automation/reference.html

With the Repository object there's a call for
* OpenDiagram (long DiagramID)
Selecting an Element or Connector must be possible using automation as well (I've already seen that), just don't know the method to use now.

HTH
Günther
Title: Re: Open diagram and go to selected object
Post by: qwerty on June 22, 2012, 09:06:01 pm
From my book:
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.
Title: Re: Open diagram and go to selected object
Post by: Makulik on June 22, 2012, 10:22:47 pm
Time to buy your book q.  ;)
Title: Re: Open diagram and go to selected object
Post by: qwerty on June 22, 2012, 11:25:31 pm
You guessed it :-) That's why I advert here...

q.
Title: Re: Open diagram and go to selected object
Post by: masstq on June 23, 2012, 12:05:31 am
Ok, selection works, but how to set focus on object? I mean, the same how the Find in Diagrams works when we press Ctrl+U on selected object and then open a diagram with focus on that object.

Artur
Title: Re: Open diagram and go to selected object
Post by: qwerty on June 23, 2012, 12:51:28 am
Isn't that written in my post? Or does it not work for you?

q.
Title: Re: Open diagram and go to selected object
Post by: stao on June 23, 2012, 08:57:22 am
i guess what he wants is not possible.
focus on object = center the selected diagram on that element.
(i opened a thread some time ago with this requirement but it seems that its not possible)
Title: Re: Open diagram and go to selected object
Post by: qwerty on June 23, 2012, 10:34:01 pm
If you want to move the diagram focus, this is indeed not possible.

q.
Title: Re: Open diagram and go to selected object
Post by: masstq on June 25, 2012, 08:00:52 pm
I thought that it could be impossible, but it was worth trying. Thanks so much for help!
Title: Re: Open diagram and go to selected object
Post by: Guillaume on March 03, 2018, 02:03:29 am
I take that the diagram focus is still not supported via the API?
Title: Re: Open diagram and go to selected object
Post by: Geert Bellekens on March 03, 2018, 05:42:53 am
I take that the diagram focus is still not supported via the API?

I do remember something reading something like that in the release notes, but I'm not sure.

Geert