69 if (origCompound.IsNull()) {
70 keepGeo = std::move(removeGeo);
74 TopoDS_ListOfShape newShapes;
75 static constexpr std::array<TopAbs_ShapeEnum, 4> shapeTypes{
76 TopAbs_SOLID, TopAbs_FACE, TopAbs_EDGE, TopAbs_VERTEX};
78 for (TopExp_Explorer explorer{newCompound,
shapeType}; explorer.More();
80 auto &oldSubshape = explorer.Current();
81 if (
auto old_metadata = removeGeo.
get(oldSubshape)) {
82 keepGeo.
insert(oldSubshape, std::move(*old_metadata));
86 if (!newCompound.IsNull()) {
88 BRepAlgoAPI_Cut cutter{origCompound, newCompound};
89 if (cutter.HasDeleted() || cutter.HasModified() ||
90 cutter.HasGenerated()) {
91 auto deletedShapes = keepGeo.
modify(cutter, {TopAbs_EDGE, TopAbs_FACE});
94 BRepBuilderAPI_Sewing sewer{};
95 std::vector<TopoDS_Shape> sewedShapes;
97 for (TopExp_Explorer explorer{compound, TopAbs_FACE}; explorer.More();
99 sewer.Add(explorer.Current());
100 sewedShapes.emplace_back(explorer.Current());
104 keepGeo.
modify(sewer, sewedShapes, {TopAbs_EDGE, TopAbs_FACE});
std::pair< MapType::iterator, bool > insert(const TopoDS_Shape &shape, std::shared_ptr< ShapeData > shapeData)
std::shared_ptr< ShapeData > * get(const TopoDS_Shape &shape)
Get the data from the map.
void deleteShapes(const TopoDS_Shape &shape)
Remove a shape from the map.
int getDim() const
Get dimension of geometry.
static constexpr auto shapeType
TopoDS_Compound buildCompound() const
Create a compound from shapes present in the map that have same dimension as the instance.
std::vector< TopoDS_Shape > modify(BRepBuilderAPI_MakeShape &op, const std::vector< TopoDS_Shape > &shapes, const std::vector< TopAbs_ShapeEnum > &typesToTraverse={ TopAbs_VERTEX, TopAbs_EDGE, TopAbs_FACE, TopAbs_SOLID})
Modify this geoMetadata after a BRepBuilderAPI_MakeShape operation.
void setDim(int dim)
Set the dimension.