Merge branch 'master' of https://github.com/vilemnovak/blendercam into master-org

pull/62/head
Jeff Doyle (nfz) 2016-05-25 11:27:15 -03:00
commit 8d27eec527
4 zmienionych plików z 48 dodań i 21 usunięć

Wyświetl plik

@ -607,7 +607,7 @@ def parentChildPoly(parents,children,o):
if parent.poly.contains(sgeometry.Point(child.poly.boundary.coords[0])):
parent.children.append(child)
child.parents.append(parent)
def parentChildDist(parents, children,o, distance= None):
#parenting based on x,y distance between chunks
#hierarchy works like this: - children get milled first.
@ -617,23 +617,40 @@ def parentChildDist(parents, children,o, distance= None):
dlim=dlim*2
else:
dlim = distance
#print('distance')
#print(len(children),len(parents))
#i=0
#simplification greatly speeds up the distance finding algorithms.
for child in children:
child.simppoly=child.poly.simplify(0.0003)
for parent in parents:
parent.simppoly=parent.poly.simplify(0.0003)
for child in children:
for parent in parents:
#print(i)
#i+=1
isrelation=False
if parent!=child:
for v in child.points:
for v1 in parent.points:
if dist2d(v,v1)<dlim:
isrelation=True
if not parent.poly.is_empty and not child.poly.is_empty:
d=parent.simppoly.distance(child.simppoly)
if d<dlim:
isrelation = True
else:#this is the old method, preferably should be replaced in all cases
print('warning, sorting will be slow due to bad parenting in parentChildDist')
for v in child.points:
for v1 in parent.points:
if dist2d(v,v1)<dlim:
isrelation=True
break
if isrelation:
break
if isrelation:
break
if isrelation:
#print('truelink',dist2d(v,v1))
parent.children.append(child)
child.parents.append(parent)
#print('distance done')
def parentChild(parents, children, o):
#connect all children to all parents. Useful for any type of defining hierarchy.

Wyświetl plik

@ -354,7 +354,7 @@ def getPathPattern(operation):
pathchunks=[]
chunks=[]
for p in polys:
p=p.buffer(-o.dist_between_paths/3,o.circle_detail)#first, move a bit inside, because otherwise the border samples go crazy very often changin between hit/non hit and making too many jumps in the path.
p=p.buffer(-o.dist_between_paths/10,o.circle_detail)#first, move a bit inside, because otherwise the border samples go crazy very often changin between hit/non hit and making too many jumps in the path.
chunks.extend(shapelyToChunks(p,0))
pathchunks.extend(chunks)
@ -374,7 +374,11 @@ def getPathPattern(operation):
p=p.buffer(-o.dist_between_paths,o.circle_detail)
if not p.is_empty:
nchunks=shapelyToChunks(p,zlevel)
#parentChildPoly(lastchunks,nchunks,o)
if o.movement_insideout=='INSIDEOUT':
parentChildDist(lastchunks,nchunks,o)
else:
parentChildDist(nchunks,lastchunks,o)
pathchunks.extend(nchunks)
lastchunks=nchunks
percent=int(i/approxn*100)
@ -394,20 +398,23 @@ def getPathPattern(operation):
dist+=o.pixsize*2.5
p=p.buffer(dist,o.circle_detail)
if not p.is_empty:
chunks=shapelyToChunks(p,zlevel)
pathchunks.extend(chunks)
lastchunks=chunks
nchunks=shapelyToChunks(p,zlevel)
if o.movement_insideout=='INSIDEOUT':
parentChildDist(nchunks,lastchunks,o)
else:
parentChildDist(lastchunks,nchunks,o)
pathchunks.extend(nchunks)
lastchunks=nchunks
if o.movement_insideout=='INSIDEOUT':
pathchunks.reverse()
for chunk in pathchunks:
if o.movement_insideout=='INSIDEOUT':
chunk.points.reverse()
if (o.movement_type=='CLIMB' and o.spindle_rotation_direction=='CW') or (o.movement_type=='CONVENTIONAL' and o.spindle_rotation_direction=='CCW'):
chunk.points.reverse()
parentChildPoly(pathchunks,pathchunks,o)
pathchunks=chunksRefine(pathchunks,o)
#parentChildPoly(pathchunks,pathchunks,o)
#chunksRefine(pathchunks,o)
progress(time.time()-t)
return pathchunks

Wyświetl plik

@ -477,7 +477,7 @@ class CAM_OPERATION_PROPERTIES_Panel(CAMButtonsPanel, bpy.types.Panel):
layout.prop(ao,'parallel_angle')
layout.prop(ao,'inverse')
if ao.type!='POCKET' or ao.type!='DRILL' or ao.type !='CURVE' or ao.type != 'MEDIAL_AXIS':
if ao.strategy!='POCKET' or ao.strategy!='DRILL' or ao.strategy !='CURVE' or ao.strategy != 'MEDIAL_AXIS':
layout.prop(ao,'use_bridges')
if ao.use_bridges:
#layout.prop(ao,'bridges_placement')

Wyświetl plik

@ -534,7 +534,7 @@ def sampleChunks(o,pathSamples,layers):
progress('checking relations between paths')
timingstart(sortingtime)
if (o.strategy=='PARALLEL' or o.strategy=='CROSS'):
if (o.strategy=='PARALLEL' or o.strategy=='CROSS' or o.strategy == 'OUTLINEFILL'):
if len(layers)>1:# sorting help so that upper layers go first always
for i in range(0,len(layers)-1):
parents=[]
@ -2407,8 +2407,9 @@ def strategy_pocket( o ):
nchunks=limitChunks(nchunks,o)
chunksFromCurve.extend(nchunks)
print(i)
parentChildDist(lastchunks,nchunks,o)
#print('parented')
lastchunks=nchunks
@ -2852,6 +2853,7 @@ def getPath3axis(context, operation):
if o.strategy=='OUTLINEFILL':
getOperationSilhouete(o)
pathSamples=getPathPattern(o)
pathSamples = sortChunks(pathSamples,o)
#chunksToMesh(pathSamples,o)#for testing pattern script
#return
if o.strategy=='BLOCK' or o.strategy=='SPIRAL' or o.strategy=='CIRCLES' or o.strategy=='OUTLINEFILL':
@ -2868,7 +2870,8 @@ def getPath3axis(context, operation):
chunks=chunksCoherency(chunks)
print('coherency check')
if ((o.strategy=='PARALLEL' or o.strategy=='CROSS') or o.strategy=='PENCIL'):# and not o.parallel_step_back:
if ((o.strategy=='PARALLEL' or o.strategy=='CROSS') or o.strategy=='PENCIL'):# or o.strategy =='OUTLINEFILL'):# and not o.parallel_step_back:
print('sorting')
chunks=sortChunks(chunks,o)
if o.ramp:
for ch in chunks: