[CONNECT Update 16 C++] Has Element Property X?

How can we find programmatically whether a DGN element has a particular property?

For example, several elements have a Length property.  It's valid for lines, line-strings, arcs and I believe curve vectors in general.  The picture is blurred because sometimes the property name (not its display name) is Length and sometimes TotalLength. But can I determine that fact programmatically: I'm looking for fictitious method something like HasProperty (ElementHandleR eh, L"className", L"propName")?

In particular, for my current project I want to know whether a DGN element has the Bearing or Azimuth property.  A simple DGN line element has that property, but what other element types?

Parents
  • Hi Jon,

    How can we find programmatically whether a DGN element has a particular property?

    my feeling is that your question, even when right, smells a bit, because it mixes DGN element (persistence format) and how it is represented in API (which itself is wide topic, as elements are represented in different ways, depending on used API).

    For example, several elements have a Length property. 

    When an element has "length" in geometry meaning, it likely implements ICurvePathQuey API, so it can be represented as curves and length can be calculated.

    The picture is blurred because sometimes the property name (not its display name) is Length and sometimes TotalLength.

    I think it is usually when both names make sense: A segment in LineString has Lenght, but the LineString itself has TotalLength.

    Complete "inheritance chain", how these naming is defined, can be checked in DGN EC schemas.

    But can I determine that fact programmatically

    I think, when code access DGN element property (so data persisted in element), the code "should know" what properties are accessible through specific ElementHandler(s).

    When you do not want to go by "pure API" way and to use ICurvePathQuery, you can ask for intrinsic EC properties of particular element and to check, whether Length or TotalLength exist.

    I want to know whether a DGN element has the Bearing or Azimuth property.

    I am not familiar with Bearing mode, but if I remember right, Bearing / Azimuth is not element property, but angle readout direction mode, set for specific model. I have not enough time, but I do not see anything like Bearing / Azimuth defined for EC representations of DGN elements.

    Can you share more details what do you want to achieve (example DGN, some screenshots...)?

    Regards,

      Jan

Reply
  • Hi Jon,

    How can we find programmatically whether a DGN element has a particular property?

    my feeling is that your question, even when right, smells a bit, because it mixes DGN element (persistence format) and how it is represented in API (which itself is wide topic, as elements are represented in different ways, depending on used API).

    For example, several elements have a Length property. 

    When an element has "length" in geometry meaning, it likely implements ICurvePathQuey API, so it can be represented as curves and length can be calculated.

    The picture is blurred because sometimes the property name (not its display name) is Length and sometimes TotalLength.

    I think it is usually when both names make sense: A segment in LineString has Lenght, but the LineString itself has TotalLength.

    Complete "inheritance chain", how these naming is defined, can be checked in DGN EC schemas.

    But can I determine that fact programmatically

    I think, when code access DGN element property (so data persisted in element), the code "should know" what properties are accessible through specific ElementHandler(s).

    When you do not want to go by "pure API" way and to use ICurvePathQuery, you can ask for intrinsic EC properties of particular element and to check, whether Length or TotalLength exist.

    I want to know whether a DGN element has the Bearing or Azimuth property.

    I am not familiar with Bearing mode, but if I remember right, Bearing / Azimuth is not element property, but angle readout direction mode, set for specific model. I have not enough time, but I do not see anything like Bearing / Azimuth defined for EC representations of DGN elements.

    Can you share more details what do you want to achieve (example DGN, some screenshots...)?

    Regards,

      Jan

Children