[CE][C#] Select specific Element from a Parametric Solid

Hi folks,

I want to specifically select an Element of a Parametric Solid.
As example I have this Parametric Solid:

Now I want the Element behind "Profile #1" that was used for the Extrusion. I have no problems to get all 5 Profiles but I have no Information which Element belongs to which feature. I also have no issues to find the list of all features but I can't make the connection. From a feature and from an Element, I only find back to the root Element.

In the list of all Profiles, its the first Element but only when I didn't replaced it. I've looked at the EC Objects Values but didn't saw any connection between the features and the actual Elements.

Thanks in advance.

Parents Reply Children
  • HI J-P,

    I've looked at everything in the Debugger and found nothing that would look like it would help but to be fair, there are lot of values.

    If I remember right, debugger is not always the right tool, because when ECQuery is not configured right, it does return proper EC classes.


    I've looked into everything. "IECRelationshipInstance of Class OnSameElement" doesn't contains any values.

    Unforutnately I have no example available, but what I see in EC data dump, it's should be represented using LeafElementToSmartFeatureElementRelationship relationship, but it is backward relationship. Because not everything is saved into the dump file, maybe there is also some forward relationship available.

    My experience is that to search for relationship classes is tricky a bit, you should (I guess) create QueryRelatedClassSpecifier and RelatedInstanceSelectCriteria to find them. I remember in the past, based on question, some hints and code snippets were shared by Bentley team in this forum.

    The native API is also an option.

    You can try to check ConstraintCommonNET.dll assembly, where parametric solids (SmartFeature) API is published. I am not sure whether it allows to iterate the content, but maybe you find something useful.

    With regards,

      Jan

  • Hi Jan,

    I ended up using the native "SmartFeatureAPI". The "ConstraintCommonNET.dll" didn't had much options that would help me but from there I found the native API. From there it was just extracting the Tree and going trough all children. This feels way more natural handling with Parametric Solids, than I'm doing it in C#.

    Mit freundlichen Grüßen / Best regards
    Jean-Pierre Hundhausen

    |  AB_DATE Engineering  Software   |  ab-date.de  |