Book a Demo

Recent Posts

Pages: 1 2 3 [4] 5 6 ... 10
31
Having asked Copilot to write me a JavaScript to convert an class element to an ArchiMate3 data object, Copilot has generated the function below.

It not only did not work. It tried a number of things I was not expecting, specifically:
  • element.Stereotype = "ArchiMate3::DataObject";
  • element.StereotypeEx = "ArchiMate3::DataObject";
  • element.MetaType = "ArchiMate3::DataObject";
  • Repository.AdviseElementChange(element.ElementID);

The only way to get this to work was to use just 1, and comment out 2 and 3. I also don't understand the purpose of 3 & 4.

It has been a long week and I don't think I have the bandwidth to understand this, perhaps somebody can shed some light on why the AI will add 3 & 4. 2 could just be a case of dumb AI.

Code: [Select]
function convertToArchiMateDataObject(element) {

    Session.Output("   🔄 Converting: " + element.Name);

    //
    // STEP 1 — Clear stereotypes completely
    //
    element.Stereotype = "";
    element.StereotypeEx = "";
    element.Update();


    //
    // STEP 2 — Apply ArchiMate Data Object stereotype correctly
    //
    // EA requires this exact format: <MDG>::<Stereotype>
    //
    element.Stereotype = "ArchiMate3::DataObject";
    element.StereotypeEx = "ArchiMate3::DataObject";

    //
    // STEP 3 — Force MDG meta-type (important!)
    //
    element.MetaType = "ArchiMate3::DataObject";


    //
    // STEP 4 — Save and refresh element
    //
    element.Update();
    Repository.AdviseElementChange(element.ElementID);

    Session.Output("      ✔ Converted to ArchiMate3::DataObject");
}
32
Automation Interface, Add-Ins and Tools / Re: Model Add-in (non-blocking) errors
« Last post by Eve on February 06, 2026, 08:34:52 am »
The .Value is apparently needed here

Info is an EventProperties, all of the members are instances of EventProperty. So, yes if you don't add the .Value you are passing a dispatch object back into a function that expects an integer.

I did try both proposals and they both give the same error while providing a correct result.

I would trace the value and type of the elementId and its type and double check that you have reloaded that add-in after making a change.

Code: [Select]
elementId = Info.Get("ElementID").Value;
Repository.WriteOutput("System", typeof elementId + " - " + elementId, 0);
newElement = Repository.GetElementByID(elementId);

To ensure the add-in is reloaded, turn it off in the add-ins window and back on or reload the model.
33
General Board / Re: Special Characters in EA Properties View
« Last post by Polymorph on February 04, 2026, 02:41:13 am »
Obviously very late to the party here... but I have found a possible resolution to this issue. With your model open
  • Go to Settings Menu
  • Go to options (Model panel)
  • Go to Source Code Engineering
  • Change page for source editing to "65001 (UTF-8)"
  • With Excel file open, save as "CSV UTF-8 (Comma delimited) (*.csv)"
  • Import as normal

In the CSV import screen you should see the Code Page panel now says 65001 (UTF-8).

If you don't also save the Excel file as UTF-8, then it doesn't work - but if you do it should remove the random �characters! from your imports :)
34
Automation Interface, Add-Ins and Tools / Re: Model Add-in (non-blocking) errors
« Last post by ppeeters on February 03, 2026, 10:07:24 pm »
I did try both proposals and they both give the same error while providing a correct result.
However I have narrowed down the problem to the creation element with a stereotype from an added model MDG.
I've tried with the stock APM MDG than can be build with v17 and it gives the same error if a use one of the stereotype defined in the MDG.
If I create a new simple UML class, there is no error.

It looks like a "bug" then even though the script is succefully executed.
35
This works for me

Code: [Select]
// get element id from event properties
var elementId = Info.Get("ElementID").Value;

// load the element
var element = Repository.GetElementByID(elementId);

The .Value is apparently needed here

Geert
36
Automation Interface, Add-Ins and Tools / Re: Model Add-in (non-blocking) errors
« Last post by philchudley on February 03, 2026, 01:30:07 am »
Try this code to replace your lines 13,14 and 15

Code: [Select]
var itemID = Info.Get(0);
var theElement = Repository.GetElementByID(itemID);

Phil
37
Automation Interface, Add-Ins and Tools / Model Add-in (non-blocking) errors
« Last post by ppeeters on February 03, 2026, 12:49:47 am »
Hi,

I'm new to model add-ins and tried to implement a javascript addin the is triggered on EA_OnPostNewElement to fill in a specific tagged value of elements of a given stereotype (defined using an MDG).

I cannot get rid of an error that occurs while retrieving the element being created:

Part of the code of the EA_OnPostNewElement reception method start with

Code: [Select]
// Configuration
var STEREOTYPE_NAME = "TEA_Capability"; // Stereotype to be catched
var TAGGEDVALUE_NAME = "Capability ID"; // Tagged value name
var ID_PREFIX = "CAP"; // ID prefix
// Extract ID from Info
var elementId, newElement;
elementId = Info.Get("ElementID");
newElement = Repository.GetElementByID(elementId);
if (newElement) {
    if (newElement.Stereotype != STEREOTYPE_NAME) {
        return false;
    }
    // Check if tagged value already exists and has a value
    var tvs = newElement.TaggedValues;

The method is invoked when creating a new element of the given stereotype but it outputs the message:
Code: [Select]
Invocation error in: addin.EA_OnPostNewElement
------------------------------------------------
  12:    // Extract ID from Info
  13:    var elementId, newElement;
  14:    elementId = Info.Get("ElementID");
  15:    newElement = Repository.GetElementByID(elementId);             [!!!! Exception in GetElementByIDInternal application error.]
  16:    if (newElement) {
  17:        if (newElement.Stereotype != STEREOTYPE_NAME) {
  18:            return false;
  19:        }
  20:        // Check if tagged value already exists and has a value
--------------------------------------------------

However the method completes succefully and the tagged value is updated as expected.

I'm using EA v17.0

Any idea what the problem might be ?

Thanks
38
Hi,

Filters are useful to hide or grey out elements or connectors from a diagram.
There are currently 3 filter sets: Element, Connector and TagValue. The last set applies to elements' tagged values. Would it be possible to support connectors tagged values as a new option?
Working on a UML profile with stereotyped relationships, it would be great to easily filter such links based on their "stereotype" tagged value.

Thanks
+1
39
Automation Interface, Add-Ins and Tools / Re: Shape Scripts: Text in Subshapes
« Last post by Geert Bellekens on January 31, 2026, 10:44:51 pm »
There's still a lot of messing about with the parameters needed to get sort-of good results.
Shapescripts don't seem to work like an exact science.

Geert
40
Suggestions and Requests / Connectors tagged value support in diagram filters
« Last post by Guillaume on January 31, 2026, 02:01:13 am »
Hi,

Filters are useful to hide or grey out elements or connectors from a diagram.
There are currently 3 filter sets: Element, Connector and TagValue. The last set applies to elements' tagged values. Would it be possible to support connectors tagged values as a new option?
Working on a UML profile with stereotyped relationships, it would be great to easily filter such links based on their "stereotype" tagged value.

Thanks
Pages: 1 2 3 [4] 5 6 ... 10