Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: nikunj-dhamecha on January 19, 2023, 11:32:51 pm

Title: How to set Multiple Stereotypes on one EA.Element?
Post by: nikunj-dhamecha on January 19, 2023, 11:32:51 pm
Hello Everyone,
I have one query on the way multiple stereotypes are set on an element using C# API.
I am using EA 16 with C# API, trying to create multiple types of elements(Different Metaclasses), I want to set multiple stereotypes,
let's say for a Class, I want to set two different stereotypes i.e. block and constraintBlock

The issue is if only one stereotype is passed, its shown in the application under a respective element, but If more than one stereotype is being assigned to one element, then no stereotypes are shown under the respective element.

What am I doing wrong here? Do I have to set some other properties as well?
Any pointers would be helpful, Thanks!
Title: Re: How to set Multiple Stereotypes on one EA.Element?
Post by: Geert Bellekens on January 20, 2023, 12:00:31 am
In most cases it's not a good idea to use multiple stereotypes.
A lot of things (like shapescripts) are not very well equiped to handle that.

In your case, it look to me like a constraintBlock is (or should be) a specialized (meta) type of block. So you can use stereotype inheritance in the your profile to model that, and use only constraintBlock as stereotype.

Apart from the advice, you can set multiple stereotypes using the property EA.Element.StereotypeEx: passing comma separated stereotype names.

Geert
Title: Re: How to set Multiple Stereotypes on one EA.Element?
Post by: nikunj-dhamecha on January 23, 2023, 11:13:45 pm
Thanks Geert for the reply.
It worked for me after inserting "," between two stereotypes! :)