bool IfcGeom::is_compound(const TopoDS_Shape& shape) { bool has_solids = TopExp_Explorer(shape,TopAbs_SOLID).More() != 0; bool has_shells = TopExp_Explorer(shape,TopAbs_SHELL).More() != 0; bool has_compounds = TopExp_Explorer(shape,TopAbs_COMPOUND).More() != 0; bool has_faces = TopExp_Explorer(shape,TopAbs_FACE).More() != 0; return has_compounds && has_faces && !has_solids && !has_shells; }
// static member function HeeksObj* CShape::MakeObject(const TopoDS_Shape &shape, const wxChar* title, SolidTypeEnum solid_type, const HeeksColor& col, float opacity){ if(shape.IsNull())return NULL; switch(shape.ShapeType()){ case TopAbs_FACE: { return new CFace(TopoDS::Face(shape)); } case TopAbs_WIRE: { return new CWire(TopoDS::Wire(shape), title); } case TopAbs_EDGE: { return new CEdge(TopoDS::Edge(shape)); } case TopAbs_VERTEX: return NULL; case TopAbs_COMPOUND: case TopAbs_COMPSOLID: case TopAbs_SOLID: case TopAbs_SHELL: case TopAbs_SHAPE: { switch(solid_type) { case SOLID_TYPE_SPHERE: return new CSphere(*((TopoDS_Solid*)(&shape)), title, col, opacity); case SOLID_TYPE_CYLINDER: return new CCylinder(*((TopoDS_Solid*)(&shape)), title, col, opacity); case SOLID_TYPE_CUBOID: return new CCuboid(*((TopoDS_Solid*)(&shape)), title, col, opacity); case SOLID_TYPE_CONE: return new CCone(*((TopoDS_Solid*)(&shape)), title, col, opacity); default: // check there are some faces if(TopExp_Explorer(shape, TopAbs_FACE).More()) return new CSolid(*((TopoDS_Solid*)(&shape)), title, col, opacity); return NULL; } } } return NULL; }