kopia lustrzana https://github.com/vilemduha/blendercam
				
				
				
			multiple changes
merge distance parameter for path merging tuning move parallell steb back work on manual bridges placementpull/4/head^2
							rodzic
							
								
									6abe0c2727
								
							
						
					
					
						commit
						e23b7e7b3a
					
				
										
											Plik binarny nie jest wyświetlany.
										
									
								
							
										
											Plik binarny nie jest wyświetlany.
										
									
								
							| 
						 | 
				
			
			@ -453,6 +453,7 @@ class camOperation(bpy.types.PropertyGroup):
 | 
			
		|||
	movement_insideout = EnumProperty(name='Direction', items=(('INSIDEOUT','Inside out', 'a'),('OUTSIDEIN', 'Outside in', 'a')),description='approach to the piece',default='INSIDEOUT', update = updateRest)
 | 
			
		||||
	parallel_step_back =  bpy.props.BoolProperty(name="Parallel step back", description='For roughing and finishing in one pass: mills material in climb mode, then steps back and goes between 2 last chunks back', default=False, update = updateRest)
 | 
			
		||||
	stay_low = bpy.props.BoolProperty(name="Stay low if possible", default=True, update = updateRest)
 | 
			
		||||
	merge_dist = bpy.props.FloatProperty(name="Merge distance - EXPERIMENTAL", default=0.0, min=0.0000, max=0.1,precision=PRECISION, unit="LENGTH", update = updateRest)
 | 
			
		||||
	#optimization and performance
 | 
			
		||||
	circle_detail = bpy.props.IntProperty(name="Detail of circles used for curve offsets", default=64, min=12, max=512, update = updateRest)
 | 
			
		||||
	use_exact = bpy.props.BoolProperty(name="Use exact mode",description="Exact mode allows greater precision, but is slower with complex meshes", default=True, update = updateExact)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,7 @@
 | 
			
		|||
 | 
			
		||||
import bpy
 | 
			
		||||
import subprocess,os, sys, threading
 | 
			
		||||
from cam import utils, pack,polygon_utils_cam,chunk
 | 
			
		||||
from cam import utils, pack,polygon_utils_cam,chunk,simple
 | 
			
		||||
from bpy.props import *
 | 
			
		||||
import Polygon
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -652,11 +652,7 @@ class CamOrientationAdd(bpy.types.Operator):
 | 
			
		|||
		oriob=bpy.context.active_object
 | 
			
		||||
		oriob.empty_draw_size=0.02 # 2 cm
 | 
			
		||||
		
 | 
			
		||||
		
 | 
			
		||||
		if not gname in bpy.data.groups:
 | 
			
		||||
			bpy.ops.group.create(name=gname)
 | 
			
		||||
		else:
 | 
			
		||||
			bpy.data.groups[gname].objects.link(oriob)
 | 
			
		||||
		simple.addToGroup(oriob,gname)
 | 
			
		||||
		oriob.name='ori_'+o.name+'.'+str(len(bpy.data.groups[gname].objects)).zfill(3)
 | 
			
		||||
		
 | 
			
		||||
		return {'FINISHED'}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -444,8 +444,7 @@ class CAM_OPERATION_PROPERTIES_Panel(CAMButtonsPanel, bpy.types.Panel):
 | 
			
		|||
					layout.prop(ao,'dist_along_paths')
 | 
			
		||||
					if ao.strategy=='PARALLEL' or ao.strategy=='CROSS':
 | 
			
		||||
						layout.prop(ao,'parallel_angle')
 | 
			
		||||
						if not ao.ramp:
 | 
			
		||||
							layout.prop(ao,'parallel_step_back')
 | 
			
		||||
						
 | 
			
		||||
						
 | 
			
		||||
					layout.prop(ao,'skin')
 | 
			
		||||
					layout.prop(ao,'inverse')
 | 
			
		||||
| 
						 | 
				
			
			@ -487,11 +486,15 @@ class CAM_MOVEMENT_Panel(CAMButtonsPanel, bpy.types.Panel):
 | 
			
		|||
			ao=scene.cam_operations[scene.cam_active_operation]
 | 
			
		||||
			if ao.valid:
 | 
			
		||||
				layout.prop(ao,'movement_type')
 | 
			
		||||
				
 | 
			
		||||
				if ao.movement_type=='BLOCK' or ao.movement_type=='SPIRAL' or ao.movement_type=='CIRCLES':
 | 
			
		||||
					layout.prop(ao,'movement_insideout')
 | 
			
		||||
				   
 | 
			
		||||
				layout.prop(ao,'spindle_rotation_direction')
 | 
			
		||||
				layout.prop(ao,'free_movement_height')
 | 
			
		||||
				if ao.strategy=='PARALLEL' or ao.strategy=='CROSS':
 | 
			
		||||
					if not ao.ramp:
 | 
			
		||||
						layout.prop(ao,'parallel_step_back')
 | 
			
		||||
				if ao.strategy=='CUTOUT':
 | 
			
		||||
					layout.prop(ao,'first_down')
 | 
			
		||||
					#if ao.first_down:
 | 
			
		||||
