I have experimented a little bit with circles.
When I move the circle within the sketch, the offset follows. However if I move the sketch itself, the offset is moved by twice the amount.
Same thing with Draft, except there is no way to move Draft Circle internally.
Screening Placement off Part Offset2d by making compound from the sketch/circle doesn't fix the problem. However, absorbing the placement with .transformShape method seems to fix this problem.
Furthermore, if I make the sketch circle on XZ plane, the offset result is on XY plane.
The problem is very specific to circles. Rectangle and ellipse work fine for me. So I would call it an OCC bug for now.
New feature: Part Offset2D
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Veteran
- Posts: 2190
- Joined: Tue Jan 03, 2017 10:55 am
Re: New feature: Part Offset2D
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.
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();
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: New feature: Part Offset2D
Wiki page!
Part Offset2D
Part Offset2D
Re: New feature: Part Offset2D
Thanks DeepSOIC, very good Wiki page! Excellent explanation of the modes and their limitations.DeepSOIC wrote:Wiki page!
"fight the good fight"
Re: New feature: Part Offset2D
Hi, just so late testing this feature now
Noted if there is several wire in a sketch, it only process the '1st' wire right? ... Wiki - "...There can be multiple wires in one object, not necessarily coplanar..."
Thinking if / how an offset to the shown pattern is possible or supported in future?
BTW, note in this example, only 'pipe' setting works, 'skin' setting return only 2 'broken' edges..... play around with this feature, sometime FC crash.
Also, it return exception below in 0.18_pre - FreeCAD_0.18.15780.glibc2.17-x86_64.AppImage on Fedora 29 :-
Noted if there is several wire in a sketch, it only process the '1st' wire right? ... Wiki - "...There can be multiple wires in one object, not necessarily coplanar..."
Thinking if / how an offset to the shown pattern is possible or supported in future?
BTW, note in this example, only 'pipe' setting works, 'skin' setting return only 2 'broken' edges..... play around with this feature, sometime FC crash.
Also, it return exception below in 0.18_pre - FreeCAD_0.18.15780.glibc2.17-x86_64.AppImage on Fedora 29 :-
Code: Select all
Exception (Fri Feb 8 09:08:17 2019): makeOffset2D: wires are nonplanar or noncoplanar
Exception (Fri Feb 8 09:08:20 2019): makeOffset2D: wires are nonplanar or noncoplanar
Exception (Fri Feb 8 09:08:21 2019): makeOffset2D: wires are nonplanar or noncoplanar
Exception (Fri Feb 8 09:08:22 2019): makeOffset2D: wires are nonplanar or noncoplanar
Exception (Fri Feb 8 09:08:25 2019): makeOffset2D: wires are nonplanar or noncoplanar
- Attachments
-
- Test_ Offset2D_ Sketch.FCStd
- (5.52 KiB) Downloaded 72 times
Re: New feature: Part Offset2D
Is there a way to copy and paste the newly created offset sketch, so I can use it in Part Design, I tried and it won't work, yet! That looks very useful.
Thanks
Thanks