I was able to locate and fix the circle bug in OCC. In case anyone need it, I include the patch below. The patch is against OCC 7.1.0. The bug affects circles having a transformed supporting plane. Since OCE hasn't caught up with OCC 7, I think FreeCAD shall host a fork of the OCC.
Unfortunately, there are other bugs in OCC makeOffset. And after spending days trying to hunt down the problem, I conclude that OCC makeOffset is just beyond help, with my knowledge at least. After searching around for alternatives to do 2D offset, I found the wonderful
ClipperLib. And it turns out, FreeCAD already has this library! What do you know! I have submitted a
pull request regarding this.
Code: Select all
diff --git a/src/BRepFill/BRepFill_OffsetWire.cxx b/src/BRepFill/BRepFill_OffsetWire.cxx
index 5cc63bd..2540e5a 100755
--- a/src/BRepFill/BRepFill_OffsetWire.cxx
+++ b/src/BRepFill/BRepFill_OffsetWire.cxx
@@ -293,12 +293,17 @@ static Standard_Boolean KPartCircle
OC = new Geom2d_OffsetCurve( G2dT, anOffset);
}
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(mySpine);
+ if (!L.IsIdentity()) {
+ Handle(Geom_Geometry) aCopy = aSurf->Transformed(L.Inverted().Transformation());
+ aSurf = Handle(Geom_Surface)(static_cast<Geom_Surface*>(aCopy.get()));
+ }
Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(aSurf);
- myShape = BRepLib_MakeEdge(OC, aPlane, f, l);
+ myShape = BRepLib_MakeEdge(OC, aSurf, f, l);
BRepLib::BuildCurve3d(TopoDS::Edge(myShape));
-
+
myShape.Orientation(E.Orientation());
myShape.Location(L);
+
if (fabs(Alt) > gp::Resolution()) {
BRepAdaptor_Surface S(mySpine,0);
gp_Ax1 Nor = S.Plane().Axis();
Try Assembly3 (latest version
0.11) along with my custom build of FreeCAD at
here.
And if you'd like to show your support, you can donate through
patreon,
liberapay, or
paypal