Skip to content

Commit

Permalink
+ issue #2542: Part.Wire.makeoffset() doesn't handle circles correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed May 12, 2016
1 parent d7d347b commit c21888a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Mod/Part/App/TopoShapeFacePyImp.cpp
Expand Up @@ -27,6 +27,7 @@
# include <BRep_Tool.hxx>
# include <BRepCheck_Analyzer.hxx>
# include <BRepTools.hxx>
# include <BRepBuilderAPI_FindPlane.hxx>
# include <BRepBuilderAPI_MakeFace.hxx>
# include <ShapeAnalysis.hxx>
# include <BRepAdaptor_Surface.hxx>
Expand Down Expand Up @@ -254,6 +255,11 @@ PyObject* TopoShapeFacePy::makeOffset(PyObject *args)
if (!PyArg_ParseTuple(args, "d",&dist))
return 0;
const TopoDS_Face& f = TopoDS::Face(getTopoShapePtr()->_Shape);
BRepBuilderAPI_FindPlane findPlane(f);
if (!findPlane.Found()) {
PyErr_SetString(PartExceptionOCCError, "No planar face");
return 0;
}

BRepOffsetAPI_MakeOffset mkOffset(f);
mkOffset.Perform(dist);
Expand Down
6 changes: 6 additions & 0 deletions src/Mod/Part/App/TopoShapeWirePyImp.cpp
Expand Up @@ -26,6 +26,7 @@
# include <Approx_Curve3d.hxx>
# include <ShapeAlgo_AlgoContainer.hxx>
# include <BRepAdaptor_CompCurve.hxx>
# include <BRepBuilderAPI_FindPlane.hxx>
# include <BRepBuilderAPI_MakeWire.hxx>
# include <BRepOffsetAPI_MakeOffset.hxx>
# include <Precision.hxx>
Expand Down Expand Up @@ -225,6 +226,11 @@ PyObject* TopoShapeWirePy::makeOffset(PyObject *args)
if (!PyArg_ParseTuple(args, "d",&dist))
return 0;
const TopoDS_Wire& w = TopoDS::Wire(getTopoShapePtr()->_Shape);
BRepBuilderAPI_FindPlane findPlane(w);
if (!findPlane.Found()) {
PyErr_SetString(PartExceptionOCCError, "No planar wire");
return 0;
}

BRepOffsetAPI_MakeOffset mkOffset(w);
mkOffset.Perform(dist);
Expand Down

0 comments on commit c21888a

Please sign in to comment.