[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
  • You can try to get all instances available on a specific element. And then check if the individual instance has a specific property:

    //ECQueryProcessFlags flags = intrinsic or extrinsic

    ECInstanceList GetElementProperties(ElementHandleCR element, ECQueryProcessFlags flags)
    {
    ECInstanceList ecInstanceList;
    DgnECManagerR dgnECManager = DgnECManager::GetManager();

    FindInstancesScopePtr scope = FindInstancesScope::CreateScope(element, FindInstancesScopeOption(DgnECHostType::Element));
    ECQueryPtr findAll = ECQuery::CreateQuery(flags);

    for each (DgnECInstancePtr instance in dgnECManager.FindInstances(*scope, *findAll))
    ecInstanceList.push_back(instance);

    return ecInstanceList;
    }

    Also, if you know Schema-Class, then you can prepare ECQuery accordingly.


    This is a test

    Answer Verified By: Jon Summers 

Reply
  • You can try to get all instances available on a specific element. And then check if the individual instance has a specific property:

    //ECQueryProcessFlags flags = intrinsic or extrinsic

    ECInstanceList GetElementProperties(ElementHandleCR element, ECQueryProcessFlags flags)
    {
    ECInstanceList ecInstanceList;
    DgnECManagerR dgnECManager = DgnECManager::GetManager();

    FindInstancesScopePtr scope = FindInstancesScope::CreateScope(element, FindInstancesScopeOption(DgnECHostType::Element));
    ECQueryPtr findAll = ECQuery::CreateQuery(flags);

    for each (DgnECInstancePtr instance in dgnECManager.FindInstances(*scope, *findAll))
    ecInstanceList.push_back(instance);

    return ecInstanceList;
    }

    Also, if you know Schema-Class, then you can prepare ECQuery accordingly.


    This is a test

    Answer Verified By: Jon Summers 

Children