Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Geert Bellekens on January 02, 2022, 09:58:02 pm

Title: How to use SchemaType.GetFacet(BSTR name)
Post by: Geert Bellekens on January 02, 2022, 09:58:02 pm
I was trying to figure out if a SchemaType element was redefined, so I took to the documentation hoping to find a helpful clue.
https://sparxsystems.com/enterprise_architect_user_guide/15.2/automation/sc_schematypeclass.html (https://sparxsystems.com/enterprise_architect_user_guide/15.2/automation/sc_schematypeclass.html)
Unfortunately there is no "IsRedefined" property, but there is an operation called GetFacet that accepts a parameter of type BSTR with the name name

The documentation says:

Quote
Returns the value of the named facet. 'Root', for example' returns a value indicating whether a type is a root element

Using it to figure out if this element is a root seems a bit pointless since we do have a poperty IsRoot, but I'm wondering what other "Facets" I can use it for.

I have a lot of questions when reading the documentation:
- Can it be used to figure out if an element is redefined?
- What are the other facets we can use it for?
- What is a BSTR? Is that just another name for a string? (that's what Visual Studio tells me anyway)
- What will the "value indicating whether...." be? The string "True", or "true", or "1" or "yes"

Does anyone have more experience with this GetFacet operation?

@Sparx: please update the documentation to actually say something useful

Geert
Title: Re: How to use SchemaType.GetFacet(BSTR name)
Post by: Geert Bellekens on January 05, 2022, 08:33:02 pm
Nobody   :'(

I guess I'm one of the only ones using this part of the API.

I'll send an email directly to support. Hopefully they can shed some light on this topic.

Geert

PS. As a workaround I'm testing to see if the name of my SchemaType differs from the name of the model element, since redefined elements can't have the same name as the original. Not ideal, and certainly not clean, but it seems to do the job for now.
Title: Re: How to use SchemaType.GetFacet(BSTR name)
Post by: Ian Mitchell on January 06, 2022, 01:25:28 am
I'm not using it, but I didn't want you to feel you were all alone.
Title: Re: How to use SchemaType.GetFacet(BSTR name)
Post by: Geert Bellekens on January 06, 2022, 01:37:00 am
I'm not using it, but I didn't want you to feel you were all alone.
Thanks Ian, much appreciated  ;D

Geer