[Connect C++] Query properties of a GroupedHole element

I would like to query the properties of a GroupedHole element. I think I need to use the GroupedHoleHandler and so far I got this:

if (GroupedHoleHandler::IsGroupedHole(eh))
{
	GroupedHoleHandler::GetInstance().QueryProperties(eh, ???);
}

The second parameter to the QueryProperties method is a PropertyContextR. How do I create this ? I've spent some time on looking through the documentation but I didn't find a solution.

Regards, Evan

Parents
  • Unknown said:
    I've spent some time on looking through the documentation but I didn't find a solution

    I'm with you on that.  Trying to write code while consulting the MicroStationAPI help is equivalent to writing a new Shakespeare play with the aid of a dictionary.

    There's one delivered example that bears tangentially on your question: in ElementsExample\ElementsExampleQueryTool.cpp you'll see how to use a ElementPropertiesGetterPtr.

     
    Regards, Jon Summers
    LA Solutions

  • I've tried to use the ElementPropertiesGetterPtr and it works fine on other element types (lines, linestrings, cells, shared cells etc) but it doesn't work on GroupedHole elements. The color returned got some very strange value like 1880678415...

    I've just tested it again and now I can see why. The originally returned value was COLOR_BY_LEVEL and as I tried to get the color from the level, I didn't see that the LevelHandle was not OK.

    Here is my code:

    UInt32 color = propGetter->GetColor();
    lvlHandle = eh.GetDgnModelP()->GetFileLevelCache().GetLevel(propGetter->GetLevel());
    
    if (color == COLOR_BYLEVEL)
        color = lvlHandle.GetByLevelColor().GetColor();

    Regards, Evan

    Answer Verified By: EvanH 

Reply
  • I've tried to use the ElementPropertiesGetterPtr and it works fine on other element types (lines, linestrings, cells, shared cells etc) but it doesn't work on GroupedHole elements. The color returned got some very strange value like 1880678415...

    I've just tested it again and now I can see why. The originally returned value was COLOR_BY_LEVEL and as I tried to get the color from the level, I didn't see that the LevelHandle was not OK.

    Here is my code:

    UInt32 color = propGetter->GetColor();
    lvlHandle = eh.GetDgnModelP()->GetFileLevelCache().GetLevel(propGetter->GetLevel());
    
    if (color == COLOR_BYLEVEL)
        color = lvlHandle.GetByLevelColor().GetColor();

    Regards, Evan

    Answer Verified By: EvanH 

Children
No Data