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 - David Rains (bioform)

Pages: 1 ... 3 4 [5] 6
61
Hi all,

Just sitting here working on a similar problem at a Starbucks in MD.

I have stereotyped an attribute with tagged values. If I drag and drop into element the synch works fine, but

If I add the stereotyped attribute to the element's attribute collection:
....
set a = aC.AddNew("newAttrb", "")
a.Stereotype = "mySteretypedAttribute"
a.Update
aC.Refresh
Repository.SynchProfile "MyProfile", "mySteretypedAttribute"
....

I get nothing... Even if I manually try to synch nothing...
So I take it that I am missing the additional data that EA puts into the xref table when the operation is carried out by drag/drop, or copying the attribute from within the element (using EA UI).

Any idea how I can get this to work through code?

Basically I would be using code to select the "type" of stereotyped attribute to add to the element when it is missing from the element...

Thanks,

David "bioform" Rains

62
Just curious but why make a method public if it is not being supported?

Thanks

63
Yep that's what I needed! doh...

Thanks,

BTW the .GetAtName method does not work... grr is this a known bug?
I am forced to cycle through the term entries.

64
Working with the Glossary (Term)... I need to understand the CRUD operations for using the glossary.

I understand  Term is the entry object, but is there a collection that represents the entire glossary? I assumed it would work like working with an element collection e.g., element's connectors (collection) the getat etc,

Do I need to do this via SQL?

Thanks,
David

65
Is this the way that you make use of the user created structured tags within your stereotypes?

e.g., define MyStructuredTagType using the "UML Types\Tagged Value Types" sub menu, then going back to your stereotype and set the initial value to <MyStructuredTagType>?

Thanks,
David

66
Okay, let me rephrase... What version of EA supports the !INC script feature?

67
I seem to be unable to get my include to work... Keep getting errors like
"Expected Statement, Line 1"

Could I see a post of a simple "Hello World" example... e.g., included function returns a simple string value?

Thanks,

David

68
I also am looking for a way to bookmark (little red triangle) an element using code... Can't seem to find an attribute or method...

Does anyone know WHERE this value is stored within the database if it is not available via code?

Thanks,
David

Just had to add 'little red triangle" as that was one of my 1st posts and yes of course I did not search for it 1st!

69
Well you do know the ID of the element that is the target... so you just keep going....

70
LOL okay okay!

71
Automation Interface, Add-Ins and Tools / EA scripting support classes?
« on: January 20, 2011, 05:55:19 am »
I am in the middle of refactoring a script and started to define some classes to make the code a bit easier to follow...

Having a bit of a problem create one of my classes from within another class?

Example: create C (a connector class) and during the process of assigning the connector's ID (let) it triggers the creation of the supplier (Es) and client (Ec) elements...

I know this might seem overkill but it is to help me prototype a solution for building an add-in later...

Thanks,
David

72
doink!  :)

It's funny really because my first cut on my script was jsut that... and it worked fine (proof-of-concept) it was only we I started refactoring my code things when wacky!

Okay thanks for clearing that up... It was kinda obvious ONCE you mentioned it!

David "I shoulda had a C#" Rains

73
This works....
=========
option explicit

sub main()
      if True then
            msgbox("True")
      else
            msgbox("False")
      end if
end sub
main
=========

This does not - no error, code is not running, just nothing...
....................
option explicit

sub main()
      if True then
            msgbox("True")
      else
            msgbox("False")
      end if
end sub
....................

I see in the examples NOW that this is present, but no mention in my VBScript book or within EA help? Did I just miss something?

I am running Windows 7 (64) and EA 7.5 Build 848

Man HAVE I wasted sometime over this!  :)


74
Okay I just could not let go of this and just scrapped the whoile thing and started from scratch... oif course things worked fine now?!!

anyway here is the working solution.... and this thread can be closed!
====================
option explicit

