diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index 763f6da53b..58a64f41ef 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -1237,17 +1237,6 @@ static std::list sort_Edges(double tol3d, const std::vector(sorted.begin(), sorted.end())); - sorted.clear(); - - if (!edge_points.empty()) { - // new wire - first = edge_points.front()->v1; - last = edge_points.front()->v2; - sorted.push_back(edge_points.front().edge); - edge_points.erase(edge_points.begin()); - }*/ } } diff --git a/src/Mod/Part/App/CMakeLists.txt b/src/Mod/Part/App/CMakeLists.txt index cad3395a49..51065d405d 100644 --- a/src/Mod/Part/App/CMakeLists.txt +++ b/src/Mod/Part/App/CMakeLists.txt @@ -227,6 +227,8 @@ SET(Part_SRCS TopoShape.h edgecluster.cpp edgecluster.h + modelRefine.cpp + modelRefine.h ) SET(Part_Scripts diff --git a/src/Mod/Part/App/Makefile.am b/src/Mod/Part/App/Makefile.am index c7f005ceaf..5a9a45605f 100644 --- a/src/Mod/Part/App/Makefile.am +++ b/src/Mod/Part/App/Makefile.am @@ -127,6 +127,7 @@ libPart_la_SOURCES=\ Geometry.cpp \ ImportIges.cpp \ ImportStep.cpp \ + modelRefine.cpp \ CustomFeature.cpp \ PartFeature.cpp \ PartFeatureReference.cpp \ @@ -179,6 +180,7 @@ include_HEADERS=\ Geometry.h \ ImportIges.h \ ImportStep.h \ + modelRefine.h \ PartFeature.h \ PartFeatureReference.h \ CustomFeature.h \ diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index 0ee407d9ec..eac85786e8 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -44,6 +44,7 @@ # include # include # include +# include # include # include # include @@ -97,6 +98,7 @@ # include # include # include +# include # include # include # include @@ -152,6 +154,7 @@ #include "TopoShapeEdgePy.h" #include "TopoShapeVertexPy.h" #include "ProgressIndicator.h" +#include "modelRefine.h" using namespace Part; @@ -1717,6 +1720,36 @@ bool TopoShape::removeInternalWires(double minArea) return ok; } +void TopoShape::removeSplitter() +{ + if (_Shape.IsNull()) + Standard_Failure::Raise("Cannot remove splitter from empty shape"); + + if (_Shape.ShapeType() == TopAbs_SOLID) { + TopoDS_Solid& solid = TopoDS::Solid(_Shape); + ModelRefine::FaceUniter uniter(solid); + if (uniter.process()) { + TopoDS_Solid solidMod; + if (!uniter.getSolid(solidMod)) + Standard_Failure::Raise("Getting solid failed"); + _Shape = solidMod; + } + else { + Standard_Failure::Raise("Removing splitter failed"); + } + } + else if (_Shape.ShapeType() == TopAbs_SHELL) { + TopoDS_Shell& shell = TopoDS::Shell(_Shape); + ModelRefine::FaceUniter uniter(shell); + if (uniter.process()) { + _Shape = uniter.getShell(); + } + else { + Standard_Failure::Raise("Removing splitter failed"); + } + } +} + namespace Part { struct MeshVertex { diff --git a/src/Mod/Part/App/TopoShape.h b/src/Mod/Part/App/TopoShape.h index b91a32b836..6397410a18 100644 --- a/src/Mod/Part/App/TopoShape.h +++ b/src/Mod/Part/App/TopoShape.h @@ -219,6 +219,7 @@ public: void sewShape(); bool fix(double, double, double); bool removeInternalWires(double); + void removeSplitter(); //@} /** @name Getting basic geometric entities */ diff --git a/src/Mod/Part/App/TopoShapePy.xml b/src/Mod/Part/App/TopoShapePy.xml index af77a262a7..1a953e2c6d 100644 --- a/src/Mod/Part/App/TopoShapePy.xml +++ b/src/Mod/Part/App/TopoShapePy.xml @@ -283,6 +283,11 @@ The parameter is a list of shapes. Checks whether a point is inside or outside a given shape + + + Removes redundant edges from the B-REP model + +