Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Pegasus

Pages: [1] 2
Uml Process / Re: [sysML1.4] How to type a connector with EA
« on: March 20, 2018, 08:01:33 pm »
I do not aggree with your statements, because in example from Friedenthal (p 24, Plug <-> Socket) the connector between proxy ports of the two parts is typed by the association block (A1) used in BDD. The solution you describe is valid inside ibd of Association block (A1) itself (participant properties) but this does not have added value, because you need to model the information that the connection between the parts (:Appliance, :Power Source) or rather the proxy ports linking inside the parts to :Plug and : Socket is constructed as described by association block A1. What will happen, if there is another association block (A2) definition with e.g. additional parts. How will you be able to specify which block to use.  So I assume that there is a fault or missing functionality in EA too (actual checked with EA 13.5), because I am also not able to call "Set Connector Type ..." on connector between the part properties


referring to I want to redefine SysML1.4::extendedRequirement the way that a tagged value "ASIL" is added and the two tagged values "risk" and "source" are removed. This redefined extendedRequirement expected to influence the origin toolbox extendedRequirements and is the base for deriving self-defined kinds of requirement. I did describe this redefinitions in profile (based on MDG-Template), saved it as profile and do import it as UML-Proifle. I see my own requirement and it contains the new tagged value "ASIL", but the removed "risk" and "source" too. And this isn't, what I did expect. Additionaly using extendedRequirement from toolbox nothing changed (looks like not redefined).
if I do have a look inside the saved profile-xml file I see following sequence that seems to be ok with regard of target to add ASIL but remove the unwanted tagged values (->Properties?):
<Stereotype name="extendedRequirement" notes="" cx="0" cy="0" generalizes="SysML1.4::extendedRequirement" baseStereotypes="SysML1.4::extendedRequirement" redefines="SysML1.4::extendedRequirement">
               <Tag name="ASIL" type="" description="" unit="" values="" default=""/>
               <RemovedProperty name="source" description=""/>
               <RemovedProperty name="risk" description=""/>

Does anyone can explain where I am wrong or is the behavior caused by not deploying the redefinition as MDG?

Thanks in advance

General Board / Re: ISO 80000-1 Quantaties and Units
« on: March 08, 2018, 02:49:45 am »
Ea supports change from SysML 1.3 to SysML 1.4 via Script. Maybe a bit crude but a) generate from EA-Model-Wizzard "Unit and Quantity Kind library" from SysML 1.4 and b) than generate (inside) from SysML 1.3 "Quantity MKinds and Units".  c) run script "Migrate SysML 1.3 to SysML 1.4" (menu Code/Scipting/SysML 1.4). You see the Units and Kinds like SysML 1.4. ...


Question to use of API for CreateBaseline. API Doc describes the requirement to first parameter "PackageGUID: String - the GUID (in XML format) of the Package to Baseline". I found some example for jscript but not for Java API.
I do call
org.sparx.Package packageSel = m_repository.GetTreeSelectedPackage();
m_repository.GetProjectInterface().CreateBaseline(packageSel.GetPackageGUID(),startDate, baseLineNoteStr + startDate);

and it runs seemingly well, but I'm not sure if I use the api well.
Can someone confirm or please describe correct use of api.

Thank you  in advance


I guess I don' see teh forest for the trees...  But I need urgent suggestion

In my HybridScript I added support for baseline nad did static on most "constants" I defined inside my script

org.sparx.Package packageSel = m_repository.GetTreeSelectedPackage();
m_repository.GetProjectInterface().CreateBaseline(packageSel.GetPackageGUID(),startDate, baseLineNoteStr + startDate);

 and first time all works right, but suddenly I get following crash message...

