[PR] #6886 Path: Fix PointProjectionFailed

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
yanghang
Posts: 11
Joined: Thu May 26, 2022 6:11 am

[PR] #6886 Path: Fix PointProjectionFailed

Post by yanghang »

I am working on a project which takes wires from a 3D model shape. And then convert it to paths for laser cutting.
Here, I got the issue when I am trying to adjust the StartPoint of a wire, it raises the PointProjectionFailed exception.
As displayed in the picture below, previously I can't not set the StartPoint on the specific arc. It was OK to set one some other arcs and lines.

Through debugging, I found the reason for this issue is that when the gp_Pnt pprev(BRep_Tool::Pnt(xp.CurrentVertex()));
is called, there is a tiny difference between pprev and vertex around 0.0000001. which raise the PointProjectionFail exception in
mkEdge1.Init(curve, myBestPt, pprev);

To fix this, I have commit a pull-request here:
https://github.com/FreeCAD/FreeCAD/pull/6886

Another issue might happen when the StartPoint is set, the wire misses some edges in my project. And I solved it by
using: (I am not sure of this issue but it works fine after the alternative.)

Code: Select all

if (edge.Orientation() != myBestWire->wire.Orientation())
       {
            mkEdge1.Init(curve, myBestPt, pprev);
            mkEdge2.Init(curve, pt, myBestPt);
       }
instead of:
if(reversed) {
           mkEdge1.Init(curve, myBestPt, pprev);
           mkEdge2.Init(curve, pt, myBestPt);
      } 
Image
git commit 18120f8bcdf0641ef93ec9efc32a9825ba7df3e8
Last edited by Kunda1 on Thu May 26, 2022 12:18 pm, edited 1 time in total.
Reason: Added bbcode code tags
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: [PR] #6886 Path: Fix PointProjectionFailed

Post by Kunda1 »

Ping @Russ4262 @sliptonic
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply