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 - The apprentice

Pages: [1] 2
1
Automation Interface, Add-Ins and Tools / Re: TaggedValues : add value
« on: April 11, 2019, 10:54:36 pm »
It's work.
I didn't see this attribute.

Ty again.

2
Automation Interface, Add-Ins and Tools / TaggedValues : add value
« on: April 11, 2019, 08:02:15 pm »
 
Hi I try to add a value on a taggedValue's method :
Code: [Select]
EA.Method method = (EA.Method)currentMbdClass.Methods.GetAt(0);
            foreach (EA.TaggedValue tag in method.TaggedValues)
            {
                //Do Something
            }
and I have this error : "Unable to cast COM object of type'System_ComObject' to interface type 'EA.TaggedValue'"

I don't know how to get a taggedValue from the method.

3
Ok

But if I want to remove one of them. It'is possible to "clear" the stereotypeEx ?

4
What's a FQN ?

I have 2 stereotypes now but I'm not sur about the methodology :

Code: [Select]
newAttribute.StereotypeEx = "University::New";
                    newAttribute.Update();
                    newAttribute.StereotypeEx = "University::Data";
                    newAttribute.Update();
                    //newAttribute.Stereotype = newAttribute.StereotypeEx;

It seems to be working but I don't know how to remove an attribute.

I also seen that from an EA Administrator :

Quote
Use StereotypeEx for every time you want to write a stereotype.
•Use HasStereotype() for every time you want to check a stereotype.
•Edge cases for appending a stereotype to the existing list or checking for any stereotype both use StereotypeEx.
•FQStereotype is read only. It allows you to see the profile the first stereotype applied comes from.
•MetaType allows you to get the Metatype defined for an applied stereotype. (It's not read only, but it ignores any assignment)
•SynchTaggedValues() should be automatic when assigning a stereotype. It's useful if the stereotype definition has been updated or tags accidentally deleted

Do I Use Stereotype ?

Thank You
Pardon my english

5
Automation Interface, Add-Ins and Tools / Re: 2 stereotypes on attribute
« on: February 28, 2019, 03:52:44 am »
Thank you.

6
Automation Interface, Add-Ins and Tools / 2 stereotypes on attribute
« on: February 28, 2019, 02:22:27 am »
Hi,

I use an Addins in C# and I would like add 2 stereotypes on attribute like this :



Code: [Select]
attribute.Stereotype = "New";
//attribute.Stereotype = "enum"; will erase the old value and I want just add it

Thank you

7
I have the same error :

Code: [Select]
//EA.Element currentElement; // My component.
//EA.Element Elport; // My port.
//EA.Element myInterface;
EA.Element Elport = (EA.Element)currentElement.Elements.GetByName("Port2");
EA.Element myInterface = (EA.Element)currentPackage.Elements.GetByName("IMyMBD");
EA.Collection  diagCollection = (EA.Collection)currentDiagram.DiagramObjects;
EA.DiagramObject  DiagObj = (EA.DiagramObject)diagCollection.AddNew("", "Interface");
DiagObj.ElementID = Elport.ElementID;
DiagObj.Update();// triggers error
   
eARepository.ReloadDiagram(currentDiagram.DiagramID);

In my case My interface should be the child of the port.

edit :

I understood the importance of DiagramObject and it works for adding ports on my component. But when I try to add an interface like this :
Code: [Select]
EA.Element item =  (EA.Element)newPort1.EmbeddedElements.AddNew("", "ProvidedInterface");
            item.Update(); 
            var diagramItem = (EA.DiagramObject)currentCmpDiagram.DiagramObjects.AddNew("", "");
            diagramItem.ElementID = item.ElementID;
            diagramItem.Update();
            newPort1.Update();
            currentCmpDiagram.Update();
            currentPackage.Update();
            eARepository.ReloadDiagram(currentCmpDiagram.DiagramID);

digramItem.Update() triggers an execption of type System.StackOverFlowExecption. What's the problem here ?
Thank you

8
So I don't understand, I work on Diagram component.

My Component has a port (child Element). I need to add Required/Provided interface existing on the port ( new child element of the port).

This my code :

Code: [Select]

EA.Diagram curentDiagram; // Diagram wich contains my component.
EA.Element currentElement; // My component.
EA.Element Elport; // My port.
EA.Element myInterface;

EA.Element myInterface = (EA.Element)currentPackage.Elements.GetByName("IMyMBD");
var DiagObj = (EA.DiagramObject)currentDiagram.DiagramObjects.AddNew("", "");
DiagObj.ElementID = port2.ElementID;
DiagObj.Update(); // this triggers an error : System.Runtime.InteropServices.COMException


I wish to illustrate what I want. How to use IMG tag ?
Thank for your time.

9
Hi

I wanted the opposite. Add existing Interface to the port in diagram.

Thank's to :

Code: [Select]
EA.Element interface = (EA.Element)currentPackage.Elements.GetByName("IMyMBD");// I use GetByName just for the example
         int potoid = interface.ElementID;
         EA.Element port2 = (EA.Element)currentElement.Elements.GetByName("Port2");
         EA.Element inter = (EA.Element)port2.Elements.AddNew("", "RequiredInterface");
         inter.ClassfierID = potoid;
         inter.Update();
         inter.Refresh();

it works.

Thank you

10
Hi,

I would like add an existing interface on my port. I tried this :
Code: [Select]
var oto = (EA.Element)port1.EmbeddedElements.AddNew("", "RequiredPort");
oto.ElementID = poto.ElementID;


But ElementID is an attribute read only. Do you a have solutions?

Thank you

11
Automation Interface, Add-Ins and Tools / Component's ports
« on: October 04, 2018, 11:16:48 pm »
Hi

I can create components :

Code: [Select]
EA.Element item =  (EA.Element)currentPackage.Elements.AddNew("cmp1", "Component");

but i don't know how to add ports onto this component. I can't add ports in the current package without component.

How can I ?

Edit : resolved

ty

12
Automation Interface, Add-Ins and Tools / TaggedValue enumeration
« on: May 25, 2018, 11:24:44 pm »
I use a taggedValue wich have several values :

How can I add a new value in the list in C#. I found no answers with the Documentation ( TaggedValue Class or attribute ).

It is possible to do that?

Pardon my english.

Thank you

13
GetByName only works for a limited set of EA.Collections.

But I wouldn't use it anyway if I were you. It will only return the "first" element with the given name, but you don't know in which order that will be.

Better to pretend GetByName doesn't exist and always "for each" the collection and test for the name.

Geert

Okay good

What is "the same problem"? Any error messages?

q.

I had the following error : "Action is not suported" by using GetByName on EA.Attributes

Thank you

14
Hi

I need to get a EA Attribut and I use GetByname but i have the same problem :

Code: [Select]
if (element.Attributes.GetByName(o) != null)

I didn't understand why "Action is not supported" despite the documentation of this operation.

Thank you.

15
Hi

I need to get a EA Attribut and I use GetByname but i have the same problem :

Code: [Select]
if (element.Attributes.GetByName(o) != null)

I didn't understand why "Action is not supported" despite the documentation of this operation.

Thank you.

Pages: [1] 2