'height': 0.62, 'depth': 0.080, 'thickness': 0.25, 'startZ': startZ, 'safeZ': safeZ, 'overlap': 0.5, 'overlapFinish': 0.5, 'maxCutDepth': maxCutDepth, 'toolDiam': toolDiam, 'direction': 'ccw', 'startDwell': startDwell, 'cornerCut': False } if visualize: param['toolOffset'] = None pocket = cnc_boundary.RectBoundaryXY(param) else: pocket = cnc_pocket.RectAnnulusPocketXY(param) prog.add(pocket) if not visualize: prog.add(gcode_cmd.RapidMotion(x=xBackoff, y=yBackoff, z=zBackoff)) prog.add(gcode_cmd.Space()) prog.add(gcode_cmd.End(), comment=True) print(prog) baseName, dummy = os.path.splitext(__file__) fileName = '{0}.ngc'.format(baseName) print(fileName) prog.write(fileName)
for x, sgn in zip(xList, sgnList): if sgn == '+': xCut = x - 0.5 * endMillDiam xRet = x - 0.5 * endMillDiam - retDist y0Mod, y1Mod = y1, y0 else: xCut = x + 0.5 * endMillDiam xRet = x + 0.5 * endMillDiam + retDist y0Mod, y1Mod = y0, y1 print(xCut) prog.add(gcode_cmd.Space()) prog.add(gcode_cmd.Comment('Move to safe height')) prog.add(gcode_cmd.RapidMotion(z=safeHeight)) prog.add(gcode_cmd.Space()) prog.add( gcode_cmd.Comment( 'Move to x,y start and dwell for {0} secs'.format(startDwell))) prog.add(gcode_cmd.RapidMotion(x=xRet, y=y0Mod)) prog.add(gcode_cmd.Dwell(startDwell)) prog.add(gcode_cmd.Space()) prog.add(gcode_cmd.Comment('Surface raster')) prog.add(gcode_cmd.LinearFeed(z=z0)) prog.add( cnc_path.UniDirRasterRectPath((y0Mod, z0), (y1Mod, z1), step, xCut,
from py2gcode import cnc_dxf feedrate = 50.0 prog = gcode_cmd.GCodeProg() prog.add(gcode_cmd.GenericStart()) prog.add(gcode_cmd.Space()) prog.add(gcode_cmd.FeedRate(feedrate)) param = { 'fileName' : 'sensor_mount_holes.dxf', 'dxfTypes' : ['CIRCLE'], 'startZ' : 0.0, 'stopZ' : -0.4, 'safeZ' : 0.5, 'stepZ' : 0.02, 'startDwell' : 2.0, } drill = cnc_dxf.DxfDrill(param) prog.add(drill) prog.add(gcode_cmd.RapidMotion(x=10.0,y=0.0,z=0.5)) prog.add(gcode_cmd.Space()) prog.add(gcode_cmd.End(),comment=True) baseName, dummy = os.path.splitext(__file__) fileName = '{0}.ngc'.format(baseName) print('generating: {0}'.format(fileName)) prog.write(fileName)
start_pos = {'x': 0.0, 'y': 0.0, 'z': 0.0, 'a': 0.0} final_pos = {'x': 0.0, 'y': 0.0, 'z': -0.6} #start_pos = {'x': 0.0, 'y': 0.0, 'z': -0.5, 'a': 0.0} #final_pos = {'x': 0.0, 'y': 0.0, 'z': -0.9} final_pos['a'] = 360 * abs(final_pos['z'] - start_pos['z']) / depth_per_360 total_t = abs(final_pos['z'] - start_pos['z']) / feedrate angle_rate = abs(final_pos['a'] - start_pos['a']) / total_t print('start_pos: ', start_pos) print('final_pos: ', final_pos) print('total_t: ', total_t) print('angle_rate: ', angle_rate) prog = gcode_cmd.GCodeProg() prog.add(gcode_cmd.GenericStart()) prog.add(gcode_cmd.Space()) prog.add(gcode_cmd.FeedRate(feedrate)) prog.add(gcode_cmd.RapidMotion(**start_pos)) prog.add(gcode_cmd.LinearFeed(**final_pos)) del zero_pos['a'] prog.add(gcode_cmd.RapidMotion(**zero_pos)) prog.add(gcode_cmd.Space()) prog.add(gcode_cmd.End(), comment=True) baseName, dummy = os.path.splitext(__file__) fileName = '{0}.ngc'.format(baseName) print('generating: {0}'.format(fileName)) prog.write(fileName)
'height': 0.508, 'depth': depth, 'thickness': toolDiam, 'startZ': startZ, 'safeZ': safeZ, 'overlap': 0.5, 'overlapFinish': 0.5, 'maxCutDepth': maxCutDepth, 'toolDiam': toolDiam, 'direction': 'ccw', 'startDwell': startDwell, 'cornerCut': True } pocket = cnc_pocket.RectAnnulusPocketXY(param) prog.add(pocket) prog.add(gcode_cmd.Space()) if not visualize: prog.add(gcode_cmd.RapidMotion(**{'x': 0.0, 'y': 1.5, 'z': 3.0})) prog.add(gcode_cmd.Space()) prog.add(gcode_cmd.End(), comment=True) print(prog) baseName, dummy = os.path.splitext(__file__) fileName = '{0}.ngc'.format(baseName) print(fileName) prog.write(fileName)