From 8ab4031073572c0aa9e701bc65685584d008467e Mon Sep 17 00:00:00 2001 From: kreso-t Date: Fri, 31 Aug 2018 22:22:40 +0200 Subject: [PATCH] Path: Adaptive - bug fix --- src/Mod/Path/PathScripts/PathAdaptive.py | 6 +++++- src/Mod/Path/libarea/Adaptive.cpp | 25 +++++++++++++++++------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathAdaptive.py b/src/Mod/Path/PathScripts/PathAdaptive.py index 99220dcdb9..2f533f1ea3 100644 --- a/src/Mod/Path/PathScripts/PathAdaptive.py +++ b/src/Mod/Path/PathScripts/PathAdaptive.py @@ -28,9 +28,10 @@ def connectEdges(edges): pathArray = [] combined = [] for edge in edges: + #print edge p1 = edge.valueAt(edge.FirstParameter) p2 = edge.valueAt(edge.LastParameter) - m1 = edge.valueAt((edge.LastParameter+edge.LastParameter)/2) + m1 = edge.valueAt((edge.LastParameter+edge.LastParameter)/2) duplicate = False for ex in remaining: exp1 = ex.valueAt(ex.FirstParameter) @@ -38,8 +39,11 @@ def connectEdges(edges): exm1 = ex.valueAt((ex.FirstParameter + ex.LastParameter)/2) if IsEqualInXYPlane(exp1, p1) and IsEqualInXYPlane(exp2, p2) and IsEqualInXYPlane(exm1, m1): duplicate = True + #print "duplicate" if IsEqualInXYPlane(exp1, p2) and IsEqualInXYPlane(exp2, p1) and IsEqualInXYPlane(exm1, m1): duplicate = True + #print "duplicate" + if not duplicate: remaining.append(edge) diff --git a/src/Mod/Path/libarea/Adaptive.cpp b/src/Mod/Path/libarea/Adaptive.cpp index 6cead6c467..0677c18217 100644 --- a/src/Mod/Path/libarea/Adaptive.cpp +++ b/src/Mod/Path/libarea/Adaptive.cpp @@ -854,12 +854,11 @@ namespace AdaptivePath { inputPaths.push_back(cpth); } SimplifyPolygons(inputPaths); - if(fabs(stockToLeave)>NTOL) { - clipof.Clear(); - clipof.AddPaths(inputPaths,JoinType::jtRound,EndType::etClosedPolygon); - clipof.Execute(inputPaths,-stockToLeave*scaleFactor); - } + clipof.Clear(); + clipof.AddPaths(inputPaths,JoinType::jtRound,EndType::etClosedPolygon); + clipof.Execute(inputPaths,-stockToLeave*scaleFactor-1); + // ******************************* // Resolve hierarchy and run processing // ******************************** @@ -1129,9 +1128,9 @@ namespace AdaptivePath { TPaths progressPaths; progressPaths.reserve(10000); - SimplifyPolygons(toolBoundPaths); + //SimplifyPolygons(toolBoundPaths); CleanPolygons(toolBoundPaths); - SimplifyPolygons(boundPaths); + //SimplifyPolygons(boundPaths); CleanPolygons(toolBoundPaths); Paths cleared; @@ -1152,6 +1151,17 @@ namespace AdaptivePath { IntPoint newToolPos; DoublePoint newToolDir; + // visualize/progress for boundPath + for(const auto & pth :toolBoundPaths) { + if(pth.size()>0) { + progressPaths.push_back(TPath()); + for(const auto pt: pth) + progressPaths.back().second.push_back(DPoint(double(pt.X)/scaleFactor,double(pt.Y)/scaleFactor)); + progressPaths.back().second.push_back(DPoint(double(pth.front().X)/scaleFactor,double(pth.front().Y)/scaleFactor)); + } + } + + // visualize/progress for helix clipof.Clear(); Path hp; @@ -1165,6 +1175,7 @@ namespace AdaptivePath { for(auto & pt:hps[0]) { progressPaths.back().second.push_back(DPoint(double(pt.X)/scaleFactor,double(pt.Y)/scaleFactor)); } + CheckReportProgress(progressPaths); // find the first tool position and direction toolPos = IntPoint(entryPoint.X,entryPoint.Y - helixRampRadiusScaled);