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 - Aaron B

Pages: 1 ... 54 55 [56] 57 58 ... 61
826
The FindObject() method requires a dotted path to the element in relation to the current package.  E.g. "System.Class1".  If you only know the name of the object, but do not know which package it is contained in, you might try using Repository.GetElementsByQuery() instead.  This allows you to execute an EA model search and returns the results as a Collection.

Example:
  Dim results As EA.Collection
  Set results = Repository.GetElementsByQuery("Simple", "Class1")

827
There are some VB.NET code samples in the documentation that may help:
http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/addandmanageelements.html

828
Automation Interface, Add-Ins and Tools / Re: Composites through API.  :(
« on: February 19, 2009, 04:25:04 pm »
It's possible to read a composite diagram from automation, but unfortunately not so easy to set one at this time.

From my understanding, you need to set Element.Subtype = 8, and need to add a row to the [t_xref] table in the database to indicate the guid of the default sub-diagram, which is only possible through direct sql interaction (which you can do, but we can't officially support).

829
To access a running instance of EA, you need to use the equivilent of the GetObject() call as shown in the VB example on the App page.  For C#, try something like this..

Code: [Select]
using System.Runtime.InteropServices;
...
object obj = Marshal.GetActiveObject("EA.App");
EA.App app = obj as EA.App;
EA.Repository rep = app.Repository;

830
Please read my previous response again.

You cannot cast an EA.Element object as EA.Requirement.  An EA.Element object of type "Requirement" is not the same as an EA.Requirement object.

831
Also, an EA.Requirement object is not the same as an EA.Element object of type "Requirement".  You should not try to cast it in this way.

An Element of type "Requirement" is referred to as an External Requirement, while object type EA.Requirement is for Internal Requirements (also called Responsibilities).  EA.Requirement objects are created using the Element.Requirements collection.

To understand the difference between internal and external requirements, see the following links:
http://www.sparxsystems.com/uml_tool_guide/what_is_uml_modeling/internalrequirements.html
http://www.sparxsystems.com/uml_tool_guide/what_is_uml_modeling/externalrequirements.html

To create a new Requirement Element (external requirement):

Code: [Select]
EA.Package aPackage = Repository.GetTreeSelectedPackage();
EA.Element element = (EA.Element)aPackage.Elements.AddNew("Test1", "Requirement");
element.Update();

To create an internal requirement:

Code: [Select]
EA.Element element = [...]
EA.Requirement req = (EA.Requirement)element.Requirements.AddNew("Test1", "Functional");
req.Update();

832
If you want to get an image of the diagram, look at using either the PutDiagramImageOnClipboard or PutDiagramImageToFile methods on the EA.Project object.
http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/project_2.html

833
The Add-In needs to be registered with the system (i.e. using regasm.exe), and also needs to have an entry in the local registry to tell EA to look for it (e.g. [HKEY_CURRENT_USER\Software\Sparx Systems\EAAddins\<Addin Name>]).  If a user does not have rights to modify the registry, it may not be possible to properly install the Add-In.

834
From memory, .NET DLL's get registered with regasm.exe, not regsvr32.exe.  In either case, you shouldn't need to manually run this to do debugging.  In your VS project, make sure that "Register for COM Interop" is enabled (I think this is usually under the Build options).

835
Automation Interface, Add-Ins and Tools / Re: EA Lite & Plugins
« on: November 26, 2008, 11:51:38 am »
Try reading the Repository.EAEdition property. Values should correspond to the EA.EAEditionTypes enumeration.  I believe EA Lite reports a value of -1.

836
Automation Interface, Add-Ins and Tools / Re: Getting the linked item
« on: June 27, 2008, 03:32:10 pm »
Ibrahim,

1) First, you need a reference to the Element you are interested in.
2) Loop over the Element.Connectors collection
3) Check the Connector.ClientID and Connector.SupplierID values.  These are ElementID values for the objects at each end of the connector.  One of these will refer back to your first element, and the other will refer to the related element.
4) With the ElementID obtained above, use Repository.GetElementById() to retrieve a reference to the related element.

837
Kezia,

I would highly recommend that you run newAttribute.Update() before your create the new tagged value.  When creating a new object through automation, always run the object's Update() method before attempting to add anything to it's collection properties.

So something more like...

Code: [Select]
EA.Attribute newAttribute = (EA.Attribute)elContainer.Attributes.AddNew("MyAttribute", "");
newAttribute.Update();

EA.AttributeTag attrTag = (EA.AttributeTag)newAttribute.TaggedValues.AddNew("TagName", "");
attrTag.Value = "TagValue";
attrTag.Update();

newAttribute.TaggedValues.Refresh();

HTH.

838
".vbp" files are project files, not source files.  ".bas" files can be imported by EA 7.1.  In Tools | Options, try setting the Import File Extensions setting for Visual Basic to ".cls;.frm;.ctl;.bas;".  See Visual Basic Options.

The only way to synchronize with a project file is by using something like our MDG Link Add-Ins (E.g. MDG Link for Visual Studio).  Unfortunately though there is no MDG Add-In for VB6 projects.

839
Last I knew on the subject, EA Automation would not work running as a service.  Not sure of the exact reason however.  I am not aware of anyone sucessfully running EA Automation from a windows service.

NB: When instantiating a new EA.Repository object, it needs to start an 'EA.exe' process to interface with.  It would appear that perhaps it is failing to start this process.

840
Just in addition to Simon's comments - MDG Link for Eclipse should work under Linux.  MDG Integration for Eclipse does not.  Please make sure that you are installing the correct Add-In.
http://www.sparxsystems.com/products/mdg_eclipse.html

Pages: 1 ... 54 55 [56] 57 58 ... 61