sub main()

      dim currentDiagram as EA.Diagram
      set currentDiagram = Repository.GetCurrentDiagram
      
      dim currentConnector as EA.Connector
      set currentConnector = currentDiagram.SelectedConnector
      
      on error resume next
      if currentConnector is nothing or currentConnector.Stereotype <> "sbvrWording" or currentConnector.MiscData(0) = "" then 'PDATA# is (#-1)
            ' No item selected in thediagram, or the item selected was not expected
            MsgBox( "This script requires a sbvrWording connector be selected in the current diagram." & chr(10) & _
                  "Please try again." )
            on error goto 0            'Turn Error checking back on
      else
            on error goto 0            'Turn Error checking back on
            msgbox "Connector Name, ID, and GUID: " & currentConnector.Name & ", " & currentConnector.ConnectorID & ", " & currentConnector.ConnectorGUID ,vbOKOnly

            dim sourceElement as EA.Element
            set sourceElement = Repository.GetElementByID(currentConnector.SupplierID)
            'set elementSelected = Repository.GetTreeSelectedObject
                  msgbox "Source Element Name, ID, and GUID: " & sourceElement.Name & ", " & sourceElement.ElementID & ", " & sourceElement.ElementGUID ,vbOKOnly
            dim clientElement as EA.Element
            set clientElement = Repository.GetElementByID(currentConnector.ClientID)
            'set elementSelected = Repository.GetTreeSelectedObject
                  msgbox "Client Element Name, ID, and GUID: " & clientElement.Name & ", " & clientElement.ElementID & ", " & clientElement.ElementGUID ,vbOKOnly

            dim assocc_classElement as EA.Element
            set assocc_classElement = Repository.GetElementByID(currentConnector.MiscData(0))
            'set elementSelected = Repository.GetTreeSelectedObject
                  msgbox "Assoc. Class Element Name, ID, and GUID: " & assocc_classElement.Name & ", " & assocc_classElement.ElementID & ", " & assocc_classElement.ElementGUID ,vbOKOnly

            set sourceElement = nothing
            set clientElement = nothing
            set assocc_classElement = nothing

      end if

      set currentConnector = nothing
      set currentDiagram = nothing
end sub
main
====================

75
For completness here is the full code for the VBScript
=======================================
option explicit

'Process the newly created wording connector

'Assumptions:
'      - a valid sbvrWording connector (conWording) is selected in the current diagram
'            - the connector stores the associated class ID in PDATA1 (access via .MiscData(#-1)
'            - the connector has the necessary tag values (e.g., verb_phrase_forward/reverse)
'            - the connector associations a new class with 1 or 2 <sbvrTerm> classes (unary or binary)
'            - the newassociation class has NOT been stereotyped yet
'      - the associated term(s) have been previously named
'      - user will supply a forward and reverse verb phrase when prompted

'Example Data:
'      - Term Names = A, B
'      - verb phrase forward = precedes, reverse = follows

'Success Outcome:
'      - associated clase name will be derived and assigned (e.g., A precedes B)
'      - associated class will be assigned the correct stereotype (e.g., sbvrFactType)
'      - wording connector will display 'precedes' in the .... label
'

'TO DO LIST
'      - add error checking

sub sbvrProcessWordingConnector()
      
      ' Get the currently selected connector in the diagram to work on
      dim theDiagram as EA.Diagram
      set theDiagram = Repository.GetCurrentDiagram

      dim theConnector as EA.Connector
      set theConnector = theDiagram.SelectedConnector
      
      on error resume next
      if theConnector is nothing or theConnector.Stereotype <> "sbvrWording" or theConnector.MiscData(0) = "" then 'PDATA# is (#-1)
            ' No item selected in thediagram, or the item selected was not expected
            MsgBox( "This script requires a sbvrWording connector be selected in the current diagram." & chr(10) & _
                  "Please try again." )
            on error goto 0            'Turn Error checking back on
      else
            on error goto 0            'Turn Error checking back on
            'Msgbox( "Success")
                  
            dim supplierElement as EA.Element
                  supplierElement = Repository.GetElementByID(theConnector.SupplierID)   'ERROR OCCURS HERE!!            
            dim clientElement as EA.Element
                  clientElement =Repository.GetElementByID(theConnector.ClientID)

            msgbox("Supplier and Client IDs: " & supplierID & " <" & supplierElement.Name & ">, " & clientID & " <" & clientElement.Name & ">")
      end if

      set theConnector = nothing
      set theDiagram = nothing

end sub

sbvrProcessWordingConnector
=======================================

Pages: 1 ... 3 4 [5] 6