Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: hansmaiser on March 10, 2006, 05:04:07 am
-
Hello,
I am trying to add an initial activity (StateNode) to an activity diagram, but it doesnt work.
Here my code example (VB6):
Dim objectDef As EA.Element
Dim diagramObject As EA.diagramObject
Set objectDef = package.Elements.AddNew("start", "StateNode")
objectDef.Update
Set diagramObject = diagram.DiagramObjects.AddNew("", "")
diagramObject.ElementID = objectDef.ElementID
diagramObject.Update
the result is a StateNode-object, but it is transparent and not black. What I am doing wrong?
-
It's buried in the reference guide; just where it should be, but you'll go mad searching for it.
Try setting the SubType = 100 for "ActivityInitial", or 101 for "ActivityFinal."
David
-
Hmm, I ve tried it, but it didnt work:
Dim objectDef As EA.Element
Dim diagramObject As EA.diagramObject
Set objectDef = package.Elements.AddNew("start", "StateNode")
objectDef.subtype = 100
objectDef.Update
Set diagramObject = diagram.DiagramObjects.AddNew("", "")
diagramObject.ElementID = objectDef.ElementID
diagramObject.Update
Where can I find the reference guide?
-
Hi Hans,
Look at section 15.1.2.5.3 - Automation, [stuff], Reference, Element, Element.
As to the exact syntax, I remember doing something when I first solved this problem, but I cannot remember exactly what. The code base I used at the time is in an archive, but I'll look it up for you.
David
-
Ok, Ive found it. You meant the help contents from ea...
Thanks, it works now