I made some more modifications to the PR, just for debugging purposes. Here is the diff:
Code: Select all
--- src/Mod/Part/App/FeatureExtrusion.cpp
+++ src/Mod/Part/App/FeatureExtrusion.cpp
@@ -28,9 +28,12 @@
# include <gp_Trsf.hxx>
# include <BRepAdaptor_Surface.hxx>
# include <BRepAdaptor_Curve.hxx>
+# include <BRepClass3d_SolidClassifier.hxx>
# include <BRepOffsetAPI_MakeOffset.hxx>
# include <BRepBuilderAPI_Copy.hxx>
+# include <BRepBuilderAPI_MakeSolid.hxx>
# include <BRepBuilderAPI_MakeWire.hxx>
+# include <BRepBuilderAPI_Sewing.hxx>
# include <BRepOffsetAPI_ThruSections.hxx>
# include <BRepPrimAPI_MakePrism.hxx>
# include <Precision.hxx>
@@ -45,6 +48,8 @@
#endif
#include "FeatureExtrusion.h"
+#include <App/Application.h>
+#include <App/Document.h>
#include <Base/Tools.h>
#include <Base/Exception.h>
#include "Part2DObject.h"
@@ -612,16 +617,28 @@ void Extrusion::makeDraft(const ExtrusionParameters& params, const TopoDS_Shape&
TopoDS_Shape front = shape;
front.Move(invObjLoc);
sewer.Add(front);
+ Part::Feature *front_feature = static_cast<Part::Feature*> (App::GetApplication().getActiveDocument()->addObject("Part::Feature","front"));
+ front_feature->Shape.setValue(front);
std::vector<TopoDS_Wire> backwires;
- for (auto& wires : extrusionSections)
+ for (auto& wires : extrusionSections){
backwires.push_back(TopoDS::Wire(wires.back()));
+ Part::Feature *wire_feature = static_cast<Part::Feature*> (App::GetApplication().getActiveDocument()->addObject("Part::Feature","wire"));
+ wire_feature->Shape.setValue(TopoDS::Wire(wires.back()));
+ }
TopoDS_Shape back = Part::FaceMakerCheese::makeFace(backwires);
+ Part::Feature *back_feature = static_cast<Part::Feature*> (App::GetApplication().getActiveDocument()->addObject("Part::Feature","back"));
+ back_feature->Shape.setValue(back);
sewer.Add(back);
- for (TopoDS_Shape& s : shells)
+ for (TopoDS_Shape& s : shells){
sewer.Add(s);
+ Part::Feature *shell_feature = static_cast<Part::Feature*> (App::GetApplication().getActiveDocument()->addObject("Part::Feature","shell"));
+ shell_feature->Shape.setValue(s);
+ }
sewer.Perform();
+
+
// build the solid
BRepBuilderAPI_MakeSolid mkSolid;
mkSolid.Add(TopoDS::Shell(sewer.SewedShape())); // <- Building the extrude fails here
These lines are equivalent to in python:
- Snip macro screenshot-169812.png (44.84 KiB) Viewed 3644 times
Except for the "wire" objects, these are the objects added to the sewer object. The wires are used to build the "back" face. These wires look fine, but the "back" face is not valid. It has self-intersections and is really just a compound of faces made from the various wires. The "front" shape is not a face at all. The shells are all solids and check out okay.