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

Pages: [1]
1
Or use the new property EA.Element.FQStereotype

Geert

This worked, thanks

2
Quote
That might need to be "SysML1.4::requirement", depending on the version you are using.
In version 15 you can actually see the fully qualified stereotype in the properties. Use that to set StereotypeEx

I also have a similar issue, where do i find the full stereotype, if i look at the StereoType, StereoTypeEx properties they only show the base version, in this case, 'requirement'. Is there a property i can look at to get the full value "SysML1.4::requirement"

3
Sorry, the "ElementService " is the class which contains the "CreateElement", "CreateConnection", "ProcessJson" methods and i call the "ProcessJson" from the test which internally calls "CreateElement".

Code: [Select]
     ElementService elementService = new ElementService(repo);
      // create parent requirement
      RequirementObj reqObj = GetResource<RequirementObj>("requirement.json");
      Element parent = elementService.[b]ProcessJson[/b](reqObj);
      Assert.IsNotNull(parent);
      Assert.AreEqual(parent.Name, "Parent");

      // create child requirement - performance
      reqObj = GetResource<RequirementObj>("child_req.json");
      Assert.IsNotNull(reqObj);
      Element child = elementService.ProcessJson(reqObj);
      Assert.IsNotNull(child);
      Assert.AreEqual(child.Name, "Child");

      // relate
      reqObj = GetResource<RequirementObj>("relation.json");
      Assert.IsNotNull(reqObj);
      Element updatedChild = elementService.ProcessJson(reqObj);

      Assert.AreEqual(child.ElementGUID, updatedChild.ElementGUID);
      Assert.AreEqual(child.Name, updatedChild.Name);

4
I only running some asserts between the creates

Code: [Select]
      ElementService ElementService = new ElementService(repo);
      // create parent requirement
      RequirementObj reqObj = GetResource<RequirementObj>("requirement.json");
      Element parent = ElementService.ProcessJson(reqObj);
      Assert.IsNotNull(parent);
      Assert.AreEqual(parent.Name, "Parent");

      // create child requirement - performance
      reqObj = GetResource<RequirementObj>("child_req.json");
      Assert.IsNotNull(reqObj);
      Element child = ElementService.ProcessJson(reqObj);
      Assert.IsNotNull(child);
      Assert.AreEqual(child.Name, "Child");

      // relate
      reqObj = GetResource<RequirementObj>("relation.json");
      Assert.IsNotNull(reqObj);
      Element updatedChild = ElementService.ProcessJson(reqObj);

      Assert.AreEqual(child.ElementGUID, updatedChild.ElementGUID);
      Assert.AreEqual(child.Name, updatedChild.Name);



5
Something like this should work bettter:

Code: [Select]
public bool CreateElement(...) {

parentPkg = CreateOrGetParentPkg(inputEle);
         
string eleType = inputEle.Type;
// name and type are passed are args to method
ele = parentPkg.Elements.AddNew(eleName, eleType);
ele.Update(); //save here to make sure it's in the database before messing with the other stuff

// creating diagram
Diagram rootDiagram = CreateOrGetDiagram(parentPkg, parentPkg.Name);

// Add element to diagram - autogenerate position
DiagramObject diagramObject = (DiagramObject)rootDiagram.DiagramObjects.AddNew(GetDiagramObjectPosition(ele.Name.Length), "");
diagramObject.ElementID = ele.ElementID;
diagramObject.Update();

//if you want to see the changes in the project browser you can do a reload here
Repository.ReloadPackage (parentPkg.PackageID) ; //check the exact syntax
}

Geert

Thanks for the corrections, my issue is after the first Element create, i can see the element in Project Browser, once the second create happens, the first one disappears. do you see anything wrong with my code.

 After the second create, i have the connector create which also fails.

6
Besides the fact that you're doing lots of superfluous updates and refreshes and use unknown functions there's nothing which creates a connector.

q.
I did not post the code for the connector creation because the issue seems to be with creation, even though the creation is successful the element cant be found

Code: [Select]
// link is an arg, ele and otherSide are the 2 requirements
Connector connector = ele.Connectors.AddNew(link.Name, link.LinkType);
connector.SupplierID = otherSide.ElementID;
connector.Update();


7
Hello everyone,
I am writing some MS tests for a service i wrote, in which i create elements and add them to a given package. The same code works from an addin.

In my Test, i am trying to test my connector creation, in the test buildup, i create 2 elements of type "Requirement" and then i create a connector between them. During the creation of the elements i create(if not exists) a diagram and add diagram-object  for each element.

Whats happening is when i create the second Element, the first element is unlinked from the package and the diagram during the created during creation of Element 1 also disappears.

If i open project in EA15 and search for all elements i can see the Element1 along with Element2 but i cant locate the Element1 in the project browser.

And because of this when i try to create a connector between the 2 Elements i get "System.Runtime.InteropServices.COMException (0x800403E9): Cannot update connector as either the Start or the End object is NULL"

When i am printing the ID, Name, other props of both the elements during creation of connector, i can can see they look all correct.

The code below is my create Element method. i call this twice to make the 2 elements
Code: [Select]
public bool CreateElement(...) {

parentPkg = CreateOrGetParentPkg(inputEle);
         
string eleType = inputEle.Type;
// name and type are passed are args to method
ele = parentPkg.Elements.AddNew(eleName, eleType);

// creating diagram
Diagram rootDiagram = CreateOrGetDiagram(parentPkg, parentPkg.Name);
parentPkg.Elements.Refresh();
parentPkg.Update();

// Add element to diagram - autogenerate position
DiagramObject diagramObject = (DiagramObject)rootDiagram.DiagramObjects.AddNew(GetDiagramObjectPosition(ele.Name.Length), "");
diagramObject.ElementID = ele.ElementID;
diagramObject.Update();
rootDiagram.Update();
rootDiagram.DiagramObjects.Refresh();
parentPkg.Update();
parentPkg.Diagrams.Refresh();
ele.Update();
}

Any pointers in figuring out why this is happening will be highly appreciated, thanks

8
If you are using an installer you'll have to make sure it includes these files as well.

Yup, sounds like an installer problem.

It's not EA itself that's giving you the error, that's thrown up from the OS when EA tells it to load the Add-In DLL.

So I'd say what you've bumped into here is the limit of the "various docs" you've followed, if they don't include how to construct an installer for your Add-In. But there's plenty of stuff on installers to be found all over the net.


/Uffe

I created a installer using the nice doc Geert Bellekens made. https://bellekens.com/2011/02/23/tutorial-deploy-your-enterprise-architect-csharp-add-in-with-an-msi-package/
I can see all the dependencies being installed under the program files and can also see the registry entry.
I still end up with the same error. is there another way to link the dll, i tried regassm on that dll, that also didnt work
Thanks

9
Make sure build process actually copies the required dll's to the output folder.

Geert

I can see all the dll's in the Release Directory.

10
Hello Experts,
 I have created a simple add-in after going through various docs, that worked well, but the issue started when i had to add a few NuGet references to my addin, the build goes well, i can see no error in "Specialize- Manage Addins" of EA15 either.

But when i added a (indirect) reference to System.Memory, EA throws up saying "could not load file or Assembly System.Memory" as shown below.



The Target framework for the dll is 4.5.
I have other references like log4net and newtonjson, they seems to be working without any issues, i am wondering if this is an issue with add-in not packing the references or some .net framework incompatibility issues.
Is there a way to add this reference directly to EA 15 and is this the right way?

I havent used C# in sometime (or in as a addin/plugin) so please excuse me if this is a silly question.

Any pointers would be helpful, thank you.

Pages: [1]