Book a Demo

Author Topic: Create ArchiMate 2 element through script  (Read 4349 times)

Filip Hendrickx

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Create ArchiMate 2 element through script
« on: June 20, 2013, 11:46:01 pm »
Hi all.

I try to create ArchiMate 2 elements through a vbscript, like this:

Code: [Select]
dim elements as EA.Collection
set elements = currentPackage.Elements
elements.AddNew("elementName", "ArchiMate2::SystemSoftware")

This example seems to work fine. However when using "ArchiMate2::Device" it creates an ArchiMate 1 Device, and when using "ArchiMate2::ApplicationComponent" I get a TOGAF ApplicationComponent.

I would expect that I should use the exact type names from the technology definition ("ArchiMate2::ArchiMate_SystemSoftware" etc. like in the Scripting EA book) but this gives an error message (wrong type).

While there are workarounds, I was wondering if anyone could point out the correct way of creating these ArchiMate2 elements.

Best regards,

Filip.

Dermot

  • EA Administrator
  • EA User
  • *****
  • Posts: 591
  • Karma: +7/-0
    • View Profile
Re: Create ArchiMate 2 element through script
« Reply #1 on: June 21, 2013, 02:49:44 pm »
Have you tried disabling Archimate 1 in the: Settings |  MDG Techologies.

Filip Hendrickx

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Create ArchiMate 2 element through script
« Reply #2 on: June 21, 2013, 03:47:20 pm »
Hi Dermot.

That seems to work, nice trick!

(Still a workaround, though, so if anyone knows another way around this, I'm curious.)

Thanks very much,

Filip.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Create ArchiMate 2 element through script
« Reply #3 on: June 21, 2013, 07:27:11 pm »
Filip,

It's not really a workaround. You have to choose between archimate versions. Both can't be active at the same time because of various conflicts.

Geert

mlk

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Create ArchiMate 2 element through script
« Reply #4 on: June 23, 2013, 06:29:35 pm »
Try this:

Code: [Select]
Element newElement = package.Elements.AddNew("Example_dev1", "Class");
newElement.Stereotype = "ArchiMate_Device";
newElement.Update();