Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Sygnus on September 29, 2010, 02:06:25 am

Title: True Nesting Connector
Post by: Sygnus on September 29, 2010, 02:06:25 am
Is there a way, via script or via addin, for a custom connector to make the target element nest inside the source?

I'd like to have a custom connector that, when dragged from a source element  to target element, would move the target inside the source, setting the parent property of the target element to the source and updating the project hierarchy accordingly.

I've seen something like that in the SysML video and would like to know how to repplicate this in my customization.

TIA

Marcelo
Title: Re: True Nesting Connector
Post by: Paolo F Cantoni on September 29, 2010, 09:39:32 am
Quote
Is there a way, via script or via addin, for a custom connector to make the target element nest inside the source?

I'd like to have a custom connector that, when dragged from a source element  to target element, would move the target inside the source, setting the parent property of the target element to the source and updating the project hierarchy accordingly.

I've seen something like that in the SysML video and would like to know how to repplicate this in my customization.

TIA

Marcelo
You nearly got it Marcelo... You get the script to set the parent property and then it will move after you refresh the browser.

HTH,
Paolo
Title: Re: True Nesting Connector
Post by: Sygnus on September 29, 2010, 11:40:55 am
Thanks for both your replies, Paolo,

But regarding this topic, how do I do that? I mean, how do I go and set the parent of an object through script?

Title: Re: True Nesting Connector
Post by: Geert Bellekens on September 29, 2010, 03:15:33 pm
Element.ParentID if the parent is an Element, Element.PackageID if the parent is a Package.

Geert
Title: Re: True Nesting Connector
Post by: Sygnus on September 29, 2010, 11:28:46 pm
But this notation is for the automation interfaces, is it not? Is it possible to achieve the same results in scripts? If so, could someone post a small example?

TIA

Marcelo
Title: Re: True Nesting Connector
Post by: Geert Bellekens on September 29, 2010, 11:30:57 pm
Marcelo,

Scripts and addins use the exact same API.

Geert