Book a Demo

Author Topic: add Initial in Activity diagram with script  (Read 4487 times)

Cisore

  • EA User
  • **
  • Posts: 67
  • Karma: +0/-0
    • View Profile
add Initial in Activity diagram with script
« on: June 11, 2012, 08:40:26 pm »
Hello,

I don't arrive to add Initial action in Activity diagram with VBscript

Code: [Select]
     dim actInitial as EA.Element
      set actInitial = diagActivite.Elements.AddNew("Initial","EntryPoint")
      actInitial.Update()

      dim diagObb as EA.DiagramObject      
      set diagObb = testDiagram.DiagramObjects.AddNew( "l=600", "" )
      diagObb.ElementID( actInitial.ElementID )
      diagObb.Update()      

But when I do that, on element are adding to the diagram but it don't have picture.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: add Initial in Activity diagram with script
« Reply #1 on: June 11, 2012, 10:17:40 pm »
You need to refresh the diagram view. There's a method in Repository for that (don't recall the name at the moment). Search for refresh and/or diagram in the repository help page.

q.

Cisore

  • EA User
  • **
  • Posts: 67
  • Karma: +0/-0
    • View Profile
Re: add Initial in Activity diagram with script
« Reply #2 on: June 12, 2012, 06:01:09 pm »
They don't work.

I think it's not the good type (entryPoint).
For example, how can I add an Action with sub-type callOperation in one activity diagram ?  

[email protected]

  • EA Novice
  • *
  • Posts: 2
  • Karma: +2/-0
    • View Profile
Re: add Initial in Activity diagram with script
« Reply #3 on: August 02, 2019, 02:43:04 pm »
Late reply, but I hope this answer will close the topic. I was trying to automate the Activity diagram template creation and came to the same issue, adding ActivityInitial did not work:
   set e = d.elements.AddNew("ActivityInitial", "ActivityInitial")
   e.Update()
or as in the original post
   set e= d.Elements.AddNew("Initial","EntryPoint")
   e.Update()

What I did is a dump of manually created diagram with Initial and Final elements to find out that they have type "StateNode" and modified code as follows.

   set e = d.Elements.AddNew("END", "StateNode")
   e.Update()

But this code creates a node from a state diagram. After further search, I found in the EA-object-model.pdf in the description of the Element Class (on Page 114 of 280 in version from Date: 30/06/2017):
"For StateNode: 100 = ActivityIntitial, 101 = ActivityFinal" which leads to code which works


   set e = d.Elements.AddNew("END", "StateNode")
   e.Subtype=101
   e.Update()