Seperate shapes from AIS_Shape?

Hi: I want to seperate shapes from TopoDS_Compound(AIS_Shape). Does anyone know how to do except rebuilding? Thanks.

sincerely shawn

Francois Lauzon's picture

Hi shawn, you could explore a compound shape using an iterator TopoDS_Iterator to access the direct sub-shape of a shape:

// explore the current shape for (TopoDS_Iterator iter(aCompound);iter.More(); iter.Next()) {

// get the direct sub-shape TopoDS_Shape subShape=iter.Value();

// do something }

You might also have a look at TopExp_Explorer to explore a kind of sub-shape in a shape (for example all the face in the compound, either face from solid, direct face, face from shell,...) for (TopExp_Explorer Exp(aCompound,TopAbs_FACE); Exp.More(); Exp.Next()) { // get sub-face TopoDS_Face aFace=TopoDS::Face(Exp.Current()); }

Good Luck, Francois.

Shawn Yang's picture

Hi Fancois: Thanks for your help. I have solved it.

sincerely shawn