How to get full topology tree from non-root shape?

easternbun

CAD practitioner
I am testing filleting, and I have edge back from mouse selection. I do not have the solid so how do I get the solid or in any matter the entire complete topo tree?

I looked into TShape and it only perserves its children. I could not find a valid way to get the tree.
1693210916739.png
 
Last edited:

TLohi

Looking around for some CAD
Hi easternbun,

If you are using AIS for visualization, this can be achieved using following code:

Code:
Handle(AIS_InteractiveContext) con = myDocument->getContext();
for(con->InitSelected(); con->MoreSelected(); con->NextSelected())
{
    if(con->SelectedInteractive()->IsKind(STANDARD_TYPE(AIS_Shape)))
    {
        Handle(AIS_Shape) aisShape= Handle(AIS_Shape)::DownCast(con->SelectedInteractive());
        qDebug() << "Selected is Shape";

        TopoDS_Shape shape = con->SelectedShape();
        qDebug() << "shape type:" << TopAbs::ShapeTypeToString(shape.ShapeType());

        TopoDS_Shape parentShape = aisShape->Shape();
        qDebug() << "parent type:" << TopAbs::ShapeTypeToString(parentShape.ShapeType());
    }
}

When I tested this code, I selected edge from cube and got edge into shape varable and its parent solid in parentShape variable.
 
Top