| 
						 | 
				
			
			@ -515,6 +518,8 @@ class CAM_MOVEMENT_Panel(CAMButtonsPanel, bpy.types.Panel):
 | 
			
		|||
						layout.prop(ao,'ramp_out_angle')
 | 
			
		||||
					
 | 
			
		||||
				layout.prop(ao,'stay_low')
 | 
			
		||||
				if ao.stay_low:
 | 
			
		||||
					layout.prop(ao,'merge_dist')
 | 
			
		||||
				layout.prop(ao,'protect_vertical')
 | 
			
		||||
				if ao.protect_vertical:
 | 
			
		||||
					layout.prop(ao,'protect_vertical_limit')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1423,7 +1423,9 @@ def connectChunksLow(chunks,o):
 | 
			
		|||
	
 | 
			
		||||
	if o.parallel_step_back:
 | 
			
		||||
		mergedist*=2
 | 
			
		||||
		
 | 
			
		||||
	if o.merge_dist>0:
 | 
			
		||||
		mergedist=o.merge_dist
 | 
			
		||||
	#mergedist=10
 | 
			
		||||
	lastch=None
 | 
			
		||||
	i=len(chunks)
 | 
			
		||||
	pos=(0,0,0)
 | 
			
		||||
| 
						 | 
				
			
			@ -1927,7 +1929,8 @@ def getSnappingObject(o):
 | 
			
		|||
	if s.objects.get(bproj_name)!=None:
 | 
			
		||||
		ob=s.objects[bproj_name]
 | 
			
		||||
	else:
 | 
			
		||||
		ob=s.objects['BezierCircle.003']
 | 
			
		||||
		getOperationSources(o)
 | 
			
		||||
		ob=o.objects[0]
 | 
			
		||||
		activate(ob)
 | 
			
		||||
		bpy.ops.object.duplicate()
 | 
			
		||||
		ob=bpy.context.active_object
 | 
			
		||||
| 
						 | 
				
			
			@ -1962,11 +1965,19 @@ def addBridge(o):
 | 
			
		|||
		
 | 
			
		||||
def getBridges(p,o):
 | 
			
		||||
	# this function finds positions of the bridges, and returns these.
 | 
			
		||||
	pass;
 | 
			
		||||
	g=bpy.data.groups.get('cam_bridges_'+o.name)
 | 
			
		||||
	bridges=[]
 | 
			
		||||
	if g!=None:
 | 
			
		||||
		for o in g.objects:
 | 
			
		||||
			pos=o.matrix_world.to_translation()
 | 
			
		||||
			pos=pos[0],pos[1]
 | 
			
		||||
			bridges.append(pos)
 | 
			
		||||
	return bridges
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
def addBridges(ch,o,z):
 | 
			
		||||
	#this functions adds Bridges to the finished chunks.
 | 
			
		||||
def addBridges(ch,o):
 | 
			
		||||
	#this functions adds Bridges to the finished chunks. AUTOMATIC ONLY NOW!
 | 
			
		||||
	if o.bridges_placement == 'AUTO':
 | 
			
		||||
		ch.getLength()
 | 
			
		||||
		n=int(ch.length/o.bridges_max_distance)
 | 
			
		||||
		bpc=o.bridges_per_curve
 | 
			
		||||
| 
						 | 
				
			
			@ -2001,8 +2012,8 @@ def addBridges(ch,o,z):
 | 
			
		|||
				if not inbridge and posi<len(pos) and pos[posi][0]<dist:#detect start of bridge
 | 
			
		||||
					
 | 
			
		||||
					ratio=(dist-pos[posi][0])/v.length
 | 
			
		||||
				point1=v2-v*ratio#TODO: optimize this : how? what was meant by the initial comment?
 | 
			
		||||
				point2=v2-v*ratio
 | 
			
		||||
					point1=v2-v*ratio
 | 
			
		||||
					point2=point1.copy()
 | 
			
		||||
					if bridgeheight>point1.z:
 | 
			
		||||
						point1.z=min(point1.z,bridgeheight)
 | 
			
		||||
						point2.z=max(point2.z,bridgeheight)
 | 
			
		||||
| 
						 | 
				
			
			@ -2146,7 +2157,7 @@ def getPath3axis(context,operation):
 | 
			
		|||
				chunk=chl[0]
 | 
			
		||||
				layer=chl[1]
 | 
			
		||||
				if layer[1]<bridgeheight:
 | 
			
		||||
					addBridges(chunk,o,0)
 | 
			
		||||
					addBridges(chunk,o)
 | 
			
		||||
				
 | 
			
		||||
		if o.ramp:#add ramps or simply add chunks
 | 
			
		||||
			for chl in extendorder:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue