kopia lustrzana https://github.com/vilemduha/blendercam
				
				
				
			Merge pull request #13 from vilemnovak/revert-12-revert-10-master
Revert "Revert "- little bug fixes and some code refactoring""pull/25/head
						commit
						85809b9611
					
				|  | @ -85,7 +85,7 @@ class machineSettings(bpy.types.PropertyGroup): | |||
| 	'''stores all data for machines''' | ||||
| 	#name = bpy.props.StringProperty(name="Machine Name", default="Machine") | ||||
| 	post_processor = EnumProperty(name='Post processor', | ||||
| 		items=(('ISO','Iso','this should export a standardized gcode'),('MACH3','Mach3','default mach3'),('EMC','EMC - LinuxCNC','default emc'),('HEIDENHAIN','Heidenhain','heidenhain'),('TNC151','Heidenhain TNC151','Post Processor for the Heidenhain TNC151 machine'),('SIEGKX1','Sieg KX1','Sieg KX1'),('HM50','Hafco HM-50','Hafco HM-50'),('CENTROID','Centroid M40','Centroid M40'),('ANILAM','Anilam Crusader M','Anilam Crusader M'),('GRAVOS','Gravos','Gravos'),('WIN-PC','Win-PC','German CNC'),('SHOPBOT MTC','ShopBot MTC','ShopBot MTC'),('LYNX_OTTER_O','Lynx Otter o','Lynx Otter o')), | ||||
| 		items=(('ISO','Iso','this should export a standardized gcode'),('MACH3','Mach3','default mach3'),('EMC','EMC - LinuxCNC','default emc'),('GRBL','grbl','grbl on Arduino cnc shield'),('HEIDENHAIN','Heidenhain','heidenhain'),('TNC151','Heidenhain TNC151','Post Processor for the Heidenhain TNC151 machine'),('SIEGKX1','Sieg KX1','Sieg KX1'),('HM50','Hafco HM-50','Hafco HM-50'),('CENTROID','Centroid M40','Centroid M40'),('ANILAM','Anilam Crusader M','Anilam Crusader M'),('GRAVOS','Gravos','Gravos'),('WIN-PC','Win-PC','German CNC'),('SHOPBOT MTC','ShopBot MTC','ShopBot MTC'),('LYNX_OTTER_O','Lynx Otter o','Lynx Otter o')), | ||||
| 		description='Post processor', | ||||
| 		default='MACH3') | ||||
| 	#units = EnumProperty(name='Units', items = (('IMPERIAL', '')) | ||||
|  | @ -447,7 +447,7 @@ class camOperation(bpy.types.PropertyGroup): | |||
| 	plunge_angle =	bpy.props.FloatProperty(name="Plunge angle", description="What angle is allready considered to plunge", default=math.pi/6, min=0, max=math.pi*0.5 , precision=0, subtype="ANGLE" , unit="ROTATION" , update = updateRest) | ||||
| 	spindle_rpm = FloatProperty(name="Spindle rpm", description="Spindle speed ", min=1000, max=60000, default=12000, update = updateChipload) | ||||
| 	#movement parallel_step_back  | ||||
| 	movement_type = EnumProperty(name='Movement type',items=(('CONVENTIONAL','Conventional', 'a'),('CLIMB', 'Climb', 'a'),('MEANDER', 'Meander' , 'a')	 ),description='movement type', default='CLIMB', update = updateRest) | ||||
| 	movement_type = EnumProperty(name='Movement type',items=(('CONVENTIONAL','Conventional / Up milling', 'cutter rotates against the direction of the feed'),('CLIMB', 'Climb / Down milling', 'cutter rotates with the direction of the feed'),('MEANDER', 'Meander / Zig Zag' , 'cutting is done both with and against the rotation of the spindle')	 ),description='movement type', default='CLIMB', update = updateRest) | ||||
| 	spindle_rotation_direction = EnumProperty(name='Spindle rotation', items=(('CW','Clock wise', 'a'),('CCW', 'Counter clock wise', 'a')),description='Spindle rotation direction',default='CW', update = updateRest) | ||||
| 	free_movement_height = bpy.props.FloatProperty(name="Free movement height", default=0.01, min=0.0000, max=32,precision=PRECISION, unit="LENGTH", update = updateRest) | ||||
| 	movement_insideout = EnumProperty(name='Direction', items=(('INSIDEOUT','Inside out', 'a'),('OUTSIDEIN', 'Outside in', 'a')),description='approach to the piece',default='INSIDEOUT', update = updateRest) | ||||
|  |  | |||
|  | @ -0,0 +1,287 @@ | |||
| from . import nc | ||||
| from . import iso_modal | ||||
| import math | ||||
| import datetime | ||||
| import time | ||||
| 
 | ||||
| now = datetime.datetime.now() | ||||
| 
 | ||||
| class Creator(iso_modal.Creator): | ||||
|     def __init__(self): | ||||
|         iso_modal.Creator.__init__(self) | ||||
|         self.absolute_flag = True | ||||
|         self.prev_g91 = '' | ||||
|         self.useCrc = False | ||||
|         self.start_of_line = True | ||||
| 
 | ||||
|     def write_blocknum(self): | ||||
|         self.start_of_line = True | ||||
|          | ||||
|     def SPACE(self): | ||||
|         if self.start_of_line == True: | ||||
|             self.start_of_line = False | ||||
|             return '' | ||||
|         else: | ||||
|             return ' ' | ||||
|          | ||||
|     def PROGRAM_END(self): return ' ' | ||||
|          | ||||
| ############################################################################ | ||||
| ## Begin Program  | ||||
| 
 | ||||
| 
 | ||||
|     def program_begin(self, id, comment): | ||||
|         if (self.useCrc == False): | ||||
|             self.write( ('(Created with grbl post processor ' + str(now.strftime("%Y/%m/%d %H:%M")) + ')' + '\n') ) | ||||
|         else:   | ||||
|             self.write( ('(Created with grbl Cutter Radius Compensation post processor ' + str(now.strftime("%Y/%m/%d %H:%M")) + ')' + '\n') ) | ||||
| 
 | ||||
| 	 | ||||
| 
 | ||||
| 
 | ||||
| ############################################################################ | ||||
| ##  Settings | ||||
| 
 | ||||
|     def tool_defn(self, id, name='', radius=None, length=None, gradient=None): | ||||
|         pass | ||||
| 
 | ||||
|     def tool_change(self, id): | ||||
|         pass | ||||
| 		 | ||||
|     def comment(self, text): | ||||
|         self.write_blocknum() | ||||
|         self.write((self.COMMENT(text) + '\n')) | ||||
| 
 | ||||
| # This is the coordinate system we're using.  G54->G59, G59.1, G59.2, G59.3 | ||||
| # These are selected by values from 1 to 9 inclusive. | ||||
|     def workplane(self, id): | ||||
|         if ((id >= 1) and (id <= 6)): | ||||
|             self.write_blocknum() | ||||
|             self.write( (self.WORKPLANE() % (id + self.WORKPLANE_BASE())) + '\t (Select Relative Coordinate System)\n') | ||||
|         if ((id >= 7) and (id <= 9)): | ||||
|             self.write_blocknum() | ||||
|             self.write( ((self.WORKPLANE() % (6 + self.WORKPLANE_BASE())) + ('.%i' % (id - 6))) + '\t (Select Relative Coordinate System)\n') | ||||
| 
 | ||||
| 
 | ||||
| ############################################################################ | ||||
| ##  Moves | ||||
| 
 | ||||
| 
 | ||||
| ############################################################################ | ||||
| ## Probe routines | ||||
|     def report_probe_results(self, x1=None, y1=None, z1=None, x2=None, y2=None, z2=None, x3=None, y3=None, z3=None, x4=None, y4=None, z4=None, x5=None, y5=None, z5=None, x6=None, y6=None, z6=None, xml_file_name=None ): | ||||
|         if (xml_file_name != None): | ||||
|             self.comment('Generate an XML document describing the probed coordinates found'); | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOGOPEN,') | ||||
|             self.write(xml_file_name) | ||||
|             self.write(')\n') | ||||
| 
 | ||||
|         self.write_blocknum() | ||||
|         self.write('(LOG,<POINTS>)\n') | ||||
| 
 | ||||
|         if ((x1 != None) or (y1 != None) or (z1 != None)): | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<POINT>)\n') | ||||
| 
 | ||||
|         if (x1 != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + x1 + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<X>#<_value></X>)\n') | ||||
| 
 | ||||
|         if (y1 != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + y1 + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<Y>#<_value></Y>)\n') | ||||
| 
 | ||||
|         if (z1 != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + z1 + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<Z>#<_value></Z>)\n') | ||||
| 
 | ||||
|         if ((x1 != None) or (y1 != None) or (z1 != None)): | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,</POINT>)\n') | ||||
| 
 | ||||
|         if ((x2 != None) or (y2 != None) or (z2 != None)): | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<POINT>)\n') | ||||
| 
 | ||||
|         if (x2 != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + x2 + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<X>#<_value></X>)\n') | ||||
| 
 | ||||
|         if (y2 != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + y2 + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<Y>#<_value></Y>)\n') | ||||
| 
 | ||||
|         if (z2 != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + z2 + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<Z>#<_value></Z>)\n') | ||||
| 
 | ||||
|         if ((x2 != None) or (y2 != None) or (z2 != None)): | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,</POINT>)\n') | ||||
| 
 | ||||
|         if ((x3 != None) or (y3 != None) or (z3 != None)): | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<POINT>)\n') | ||||
| 
 | ||||
|         if (x3 != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + x3 + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<X>#<_value></X>)\n') | ||||
| 
 | ||||
|         if (y3 != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + y3 + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<Y>#<_value></Y>)\n') | ||||
| 
 | ||||
|         if (z3 != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + z3 + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<Z>#<_value></Z>)\n') | ||||
| 
 | ||||
|         if ((x3 != None) or (y3 != None) or (z3 != None)): | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,</POINT>)\n') | ||||
| 
 | ||||
|         if ((x4 != None) or (y4 != None) or (z4 != None)): | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<POINT>)\n') | ||||
| 
 | ||||
|         if (x4 != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + x4 + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<X>#<_value></X>)\n') | ||||
| 
 | ||||
|         if (y4 != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + y4 + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<Y>#<_value></Y>)\n') | ||||
| 
 | ||||
|         if (z4 != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + z4 + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<Z>#<_value></Z>)\n') | ||||
| 
 | ||||
|         if ((x4 != None) or (y4 != None) or (z4 != None)): | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,</POINT>)\n') | ||||
| 
 | ||||
|         if ((x5 != None) or (y5 != None) or (z5 != None)): | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<POINT>)\n') | ||||
| 
 | ||||
|         if (x5 != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + x5 + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<X>#<_value></X>)\n') | ||||
| 
 | ||||
|         if (y5 != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + y5 + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<Y>#<_value></Y>)\n') | ||||
| 
 | ||||
|         if (z5 != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + z5 + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<Z>#<_value></Z>)\n') | ||||
| 
 | ||||
|         if ((x5 != None) or (y5 != None) or (z5 != None)): | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,</POINT>)\n') | ||||
| 
 | ||||
|         if ((x6 != None) or (y6 != None) or (z6 != None)): | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<POINT>)\n') | ||||
| 
 | ||||
|         if (x6 != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + x6 + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<X>#<_value></X>)\n') | ||||
| 
 | ||||
|         if (y6 != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + y6 + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<Y>#<_value></Y>)\n') | ||||
| 
 | ||||
|         if (z6 != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + z6 + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<Z>#<_value></Z>)\n') | ||||
| 
 | ||||
|         if ((x6 != None) or (y6 != None) or (z6 != None)): | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,</POINT>)\n') | ||||
| 
 | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,</POINTS>)\n') | ||||
| 
 | ||||
|         if (xml_file_name != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOGCLOSE)\n') | ||||
| 
 | ||||
|     def open_log_file(self, xml_file_name=None ): | ||||
|         self.write_blocknum() | ||||
|         self.write('(LOGOPEN,') | ||||
|         self.write(xml_file_name) | ||||
|         self.write(')\n') | ||||
| 
 | ||||
|     def close_log_file(self): | ||||
|         self.write_blocknum() | ||||
|         self.write('(LOGCLOSE)\n') | ||||
| 
 | ||||
|     def log_coordinate(self, x=None, y=None, z=None): | ||||
|         if ((x != None) or (y != None) or (z != None)): | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<POINT>)\n') | ||||
| 
 | ||||
|         if (x != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + x + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<X>#<_value></X>)\n') | ||||
| 
 | ||||
|         if (y != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + y + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<Y>#<_value></Y>)\n') | ||||
| 
 | ||||
|         if (z != None): | ||||
|             self.write_blocknum() | ||||
|             self.write('#<_value>=[' + z + ']\n') | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,<Z>#<_value></Z>)\n') | ||||
| 
 | ||||
|         if ((x != None) or (y != None) or (z != None)): | ||||
|             self.write_blocknum() | ||||
|             self.write('(LOG,</POINT>)\n') | ||||
| 
 | ||||
|     def log_message(self, message=None ): | ||||
|         self.write_blocknum() | ||||
|         self.write('(LOG,' + message + ')\n') | ||||
| 
 | ||||
| nc.creator = Creator() | ||||
|  | @ -381,6 +381,7 @@ class CAM_OPERATION_PROPERTIES_Panel(CAMButtonsPanel, bpy.types.Panel): | |||
| 						layout.prop(ao,'strategy') | ||||
| 					layout.prop(ao,'rotary_axis_1') | ||||
| 					layout.prop(ao,'rotary_axis_2') | ||||
| 
 | ||||
| 				if ao.strategy=='BLOCK' or ao.strategy=='SPIRAL' or ao.strategy=='CIRCLES' or ao.strategy=='OUTLINEFILL': | ||||
| 					layout.prop(ao,'movement_insideout') | ||||
| 					 | ||||
|  | @ -423,7 +424,6 @@ class CAM_OPERATION_PROPERTIES_Panel(CAMButtonsPanel, bpy.types.Panel): | |||
| 					if ao.waterline_fill: | ||||
| 						layout.prop(ao,'dist_between_paths')			 | ||||
| 						layout.prop(ao,'waterline_project') | ||||
| 					layout.prop(ao,'skin') | ||||
| 					layout.prop(ao,'inverse') | ||||
| 				elif ao.strategy=='CARVE': | ||||
| 					layout.prop(ao,'carve_depth') | ||||
|  | @ -450,8 +450,6 @@ class CAM_OPERATION_PROPERTIES_Panel(CAMButtonsPanel, bpy.types.Panel): | |||
| 					if ao.strategy=='PARALLEL' or ao.strategy=='CROSS': | ||||
| 						layout.prop(ao,'parallel_angle') | ||||
| 												 | ||||
| 						 | ||||
| 					layout.prop(ao,'skin') | ||||
| 					layout.prop(ao,'inverse') | ||||
| 				#elif ao.strategy=='SLICES': | ||||
| 				#	layout.prop(ao,'slice_detail')	 | ||||
|  | @ -460,6 +458,8 @@ class CAM_OPERATION_PROPERTIES_Panel(CAMButtonsPanel, bpy.types.Panel): | |||
| 			#layout.operator("scene.cam_orientation_add") | ||||
| 			#gname=ao.name+'_orientations' | ||||
| 
 | ||||
| 			layout.prop(ao,'skin') | ||||
| 			 | ||||
| 			#if gname in bpy.data.groups: | ||||
| 			#	layout.label('orientations') | ||||
| 			#	group=bpy.data.groups[ao.name+'_orientations'] | ||||
|  | @ -576,7 +576,7 @@ class CAM_OPTIMISATION_Panel(CAMButtonsPanel, bpy.types.Panel): | |||
| 				if ao.optimize: | ||||
| 					layout.prop(ao,'optimize_threshold') | ||||
| 				if ao.geometry_source=='OBJECT' or ao.geometry_source=='GROUP': | ||||
| 					exclude_exact= ao.strategy=='CUTOUT' or ao.strategy=='DRILL' or ao.strategy=='PENCIL' | ||||
| 					exclude_exact= ao.strategy=='WATERLINE' or ao.strategy=='POCKET' or ao.strategy=='CUTOUT' or ao.strategy=='DRILL' or ao.strategy=='PENCIL' | ||||
| 					if not exclude_exact: | ||||
| 						layout.prop(ao,'use_exact') | ||||
| 						if ao.use_exact: | ||||
|  |  | |||
|  | @ -1060,6 +1060,9 @@ def exportGcodePath(filename,vertslist,operations): | |||
| 	elif m.post_processor=='EMC': | ||||
| 		extension = '.ngc' | ||||
| 		from .nc import emc2b as postprocessor | ||||
| 	elif m.post_processor=='GRBL': | ||||
| 		extension = '.ngc' | ||||
| 		from .nc import grbl as postprocessor | ||||
| 	elif m.post_processor=='HM50': | ||||
| 		from .nc import hm50 as postprocessor | ||||
| 	elif m.post_processor=='HEIDENHAIN': | ||||
|  | @ -1561,7 +1564,7 @@ def sortChunks(chunks,o): | |||
| 				ch = getClosest(o,pos,chunks) | ||||
| 			#	break | ||||
| 			#pass; | ||||
| 		if ch!=None:#found next chunk, append it to list | ||||
| 		if ch is not None:#found next chunk, append it to list | ||||
| 			ch.sorted = True | ||||
| 			ch.adaptdist(pos, o) | ||||
| 			print(ch) | ||||
|  | @ -1569,7 +1572,20 @@ def sortChunks(chunks,o): | |||
| 			sortedchunks.append(ch) | ||||
| 			lastch = ch | ||||
| 			pos = lastch.points[-1] | ||||
| 		# experimental fix for infinite loop problem | ||||
| 		#else: | ||||
| 			# can't find chunks close enough and still some chunks left | ||||
| 			# to be sorted. For now just move the remaining chunks over to  | ||||
| 			# the sorted list. | ||||
| 			# This fixes an infinite loop condition that occurs sometimes. | ||||
| 			# This is a bandaid fix: need to find the root cause of this problem | ||||
| 			# suspect it has to do with the sorted flag? | ||||
| 			#print("no chunks found closest. Chunks not sorted: ", len(chunks)) | ||||
| 			#sortedchunks.extend(chunks) | ||||
| 			#chunks[:] = [] | ||||
| 			 | ||||
| 		i -= 1 | ||||
| 			 | ||||
| 		''' | ||||
| 		if i<-200: | ||||
| 			for ch in chunks: | ||||
|  | @ -2284,29 +2300,20 @@ def addBridges(ch,o): | |||
| 				ch.points[p[0]]=p[1] | ||||
| 			for pi in range(len(insertpoints)-1,-1,-1): | ||||
| 				ch.points.insert(insertpoints[pi][0],insertpoints[pi][1]) | ||||
| #this is the main function. | ||||
| #FIXME: split strategies into separate file! | ||||
| #def cutoutStrategy(o): | ||||
| ''' | ||||
| #this is the main function. | ||||
| #FIXME: split strategies into separate file! | ||||
| #def cutoutStrategy(o): | ||||
| def getPath3axis(context,operation): | ||||
| 	s=bpy.context.scene | ||||
| 	o=operation | ||||
| 	getBounds(o) | ||||
| 
 | ||||
| ''' | ||||
| 
 | ||||
| ###########cutout strategy is completely here: | ||||
| 	if o.strategy=='CUTOUT': | ||||
| def strategy_cutout( o ): | ||||
| 	#ob=bpy.context.active_object | ||||
| 	print('operation: cutout') | ||||
| 	offset=True | ||||
| 	if o.cut_type=='ONLINE' and o.onlycurves==True:#is separate to allow open curves :) | ||||
| 			print('separe') | ||||
| 		print('separate') | ||||
| 		chunksFromCurve=[] | ||||
| 		for ob in o.objects: | ||||
| 			chunksFromCurve.extend(curveToChunks(ob)) | ||||
| 			p=Polygon.Polygon()	 | ||||
| 		#p=Polygon.Polygon()	 | ||||
| 		for ch in chunksFromCurve: | ||||
| 			#print(ch.points) | ||||
| 			 | ||||
|  | @ -2333,6 +2340,7 @@ def getPath3axis(context,operation): | |||
| 		chunksFromCurve.extend(shapelyToChunks(p,-1)) | ||||
| 		if o.outlines_count>1 and o.movement_insideout=='OUTSIDEIN': | ||||
| 			chunksFromCurve.reverse() | ||||
| 			 | ||||
| 	#parentChildPoly(chunksFromCurve,chunksFromCurve,o) | ||||
| 	chunksFromCurve=limitChunks(chunksFromCurve,o) | ||||
| 	parentChildPoly(chunksFromCurve,chunksFromCurve,o) | ||||
|  | @ -2364,6 +2372,7 @@ def getPath3axis(context,operation): | |||
| 			layers=[[o.maxz,o.min.z]] | ||||
| 		 | ||||
| 	print(layers) | ||||
| 	 | ||||
| 	extendorder=[] | ||||
| 	if o.first_down:#each shape gets either cut all the way to bottom, or every shape gets cut 1 layer, then all again. has to create copies, because same chunks are worked with on more layers usually | ||||
| 		for chunk in chunksFromCurve: | ||||
|  | @ -2387,11 +2396,9 @@ def getPath3axis(context,operation): | |||
| 			chunk=chl[0] | ||||
| 			layer=chl[1] | ||||
| 			if chunk.closed: | ||||
| 					chunk.rampContour(layer[0],layer[1],o) | ||||
| 				chunks.append(chunk.rampContour(layer[0],layer[1],o)) | ||||
| 			else: | ||||
| 					chunk.rampZigZag(layer[0],layer[1],o) | ||||
| 			 | ||||
| 		 | ||||
| 				chunks.append(chunk.rampZigZag(layer[0],layer[1],o)) | ||||
| 
 | ||||
| 	if o.use_bridges:#add bridges to chunks | ||||
| 		#bridges=getBridges(p,o) | ||||
|  | @ -2402,17 +2409,14 @@ def getPath3axis(context,operation): | |||
| 			if layer[1]<bridgeheight: | ||||
| 				addBridges(chunk,o) | ||||
| 
 | ||||
| 		 | ||||
| 		 | ||||
| 	for chl in extendorder: | ||||
| 		chunks.append(chl[0]) | ||||
| 			 | ||||
| 
 | ||||
| 		 | ||||
| 
 | ||||
| 	chunksToMesh(chunks,o) | ||||
| 
 | ||||
| 	elif o.strategy=='CURVE': | ||||
| def strategy_curve( o ): | ||||
| 	print('operation: curve') | ||||
| 	pathSamples=[] | ||||
| 	getOperationSources(o) | ||||
| 	if not o.onlycurves: | ||||
|  | @ -2430,9 +2434,8 @@ def getPath3axis(context,operation): | |||
| 			 | ||||
| 	chunksToMesh(pathSamples,o) | ||||
| 	 | ||||
| 		 | ||||
| 		 | ||||
| 	if o.strategy=='PROJECTED_CURVE': | ||||
| def strategy_proj_curve( s, o ): | ||||
| 	print('operation: projected curve') | ||||
| 	pathSamples = [] | ||||
| 	chunks = [] | ||||
| 	ob = bpy.data.objects[o.curve_object] | ||||
|  | @ -2485,7 +2488,6 @@ def getPath3axis(context,operation): | |||
| 				ep -= vece | ||||
| 				ch.endpoints.append(ep) | ||||
| 						 | ||||
| 					 | ||||
| 				ch.rotations.append((0,0,0)) | ||||
| 				 | ||||
| 				vec = sp - ep | ||||
|  | @ -2493,7 +2495,6 @@ def getPath3axis(context,operation): | |||
| 				ch.points[i] = sp.copy() | ||||
| 			 | ||||
| 			 | ||||
| 			 | ||||
| 	if o.use_layers: | ||||
| 		n = math.ceil(-(ch.depth/o.stepdown)) | ||||
| 		layers = [] | ||||
|  | @ -2513,7 +2514,25 @@ def getPath3axis(context,operation): | |||
| 	chunksToMesh(chunks,o) | ||||
| 
 | ||||
| 	 | ||||
| 	if o.strategy=='POCKET':	 | ||||
| #this is the main function. | ||||
| #FIXME: split strategies into separate file! | ||||
| #def cutoutStrategy(o): | ||||
| def getPath3axis(context, operation): | ||||
| 	s=bpy.context.scene | ||||
| 	o=operation | ||||
| 	getBounds(o) | ||||
| 	 | ||||
| 	 | ||||
| 	if o.strategy=='CUTOUT': | ||||
| 		strategy_cutout( o ) | ||||
| 		 | ||||
| 	elif o.strategy=='CURVE': | ||||
| 		strategy_curve( o ) | ||||
| 				 | ||||
| 	elif o.strategy=='PROJECTED_CURVE': | ||||
| 		strategy_proj_curve(s, o) | ||||
| 		 | ||||
| 	elif o.strategy=='POCKET':	 | ||||
| 		p=getObjectOutline(o.cutter_diameter/2,o,False) | ||||
| 		#all=Polygon.Polygon(p) | ||||
| 		approxn=(min(o.max.x-o.min.x,o.max.y-o.min.y)/o.dist_between_paths)/2 | ||||
|  | @ -3033,6 +3052,7 @@ def getPath3axis(context,operation): | |||
| 		chunks=sortChunks(chunks,o) | ||||
| 		print(chunks) | ||||
| 		chunksToMesh(chunks,o) | ||||
| 		 | ||||
| 	elif o.strategy=='MEDIAL_AXIS': | ||||
| 		print('doing highly experimental stuff') | ||||
| 		 | ||||
|  | @ -3473,5 +3493,3 @@ def reload_paths(o): | |||
| 	 | ||||
| 	if old_pathmesh != None: | ||||
| 		bpy.data.meshes.remove(old_pathmesh) | ||||
| 
 | ||||
| 	 | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 vilemnovak
						vilemnovak