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 - KP

Pages: 1 ... 161 162 [163] 164 165
Sorry not to get back to you...

I've not used automation in C# but I'm guessing that EA.ElementClass and EA.RequirementClass appear with auto-completion and are equivalent of EA.Element and EA.Requirement available in VB. If not, it's a problem; if so, don't try to cast to EA.Requirement! Open the properties dialog of a class element in EA and you will see a "Requirement" tab: EA.Requirement is the type of the internal requirement items created on that tab, and is not the type of external requirement elements. They are of type EA.Element.

So, your first attempt without the typecasting is closer to being correct than your second. I think the reason your first attempt doesn't work is you probably need to do the Update and/or Refresh on the collection as well as the element. Try that.

So, if it's a requirement, I'm trying to cast the element to a RequirementClass.  It won't let me.

How are you trying to cast it? Can you post up a code snippet  please?

And why are you trying to cast it? What do you hope to achieve?

Package.Element contains the properties of the package. You probably need to iterate through the Package.Elements collection. Check the Element.Type property for each item in the collection; this should be "Requirement" for your requirement element.

I don't know C#, but VB6 might be something like:

Code: [Select]
   Dim repos As EA.repository
   Set repos = GetObject(, "EA.App").repository
   Dim pack As EA.Package
   Set pack = repos.GetTreeSelectedPackage()
   Dim elem As EA.element
   For Each elem In pack.Elements
       If elem.Type = "Requirement" Then
           MsgBox "Found It!"
       End If

The part that I am unsure about now is removal.  Will simple using a delete query on the connector do any damage to the rest of the project?


Each connector will have one record in the t_connector table, but may have multiple records in the t_diagramlinks table (one for each diagram it appears on), multiple records in the t_connectortag table, and possibly other information hidden away elsewhere too.

Your best bet is in automation: get the Element at one end or the other and use the Element.Connectors.Delete() or DeleteAt() method. That will guarantee a clean deletion.


Is there any simple way to reverse or remove a connector through the repository object?  If not, are there any known issuse with making these changes to the database directly?  I can access the connector I want to reverse, but I can't seem to find the proper call to reverse it.

I think you need swap the values of ClientID and SupplierID and possibly also ClientEnd and SupplierEnd. (nb I haven't tested this so make backups before you try it!)

I haven't had time to test this, but I think for sequence lifelines you need to iterate through the Diagram.DiagramObjects collection, use Repository.GetElementByID(DiagramObject.ElementID) to get the element (which is an instance), and then use Repository.GetElementByID(Element.ClassifierID) to get the instance's classifier.

HTH  :)

Automation Interface, Add-Ins and Tools / Re: Feature linked Note - How
« on: August 15, 2005, 03:51:01 pm »

1. Yes, PDATA1..PDATA5 map to MiscData(0)..MiscData(4)

2. Yes, information held for the note, not the note link

Neil  :)

Automation Interface, Add-Ins and Tools / Re: Feature linked Note - How
« on: August 14, 2005, 04:36:18 pm »
A couple of quick tests...

1. I linked a note to an element's note field and the following changes appeared in the note's record in t_object: PDATA1 --> "Element Note", PDATA2 --> the element's ID, PDATA4 --> "Yes".

2. I linked a note to an element's attribute and the following changes appeared: PDATA1 --> "Attribute", PDATA2 --> the attribute's ID, PDATA3 --> the attribute's name, PDATA4 --> "Yes".

I would assume the other types behave similarly, but investigation would be needed.



Automation Interface, Add-Ins and Tools / Re: writing an add-in
« on: July 24, 2005, 07:07:16 pm »
Is there any way one could write an add-in/plug-in for EA and install it within EA ? Any place to find documentation, interfaces and library details for it

First place to look would be in the EA help file, the chapter titled "Automation and Scripting", specifically the sections "The Automation Interface" and "Add-Ins".

There is also a practical example at .

Come back with any questions that the above don't answer.

Neil  :)

How do you install it ?

Download the file C2SEQ.exe and double-click it, that's all.

To use it, open either a communication or sequence diagram, then from the main menu "Add-Ins | Sparx Collaboration <-> Sequence | Create" and it will create a new diagram from the currently open diagram.

If any of this doesn't work, please let us know.

Hi people! I'm using EA and I have a question!
I have a sequence diagram and I try to create automatically collaboration diagram from the sequence diagram! My question is "It is posible, I'm using EA 4.5?"

Bye, and Tkz. ??? ???

We have an add-in which will perform the conversion for you. It is here:  I'm afraid it's EA 5.0 and above only.

This is just a guess, but if t_object.tpos is changing and you're not seeing the change then it's because the Project View isn't being refreshed. Try executing Project.ReloadProject() and see if that works.


You have a choice: Repository.GetTreeSelectedItem or Diagram.SelectedObjects, depending on whether you want the objects selected in the Project View or on the diagram.

Tip: your EA_MenuClick event will give you a MenuLocation parameter which will tell you where the add-in was called from, i.e. diagram, main menu or project view.

The EA help file has more info. e-mail me if you get stuck  :)


Automation Interface, Add-Ins and Tools / Re: Vertical fork/join
« on: May 29, 2005, 04:19:55 pm »
You will need to add:

JoinElem.Subtype = 1

Where Class is "Synchronization", use Subtype = 0 for horizontal, Subtype = 1 for vertical. This should have been documented: I have updated the help file for the next release; apologies for the omission.



Also, Phil Bachmann's response to Thomas' bug report said that "only Models, Packages, Elements and Diagrams collections support the GetByName method", but TomO says that Packages don't support it.

It's actually Models, Packages, Elements, Diagrams and TaggedValues collections that support GetByName(), the last named since build 760. I have amended the help accordingly.

If Packages.GetByName() isn't working for you, could you post up a few lines of code and I'll try it here, see if I can figure out why.

Pages: 1 ... 161 162 [163] 164 165