kopia lustrzana https://github.com/vilemduha/blendercam
try to fix spinde writing WARNING nc files will be a bit different after this, please test.
rodzic
1ff9d09451
commit
f3531f3128
|
|
@ -11,8 +11,7 @@ class Creator(iso.Creator):
|
||||||
|
|
||||||
def program_begin(self, id, comment):
|
def program_begin(self, id, comment):
|
||||||
self.write( (';' + comment + '\n') )
|
self.write( (';' + comment + '\n') )
|
||||||
|
def TIME(self): return('X')
|
||||||
def FORMAT_DWELL(self): return( self.SPACE() + self.DWELL() + ' X%f')
|
|
||||||
|
|
||||||
def SPINDLE_OFF(self): return('M05')
|
def SPINDLE_OFF(self): return('M05')
|
||||||
#optimize
|
#optimize
|
||||||
|
|
@ -22,7 +21,7 @@ class Creator(iso.Creator):
|
||||||
def SPINDLE_DWELL(self,dwell):
|
def SPINDLE_DWELL(self,dwell):
|
||||||
w='\n'+self.BLOCK() % self.n+ self.DWELL() % dwell
|
w='\n'+self.BLOCK() % self.n+ self.DWELL() % dwell
|
||||||
return w
|
return w
|
||||||
|
|
||||||
def SPINDLE_CW(self,dwell):
|
def SPINDLE_CW(self,dwell):
|
||||||
return('M03' + self.SPINDLE_DWELL(dwell) )
|
return('M03' + self.SPINDLE_DWELL(dwell) )
|
||||||
|
|
||||||
|
|
@ -36,8 +35,9 @@ class Creator(iso.Creator):
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def tool_change(self, id):
|
def tool_change(self, id):
|
||||||
|
#print(self.SPACE())
|
||||||
|
#print(self.TOOL())
|
||||||
self.write(self.SPACE() + (self.TOOL() % id) + '\n')
|
self.write(self.SPACE() + (self.TOOL() % id) + '\n')
|
||||||
self.write(self.SPACE() + self.s.str)
|
|
||||||
self.write('\n')
|
self.write('\n')
|
||||||
self.flush_nc()
|
self.flush_nc()
|
||||||
self.t = id
|
self.t = id
|
||||||
|
|
|
||||||
|
|
@ -1134,8 +1134,7 @@ def exportGcodePath(filename,vertslist,operations):
|
||||||
#work-plane, by now always xy,
|
#work-plane, by now always xy,
|
||||||
c.set_plane(0)
|
c.set_plane(0)
|
||||||
c.flush_nc()
|
c.flush_nc()
|
||||||
c.write_spindle()
|
|
||||||
c.flush_nc()
|
|
||||||
return c
|
return c
|
||||||
|
|
||||||
c=startNewFile()
|
c=startNewFile()
|
||||||
|
|
@ -1158,21 +1157,24 @@ def exportGcodePath(filename,vertslist,operations):
|
||||||
else:
|
else:
|
||||||
spdir_clockwise=False
|
spdir_clockwise=False
|
||||||
|
|
||||||
c.spindle(o.spindle_rpm,spdir_clockwise)
|
|
||||||
c.flush_nc()
|
|
||||||
#write tool, not working yet probably
|
#write tool, not working yet probably
|
||||||
#print (last_cutter)
|
#print (last_cutter)
|
||||||
if last_cutter!=[o.cutter_id,o.cutter_diameter,o.cutter_type,o.cutter_flutes]:
|
if last_cutter!=[o.cutter_id,o.cutter_diameter,o.cutter_type,o.cutter_flutes]:
|
||||||
c.comment('Tool change - D = %s type %s flutes %s' % ( strInUnits(o.cutter_diameter,4),o.cutter_type, o.cutter_flutes))
|
c.comment('Tool change - D = %s type %s flutes %s' % ( strInUnits(o.cutter_diameter,4),o.cutter_type, o.cutter_flutes))
|
||||||
c.tool_change(o.cutter_id)
|
c.tool_change(o.cutter_id)
|
||||||
c.flush_nc()
|
c.flush_nc()
|
||||||
|
|
||||||
last_cutter=[o.cutter_id,o.cutter_diameter,o.cutter_type,o.cutter_flutes]
|
last_cutter=[o.cutter_id,o.cutter_diameter,o.cutter_type,o.cutter_flutes]
|
||||||
|
|
||||||
|
|
||||||
|
c.spindle(o.spindle_rpm,spdir_clockwise)
|
||||||
|
c.write_spindle()
|
||||||
c.flush_nc()
|
c.flush_nc()
|
||||||
|
|
||||||
if m.spindle_start_time>0:
|
if m.spindle_start_time>0:
|
||||||
c.dwell(m.spindle_start_time)
|
c.dwell(m.spindle_start_time)
|
||||||
c.flush_nc()
|
c.flush_nc()
|
||||||
|
|
||||||
|
|
||||||
# dhull c.feedrate(unitcorr*o.feedrate)
|
# dhull c.feedrate(unitcorr*o.feedrate)
|
||||||
|
|
||||||
|
|
@ -1197,12 +1199,13 @@ def exportGcodePath(filename,vertslist,operations):
|
||||||
last=Vector((0.0,0.0,free_movement_height))#nonsense values so first step of the operation gets written for sure
|
last=Vector((0.0,0.0,free_movement_height))#nonsense values so first step of the operation gets written for sure
|
||||||
lastrot=Euler((0,0,0))
|
lastrot=Euler((0,0,0))
|
||||||
duration=0.0
|
duration=0.0
|
||||||
f=millfeedrate
|
f=0.1123456#nonsense value, so first feedrate always gets written
|
||||||
fadjustval = 1 # if simulation load data is Not present
|
fadjustval = 1 # if simulation load data is Not present
|
||||||
|
|
||||||
downvector= Vector((0,0,-1))
|
downvector= Vector((0,0,-1))
|
||||||
plungelimit=(pi/2-o.plunge_angle)
|
plungelimit=(pi/2-o.plunge_angle)
|
||||||
|
|
||||||
|
|
||||||
#print('2')
|
#print('2')
|
||||||
for vi,vert in enumerate(verts):
|
for vi,vert in enumerate(verts):
|
||||||
|
|
||||||
|
|
@ -1302,21 +1305,23 @@ def exportGcodePath(filename,vertslist,operations):
|
||||||
findex+=1
|
findex+=1
|
||||||
c.file_close()
|
c.file_close()
|
||||||
c=startNewFile()
|
c=startNewFile()
|
||||||
c.spindle(o.spindle_rpm,spdir_clockwise)
|
|
||||||
c.flush_nc()
|
c.flush_nc()
|
||||||
c.comment('Tool change - D = %s type %s flutes %s' % ( strInUnits(o.cutter_diameter,4),o.cutter_type, o.cutter_flutes))
|
c.comment('Tool change - D = %s type %s flutes %s' % ( strInUnits(o.cutter_diameter,4),o.cutter_type, o.cutter_flutes))
|
||||||
c.tool_change(o.cutter_id)
|
c.tool_change(o.cutter_id)
|
||||||
c.spindle(o.spindle_rpm,spdir_clockwise)
|
c.spindle(o.spindle_rpm,spdir_clockwise)
|
||||||
c.feedrate(unitcorr*o.feedrate)
|
c.write_spindle()
|
||||||
c.flush_nc()
|
c.flush_nc()
|
||||||
|
|
||||||
if m.spindle_start_time>0:
|
if m.spindle_start_time>0:
|
||||||
c.dwell(m.spindle_start_time)
|
c.dwell(m.spindle_start_time)
|
||||||
c.flush_nc()
|
c.flush_nc()
|
||||||
|
|
||||||
|
c.feedrate(unitcorr*o.feedrate)
|
||||||
c.rapid(x=last.x*unitcorr,y=last.y*unitcorr,z=free_movement_height*unitcorr)
|
c.rapid(x=last.x*unitcorr,y=last.y*unitcorr,z=free_movement_height*unitcorr)
|
||||||
c.rapid(x=last.x*unitcorr,y=last.y*unitcorr,z=last.z*unitcorr)
|
c.rapid(x=last.x*unitcorr,y=last.y*unitcorr,z=last.z*unitcorr)
|
||||||
processedops=0
|
processedops=0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
c.feedrate(unitcorr*o.feedrate)
|
c.feedrate(unitcorr*o.feedrate)
|
||||||
|
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue