diff --git a/scripts/addons/cam/utils.py b/scripts/addons/cam/utils.py index 4eb38326..2ea400b4 100644 --- a/scripts/addons/cam/utils.py +++ b/scripts/addons/cam/utils.py @@ -1496,6 +1496,7 @@ def sampleChunks(o,pathSamples,layers): for l in layers: thisrunchunks.append([]) lastlayer=None + currentlayer=None lastsample=None #threads_count=4 @@ -1510,9 +1511,8 @@ def sampleChunks(o,pathSamples,layers): maxz=minz sampled=False - allsampled=True - higherlayer=0 + #higherlayer=0 newsample=(0,0,1); ####sampling @@ -1537,68 +1537,76 @@ def sampleChunks(o,pathSamples,layers): sampled=True #maxz=max(minz,maxz) - - if sampled and (not o.inverse or (o.inverse and allsampled)): - if not higherlayer:#check for higher surfaces... - newsample=(x,y,maxz) + if sampled and (not o.inverse or (o.inverse)): + newsample=(x,y,maxz) - - elif o.ambient_behaviour=='ALL' and not o.inverse: + elif o.ambient_behaviour=='ALL' and not o.inverse:#handle ambient here newsample=(x,y,minz) - - for i,l in enumerate(layers): terminatechunk=False ch=layeractivechunks[i] #print(i,l) #print(l[1],l[0]) if l[1]<=newsample[2]<=l[0]: - - - if lastlayer!=None and lastlayer!=i and abs(lastlayer-i)==1:#sampling for sorted paths in layers- to go to the border of the sampled layer at least...#TODO: - fix an ugly ugly bug here! goes down more than should... - if i0: + layeractivechunks[ls].points.insert(-1,betweensample.to_tuple()) + else: + layeractivechunks[ls].points.append(betweensample.to_tuple()) + layeractivechunks[ls+1].points.append(betweensample.to_tuple()) + else: + + layeractivechunks[ls].points.insert(-1,betweensample.to_tuple()) + layeractivechunks[ls+1].points.insert(0,betweensample.to_tuple()) + li+=1 + #this chunk is terminated, and allready in layerchunks / + + #ch.points.append(betweensample.to_tuple())# ch.points.append(newsample) - elif l[1]>newsample[2]: ch.points.append((newsample[0],newsample[1],l[1])) elif l[0]0: - - layerchunks[i].append(ch) - thisrunchunks[i].append(ch) - layeractivechunks[i]=camPathChunk([]) - # - - #elif len(ch.points)>2:#optimisation on the fly - disabled, this made problems when parenting... should be after that probably - # if(compare(ch.points[-3],ch.points[-1],ch.points[-2])): - # ch.points.pop(-2) + if len(ch.points)>0: + layerchunks[i].append(ch) + thisrunchunks[i].append(ch) + layeractivechunks[i]=camPathChunk([]) + lastsample=newsample + #n+=1 for i,l in enumerate(layers): @@ -2014,7 +2022,7 @@ def chunksToMesh(chunks,o): last=Vector(ch[-1]) first=Vector(chunks[chi+1].points[0]) vect=first-last - if (o.strategy=='PARALLEL' or o.strategy=='CROSS') and vect.z==0 and vect.length