Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Jeronimo on January 03, 2011, 11:15:32 pm

Title: Creating ActivityInitial and ActivityFinal
Post by: Jeronimo on January 03, 2011, 11:15:32 pm
Hello,
I try to generate automatically some Activity Diagrams, but I see
no way how to create a ActivityInitial and a ActivityFinal node...
I thought I can specify this by the attribute "type" of the element.
But "ActivityInitial" and "ActivityFinal" is no valid type...
Is there any way to create this elements?

bests,
Jeronimo
Title: Re: Creating ActivityInitial and ActivityFinal
Post by: Geert Bellekens on January 03, 2011, 11:26:05 pm
Create a StateNode with subtype = 100 for ActivityInitial and 101 for ActivityFinal

Geert
Title: Re: Creating ActivityInitial and ActivityFinal
Post by: Jeronimo on January 03, 2011, 11:51:00 pm
Dear Geert,
thank you very much for your quick help!  :)
Title: Re: Creating ActivityInitial and ActivityFinal
Post by: vrieg on June 06, 2023, 04:18:25 am
I managed to add ActivityInitial and ActivityFinal to an ActivityDiagram. Is there a way to move those elements to a dedicated position? If I readout  diagramObject.left,  diagramObject.right,  diagramObject.top,  diagramObject.bottom of those element it simply returns 0,0,0,0.
Title: Re: Creating ActivityInitial and ActivityFinal
Post by: Paolo F Cantoni on June 06, 2023, 08:26:09 am
I managed to add ActivityInitial and ActivityFinal to an ActivityDiagram. Is there a way to move those elements to a dedicated position? If I readout  diagramObject.left,  diagramObject.right,  diagramObject.top,  diagramObject.bottom of those element it simply returns 0,0,0,0.
In its wisdom, EA returns (or at least used to, haven't checked lately) the position last saved to disk, not the position on the live diagram.  So if you haven't saved the element yet, you'll get what you see.

Paolo
Title: Re: Creating ActivityInitial and ActivityFinal
Post by: Geert Bellekens on June 06, 2023, 02:08:07 pm
The easiest way is to create the diagramobject with the position string as name.
Something like DiagramObjects.AddNew("l=10;r=200;t=20;b=250", "")

Or update the left/right/top/bottom fields and remember to call Update() to save it to the database

Geert
Title: Re: Creating ActivityInitial and ActivityFinal
Post by: vrieg on June 07, 2023, 04:06:37 pm
I could meanwhile find out the initial size of ActivityInitial and ActivityFinal
should be left= 10;right= 30;top = -10;bottom = -30;
Title: Re: Creating ActivityInitial and ActivityFinal
Post by: Geert Bellekens on June 07, 2023, 04:41:42 pm
For those wondering. If you select an element on a diagram, you can see it's exact coordinates on the bottom left.

Geert
Title: Re: Creating ActivityInitial and ActivityFinal
Post by: Paolo F Cantoni on June 07, 2023, 09:00:09 pm
For those wondering. If you select an element on a diagram, you can see its coordinates on the bottom left.

Geert
Are these the same values returned by the API?  Or is it still as it used to be that the API only returns the saved values?

Paolo
Title: Re: Creating ActivityInitial and ActivityFinal
Post by: qwerty on June 07, 2023, 09:41:11 pm
I would "guess" that it's the value from the database and not a life value. You could just have tried this with a little script ;-)

q.
Title: Re: Creating ActivityInitial and ActivityFinal
Post by: Paolo F Cantoni on June 08, 2023, 08:13:46 am
I would "guess" that it's the value from the database and not a life value. You could just have tried this with a little script ;-)

q.
I did!  But my code is nearly a decade old, so it may not be accessing the "latest and greatest".

Paolo
Title: Re: Creating ActivityInitial and ActivityFinal
Post by: Eve on June 08, 2023, 08:19:45 am
I would "guess" that it's the value from the database and not a life value.
It's updated live while dragging an object.
Title: Re: Creating ActivityInitial and ActivityFinal
Post by: Paolo F Cantoni on June 09, 2023, 10:56:52 am
I would "guess" that it's the value from the database and not a life value.
It's updated live while dragging an object.
The values on screen are, but are the values supplied via the API?  As I mentioned, our code (C# in an add-in) returns only the values last saved, regardless of the position of the item on the screen.

Paolo
Title: Re: Creating ActivityInitial and ActivityFinal
Post by: Eve on June 09, 2023, 11:10:51 am
Yes. I interpreted the comment that I replied to as being about the position displayed in the status bar and was responding only to that comment.
Title: Re: Creating ActivityInitial and ActivityFinal
Post by: qwerty on June 09, 2023, 07:11:59 pm
Yes. I interpreted the comment that I replied to as being about the position displayed in the status bar and was responding only to that comment.
Now you made me stumble. Paolo was alking about the API and I was responding to the API behavior. Now you get back to that display on the screen?

q.
Title: Re: Creating ActivityInitial and ActivityFinal
Post by: qwerty on June 09, 2023, 09:03:24 pm
I ran a test. My guts were right: it does NOT dynamically return the current position but only the last saved one. It's V15 but would guess (again) that V16 is the same.

q.
Title: Re: Creating ActivityInitial and ActivityFinal
Post by: Geert Bellekens on June 09, 2023, 09:25:45 pm
I ran a test. My guts were right: it does NOT dynamically return the current position but only the last saved one. It's V15 but would guess (again) that V16 is the same.

q.
We already know that don't we? That's how the whole API works.

The GUI and the API are basically two applications that run next to each other with very little communication.

Geert
Title: Re: Creating ActivityInitial and ActivityFinal
Post by: qwerty on June 10, 2023, 01:00:59 am
Well, like Einstein's Relativity this needs a proof now and then...

q.