Path: Adaptive - bug fix

This commit is contained in:
kreso-t
2018-08-31 22:22:40 +02:00
committed by wmayer
parent a2e725821d
commit 8ab4031073
2 changed files with 23 additions and 8 deletions

View File

@@ -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)

View File

@@ -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);