From a5aa6d99c5d1fca9958e1bf2fb79472217c173cc Mon Sep 17 00:00:00 2001 From: "vilda.novak@gmail.com" Date: Tue, 15 Oct 2013 07:19:27 +0000 Subject: [PATCH] -fixed a bug in sorting of paths, now stay_low + pocket + limit curve give good result. It was caused by enabling to measure distance for stay low to end of chunk, instead of only to start.(if it would be possible to turn the chunk, it would have allready happened.) --- scripts/addons/cam/utils.py | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/scripts/addons/cam/utils.py b/scripts/addons/cam/utils.py index 11ef39c8..cc096afd 100644 --- a/scripts/addons/cam/utils.py +++ b/scripts/addons/cam/utils.py @@ -3211,7 +3211,9 @@ class camPathChunk: return min(d1,d2) else: return dist2d(pos,self.points[0]) - + def distStart(self,pos,o): + return dist2d(pos,self.points[0]) + def adaptdist(self,pos,o): #reorders chunk so that it starts at the closest point to pos. if self.closed: @@ -3235,7 +3237,8 @@ class camPathChunk: if o.movement_type=='MEANDER': d1=dist2d(pos,self.points[0]) d2=dist2d(pos,self.points[-1]) - + if d20 and closed and ch.closed: + elif sampled: + nch.points.append(s) + + if len(nch.points)>1 and closed and ch.closed and ch.points[0]==ch.points[1]: nch.closed=True if len(nch.points)>0: nchunks.append(nch) @@ -4647,7 +4653,7 @@ def getPath3axis(context,operation): chunksFromCurve=polyToChunks(p,-1) #parentChildPoly(chunksFromCurve,chunksFromCurve,o) - + chunksFromCurve=limitChunks(chunksFromCurve,o) parentChildPoly(chunksFromCurve,chunksFromCurve,o) chunksFromCurve=sortChunks(chunksFromCurve,o) @@ -4689,17 +4695,10 @@ def getPath3axis(context,operation): if o.use_bridges: for ch in chunks: addBridges(ch,o,0) - + if bpy.app.debug_value==0 or bpy.app.debug_value==1 or bpy.app.debug_value==3 or bpy.app.debug_value==2:# or bpy.app.debug_value==4: chunksToMesh(chunks,o) - '''#bridge stuff from carve strategy: - pathSamples=[] - #for ob in o.objects: - ob=bpy.data.objects[o.curve_object] - pathSamples.extend(curveToChunks(ob)) - pathSamples=sortChunks(pathSamples,o)#sort before sampling - pathSamples=chunksRefine(pathSamples,o) - ''' + if o.strategy=='POCKET': p=getObjectOutline(o.cutter_diameter/2,o,False) all=Polygon.Polygon(p) @@ -4710,6 +4709,7 @@ def getPath3axis(context,operation): lastchunks=[] while len(p)>0: nchunks=polyToChunks(p,o.min.z) + nchunks=limitChunks(nchunks,o) chunksFromCurve.extend(nchunks) parentChildDist(lastchunks,nchunks,o) lastchunks=nchunks @@ -4726,7 +4726,8 @@ def getPath3axis(context,operation): ch.points.reverse() #if bpy.app.debug_value==1: - + + chunksFromCurve=sortChunks(chunksFromCurve,o) chunks=[] @@ -4859,6 +4860,7 @@ def getPath3axis(context,operation): #for ch in pathSamples: # for i,p in enumerate(ch.points): # ch.points[i]=(p[0],p[1],0) + pathSamples=limitChunks(pathSamples,o) pathSamples=sortChunks(pathSamples,o)#sort before sampling else: