Book a Demo

Author Topic: Scripting: Addnew Type List  (Read 4794 times)

NikoWenz

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Scripting: Addnew Type List
« on: October 05, 2018, 06:13:43 pm »
Hello,

my goal is to write visual basic scripts in EA with the technology SysML 1.4.
I managed to create different diagrams like Block Diagram or Activity Diagram with the following syntax:

dim newBlockD as EA.Diagram
set newBlockD = newPackage.Diagrams.AddNew("ABCD", "SysML1.4::Activity")
newBlockD.Update

And managed to create a Block with this syntax:

dim newThing as EA.Element
set newThing = newPackage.Elements.AddNew("ABC", "SysML1.4::Block")
newThing.Update

The problem now is i dont find out how actions or sequences are created.
I though it has to be somethin like  SysML1.4::Action and SysML1.4::Sequence.
But this doesn't work.

Is there a list or table which lists all the types?
Or do I need to guess what is the keyword?



http://www.sparxsystems.com/enterprise_architect_user_guide/13.5/automation/reference.html
« Last Edit: October 05, 2018, 06:29:15 pm by NikoWenz »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Scripting: Addnew Type List
« Reply #1 on: October 05, 2018, 06:59:56 pm »
Just create any of the unknown elements in an empty (!) EAP and run the query
Code: [Select]
SELECT * FROM t_xrefThat should help you to find out the correct stereotype.

If there is no entry in t_xref you probably have created an un-stereotyped element.

q.
« Last Edit: October 05, 2018, 07:02:43 pm by qwerty »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Scripting: Addnew Type List
« Reply #2 on: October 05, 2018, 07:07:00 pm »
Alternative is to open the SysML1.4 MDG file (found in Installation Folder\MDGTechnologies)

That is a readable xml file that lists all stereotypes in that technology.

Geert

NikoWenz

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: Scripting: Addnew Type List
« Reply #3 on: October 12, 2018, 10:41:16 pm »
Thanks for your suggestions.
I think the problem is that as u mentioned the elements dont have Stereotypes.

Do I need to create something without a Type and then add the tag sequence?
And to do this how could i create an Element without a type?

set newThing = newPackage.Elements.AddNew("ABC", "")

Just leaving it blank doesnt work.

Greetings
Nikolas

NikoWenz

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: Scripting: Addnew Type List
« Reply #4 on: October 12, 2018, 11:06:20 pm »
I just looked again at https://sparxsystems.com/enterprise_architect_user_guide/13.5/automation/element2.html

And found the type list I searched for:
(Strangly I often tried Action and Sequence and it hadn't worked, but now it does ... I am confused but happy, because it works now :D)

Action
Activity
ActivityPartition
ActivityRegion
Actor
Artifact
Association
Boundary
Change
Class
Collaboration
Component
Constraint
Decision
DeploymentSpecification
DiagramFrame
EmbeddedElement
Entity
EntryPoint
Event
ExceptionHandler
ExitPoint
ExpansionNode
ExpansionRegion
Feature
GUIElement
InteractionFragment
InteractionOccurrence
InteractionState
Interface
InterruptibleActivityRegion
Issue
Node
Note
Object
Package
Parameter
Part
Port
ProvidedInterface
Report
RequiredInterface
Requirement
Screen
Sequence
State
StateNode
Synchronization
Text
TimeLine
UMLDiagram
UseCase