//-------------------------------------------------------------------------------------------------- #endregion #region Property List void _InitProperties() { if (_Properties != null) { return; } _Properties = new List <BRepTopologyTreeProperty>(); try { _AddDefaultProperties(); switch (BrepShape.ShapeType()) { case TopAbs_ShapeEnum.TopAbs_SHELL: _AddShellProperties(BrepShape as TopoDS_Shell ?? TopoDS.Shell(BrepShape)); break; case TopAbs_ShapeEnum.TopAbs_FACE: _AddFaceProperties(BrepShape as TopoDS_Face ?? TopoDS.Face(BrepShape)); break; case TopAbs_ShapeEnum.TopAbs_WIRE: _AddWireProperties(BrepShape as TopoDS_Wire ?? TopoDS.Wire(BrepShape)); break; case TopAbs_ShapeEnum.TopAbs_EDGE: _AddEdgeProperties(BrepShape as TopoDS_Edge ?? TopoDS.Edge(BrepShape)); break; case TopAbs_ShapeEnum.TopAbs_VERTEX: _AddVertexProperties(BrepShape as TopoDS_Vertex ?? TopoDS.Vertex(BrepShape)); break; } } catch (Exception e) { Messages.Exception($"Error getting properties for B-Rep shape {Name}", e); } }
//-------------------------------------------------------------------------------------------------- public static List <TopoDS_Shell> Shells(this TopoDS_Shape shape, bool distinct = true) { var shells = new List <TopoDS_Shell>(); var exp = new TopExp_Explorer(shape, TopAbs_ShapeEnum.TopAbs_SHELL, TopAbs_ShapeEnum.TopAbs_SHAPE); while (exp.More()) { var shell = TopoDS.Shell(exp.Current()); exp.Next(); if (distinct) { if (shells.Any(e => e.IsSame(shell))) { continue; } } shells.Add(shell); } return(shells); }
//-------------------------------------------------------------------------------------------------- public static TopoDS_Shell ToShell(this TopoDS_Shape shape) { return(shape == null ? null : TopoDS.Shell(shape)); }