java.lang.NoSuchMethodError: Unable to find GetTreeSelectedElements
at org.sparx.Repository.comGetTreeSelectedElements(Native Method)
        at org.sparx.Repository.GetTreeSelectedElements(
        at SparxSystems.RepositoryInterface.syncEaWithPtcData(
        at SparxSystems.RepositoryInterface.main(
[Loaded java.lang.Shutdown from shared objects file]
[Loaded java.lang.Shutdown$Lock from shared objects file]

I deleted the libs eaapi.jar and SSJavaCOM.dll inside my local "lib"-package, but nothing changes.

currently I don't know what doing wrong (maybe lack on knowledge of java). I run Update() on a locked element (HybridScript in JAVA) and get an exception

Exception in thread "main" java.lang.Exception: Element locked
at org.sparx.Element.comUpdate(Native Method)
at org.sparx.Element.Update(

I surround the elem.SetName and following Update-call with try ... catch (Exception e) and get the message displayed, I put inside catch-block. But nevertheless the script ends with the (stacktrace) messages above. What I expect is, that I can catch the exception and coninue in script sequence. Maybe I catch the wrong Exception-Type. But if so, what will be the right one? I don't know a source describing the JAVA API

Thanks for support


If i run script on EA V12.1 calling the connectors graphic representation changed in diagram after script ends. If I call same script in same way in EA V13 I see script runs, but nothing changed in diagram...

option explicit

!INC Local Scripts.EAConstants-VBScript

' Script Name: DefaultLineStyles
' Author: Geert Bellekens, Patrick Gottschalk
' Purpose: Allows to change the linestyles to their default
' Date: 27/04/2015; 03.02.2016 (LC->LV für Mode 3 korrigiert), 04.02.2016 trace (UML, Abstraction) -> Mode 3, LV
dim lsDirectMode, lsAutoRouteMode, lsCustomMode, lsTreeVerticalTree, lsTreeHorizontalTree, _
lsLateralHorizontalTree, lsLateralVerticalTree, lsOrthogonalSquareTree, lsOrthogonalRoundedTree

lsDirectMode = "1"
lsAutoRouteMode = "2"
lsCustomMode = "3"
lsTreeVerticalTree = "V"
lsTreeHorizontalTree = "H"
lsLateralHorizontalTree = "LH"
lsLateralVerticalTree = "LV"
lsOrthogonalSquareTree = "OS"
lsOrthogonalRoundedTree = "OR"

dim defaultStyle
dim menuDefaultLines

'*********EDIT BETWEEN HERE*************

' set here the default style to be used
defaultStyle = lsOrthogonalSquareTree

' set there the style to be used for each type of connector
function determineStyle(connector)
   dim connectorType
   connectorType = connector.Type
   select case connectorType
      case "StateFlow","ObjectFlow","InformationFlow"
         determineStyle = lsOrthogonalRoundedTree
      case "Generalization", "Realization", "Realisation"
         determineStyle = lsTreeVerticalTree
      case "UseCase","NoteLink"  ' Original:"UseCase", "Dependency","NoteLink"
         determineStyle = lsDirectMode
      case "Dependency"
         determineStyle = lsOrthogonalSquareTree'lsLateralVerticalTree
      case "Abstraction" ' UML trace
         determineStyle = lsTreeHorizontalTree
      case else
         determineStyle = defaultStyle
   end select
end function
'************AND HERE****************

sub main
      dim diagram
      dim diagramLink
      dim connector
      dim dirty
      dirty = false
      set diagram = Repository.GetCurrentDiagram
      'save the diagram first
      Repository.SaveDiagram diagram.DiagramID
      'then loop all diagramLinks
      if not diagram is nothing then
         for each diagramLink in diagram.DiagramLinks
            set connector = Repository.GetConnectorByID(diagramLink.ConnectorID)
            if not connector is nothing then
               'set the connectorstyle
               setConnectorStyle diagramLink, determineStyle(connector)
               'save the diagramlink
               dirty = true
            end if
         'reload the diagram if we changed something
         if dirty then
            'reload the diagram to show the link style
            Repository.ReloadDiagram diagram.DiagramID
         end if
      end if
end sub


'gets the diagram link object
function getdiagramLinkForConnector(connector, diagram)
   dim diagramLink
   set getdiagramLinkForConnector = nothing
   for each diagramLink in diagram.DiagramLinks
      if diagramLink.ConnectorID = connector.ConnectorID then
         set getdiagramLinkForConnector = diagramLink
         exit for
      end if
end function

'actually sets the connector style
function setConnectorStyle(diagramLink, connectorStyle)
   'split the style into its parts
   dim styleparts
   dim styleString
   styleString = diagramLink.Style
   styleparts = Split(styleString,";")
   dim stylePart
   dim mode
   dim modeIndex
   modeIndex = -1
   dim tree
   dim treeIndex
   treeIndex = -1
   mode = ""
   tree = ""
   dim i
   'find if Mode and Tree are already defined
   for i = 0 to Ubound(styleparts) -1
      stylePart = styleparts(i)
      if Instr(stylepart,"Mode=") > 0 then
         modeIndex = i
      elseif Instr(stylepart,"TREE=") > 0 then
         treeIndex = i
      end if
   'these connectorstyles use mode=3 and the tree
   if  connectorStyle = lsTreeVerticalTree or _
      connectorStyle = lsTreeHorizontalTree or _
      connectorStyle = lsLateralHorizontalTree or _
      connectorStyle = lsLateralVerticalTree or _
      connectorStyle = lsOrthogonalSquareTree or _
      connectorStyle = lsOrthogonalRoundedTree then
      mode = "3"
      tree = connectorStyle
      mode = connectorStyle
   end if
   'set the mode value
   if modeIndex >= 0 then
      styleparts(modeIndex) = "Mode=" & mode
      diagramLink.Style = join(styleparts,";")
      diagramLink.Style = "Mode=" & mode& ";"& diagramLink.Style
   end if
   'set the tree value
   if treeIndex >= 0 then
      if len(tree) > 0 then
         styleparts(treeIndex) = "TREE=" & tree
         diagramLink.Style = join(styleparts,";")
         'remove tree part
         diagramLink.Style = replace(diagramLink.Style,styleparts(treeIndex)&";" , "")
      end if
      diagramLink.Style = diagramLink.Style & "TREE=" & tree & ";"
   end if
end function

function getConnectorStyle(diagramLink)
   'split the style
   dim styleparts
   styleparts = Split(diagramLink.Style,";")
   dim stylePart
   dim mode
   dim tree
   mode = ""
   tree = ""
   for each stylepart in styleparts
      if Instr(stylepart,"Mode=") > 0 then
         mode = right(stylepart, 1)
      elseif Instr(stylepart,"TREE=") > 0 then
         tree = replace(stylepart, "TREE=", "")
      end if
   if tree <> "" then
      getConnectorStyle = tree
      getConnectorStyle = mode
   end if
end function


I just tried to use VB Scripts (diagram goup) changing line style of connectors in a diagramm adapted in EA V12.x inside EA V13 and it seems nothing to be changed. Using same Modell with EA 12.1 it works furthermore fine. Does something changed in API with release EA V13...? 


General Board / SQL - Macro #Branch#: Result entire model
« on: January 14, 2017, 12:44:21 am »

I am just testing #Branch# Macro with some case
and is see that result seems to be entire modell wheater if selected package contains further packages  or not? I expecte #Branch contains
select o.ea_guid AS CLASSGUID, o.Object_Type AS CLASSTYPE,, o.ea_guid, o.Object_type AS Type, o.Stereotype, o.Author, o.modifiedDate AS Modified, o.note AS [Notes] FROM t_object o, t_package pkg WHERE pkg.Package_ID IN (#Branch#)

from user guide
Gets the IDs of the child Packages of the currently-selected Package, working recursively down to the lowest level of sub-Package. For example:
t_object.Package_ID IN (#Branch#)


I found "problem". It was part of setValue-parameter. In real code "new Date" ist result of an other api call  (Java API of PTCIntegrity) and this seems not to be well done by me. If I assing result to String variable first and call SetValute (strVal) afterwards, all is fine.


I don't understand API for modifiy (update) tagged values.  (EA 13)
What I want is to update existiing Tagged Values if content changed  see part of my code (part of function call)...

Collection<org.sparx.TaggedValue> elemTaVs = eaElem.GetTaggedValues();  // what means read only`?
tv_ptcModifDate = elemTaVs.GetByName( eaPtcFNameModifDate ); // returns null if not found
tv_ptcModifDate.SetValue( "new Date" );
if (tv_ptcModifDate.Update()) {

but new value isn't set in Modell (seen by Wizard in Model)

Thanks for support


there are some contratictory topics to question how to get in projectbrowser selected Obejcts (e.g. packages, requirements/elements); e.g.,30519.msg222208.html#msg222208 [Geerd] and,5050.msg123251.html#msg123251 [Aaron]. I do have same problem. In EA 13 using Java API GetTreeSelectedElements returns collection with e.g requirements only not also selected packages, so I assume there isn't an interface returning collection of selected "objects" [in project-browser]. But how is it possible to recognise multiple selections of "objects" e.g. packages and elements at once

Thanks for support and elucidation

First, Thanks for hint to specials of root.
Exception bases on an writeto script output and I didn' investigate.

I'm now able to access TV (displayed as Tags Tab), but I don't understand how to access on TV defined in an MDG e.g. SysML1.4 and I don't understand FQName in TV class (filled if e.g. SysML1.4 ?)
What I'm always confused is where to find definiton of e.g GetName() to access Name of e.g. Element, not write Element.Name ...?

I hope for further hints to lift the fog in my thougths


Preferences: I'm not realy familar with java, but need to use it to access via an API to an external applikation (PTCIntegrity)

I try to run from easy to more complex example (based on hyperscript example from Sparx using java)
I try to run first on packages and read TV (if exist) but I get Exception if I try to print of name of Element (package) of a root (Model) package....   I am not sure if I understand API at all.,
Where come e.g. GetPackages() from and how do I get access on e.g. isModel. I don't see this methods in online help (automation interface/Package package, ..)
If I understand right, I do have first getPackages(collection) than iterate with GetAt(idx) collection and call pgk.GetElement() to get access to e.g. TV. To get the TV for one element I do need a new collection TaggedValue filled by element.GetTaggedValues() ?

Where do I went wrong.
Sorry,  if my description isn't well english and confuse, but it reflects my current problem in understandig API
Tanks in advance for support and hints

Pages: [1] 2