I'm developing a DgnElementSetTool with _OnPostLocate() to return either a single "primitive" (non-complex) element like a Line or LineString OR the currently located sub-element of a cell:
private: virtual bool _OnPostLocate(HitPathCP path, WStringR cantAcceptReason)
{
__super::_OnPostLocate(path, cantAcceptReason);
// get the element
ElementHandle eh(mdlDisplayPath_getElem((DisplayPathP)path, 0), mdlDisplayPath_getPathRoot((DisplayPathP)path));
if (eh.GetElementType() == CELL_HEADER_ELM)
{
ElementHandle ehPart(mdlDisplayPath_getElem((DisplayPathP)path, 1), mdlDisplayPath_getPathRoot((DisplayPathP)path));
...
}
else
{
...
}
}
As I move the cursor over a cell, occasionally, the ElementHandle "ehPart" that is created returns false for ehPart.IsValid(). Why does that happen? If the ElementHandle "eh" created from the HitPathCP and tested to ensure it is a cell header, then why does
ElementHandle ehPart(mdlDisplayPath_getElem((DisplayPathP)path, 1), mdlDisplayPath_getPathRoot((DisplayPathP)path));
sometimes result in an invalid ElementHandle ?