def createNGCFile(display=False): standoffParam = param['standoffPocket'] motorPocketParam = param['motorPocket'] motorHoleParam = param['motorHole'] boundaryParam = param['boundaryCut'] prog = gcode_cmd.GCodeProg() prog.add(gcode_cmd.GenericStart()) prog.add(gcode_cmd.Space()) for x0, y0 in param['partPos']: # Standoff pockets prog.add(gcode_cmd.Comment('-' * 60)) prog.add( gcode_cmd.Comment('Standoff pocket, partPos = ({0}, {1})'.format( x0, y0))) prog.add(gcode_cmd.Comment('-' * 60)) prog.add(gcode_cmd.FeedRate(standoffParam['feedRate'])) for i in (-1, 1): for j in (-1, 1): x = x0 + i * 0.5 * standoffParam['holeSpacing'] y = y0 + j * 0.5 * standoffParam['holeSpacing'] pocketDict = { 'centerX': x, 'centerY': y, 'radius': 0.5 * standoffParam['holeDiam'], 'depth': standoffParam['depth'], 'startZ': standoffParam['startZ'], 'safeZ': standoffParam['safeZ'], 'overlap': standoffParam['overlap'], 'overlapFinish': standoffParam['overlapFinish'], 'maxCutDepth': standoffParam['maxCutDepth'], 'toolDiam': standoffParam['toolDiam'], 'direction': standoffParam['direction'], 'startDwell': standoffParam['startDwell'], } pocket = cnc_pocket.CircPocketXY(pocketDict) prog.add(pocket) prog.add(gcode_cmd.Space()) prog.add(gcode_cmd.End(), comment=True) baseName, ext = os.path.splitext(__file__) fileName = '{0}.ngc'.format(baseName) if display: print(prog) else: print('creating: {0}'.format(fileName)) prog.write(fileName)
def createNGCFile(display=False): motorParam = param['motorDrill'] prog = gcode_cmd.GCodeProg() prog.add(gcode_cmd.GenericStart()) prog.add(gcode_cmd.Space()) # Motor mount holes for x0, y0 in param['partPos']: prog.add(gcode_cmd.Comment('-' * 60)) prog.add( gcode_cmd.Comment('Motor mount holes, partPos = ({0},{1})'.format( x0, y0))) prog.add(gcode_cmd.Comment('-' * 60)) prog.add(gcode_cmd.FeedRate(motorParam['feedRate'])) for i in (-1, 1): x = x0 + i * 0.5 * motorParam['holeSpacing'] drillDict = { 'centerX': x, 'centerY': y0, 'startZ': motorParam['startZ'], 'stopZ': motorParam['stopZThru'], 'safeZ': motorParam['safeZ'], 'stepZ': motorParam['stepZ'], 'startDwell': motorParam['startDwell'], } drill = cnc_drill.PeckDrill(drillDict) prog.add(drill) prog.add(gcode_cmd.Space()) prog.add(gcode_cmd.End(), comment=True) baseName, ext = os.path.splitext(__file__) fileName = '{0}.ngc'.format(baseName) if display: print(prog) else: print('creating: {0}'.format(fileName)) prog.write(fileName)
def createNGCFile(display=False): surfaceParam = param['surface'] prog = gcode_cmd.GCodeProg() prog.add(gcode_cmd.GenericStart()) prog.add(gcode_cmd.Space()) # Standoff holes prog.add(gcode_cmd.Comment('-' * 60)) prog.add(gcode_cmd.Comment("Surface")) prog.add(gcode_cmd.Comment('-' * 60)) prog.add(gcode_cmd.FeedRate(surfaceParam['feedRate'])) pocket = cnc_pocket.RectPocketXY(surfaceParam) prog.add(pocket) prog.add(gcode_cmd.End(), comment=True) baseName, ext = os.path.splitext(__file__) fileName = '{0}.ngc'.format(baseName) if display: print(prog) else: print('creating: {0}'.format(fileName)) prog.write(fileName)
def createNGCFile(display=False): standoffParam = param['standoffDrill'] prog = gcode_cmd.GCodeProg() prog.add(gcode_cmd.GenericStart()) prog.add(gcode_cmd.Space()) # Standoff holes prog.add(gcode_cmd.Comment("Standoff holes")) prog.add(gcode_cmd.FeedRate(standoffParam['feedRate'])) for x0, y0 in param['partPos']: for i in (-1, 1): for j in (-1, 1): x = x0 + i * 0.5 * standoffParam['holeSpacing'] y = y0 + j * 0.5 * standoffParam['holeSpacing'] drillDict = { 'centerX': x, 'centerY': y, 'startZ': standoffParam['startZ'], 'stopZ': standoffParam['stopZThru'], 'safeZ': standoffParam['safeZ'], 'stepZ': standoffParam['stepZ'], 'startDwell': standoffParam['startDwell'], } drill = cnc_drill.PeckDrill(drillDict) prog.add(drill) prog.add(gcode_cmd.Space()) prog.add(gcode_cmd.End(), comment=True) baseName, ext = os.path.splitext(__file__) fileName = '{0}.ngc'.format(baseName) if display: print(prog) else: print('creating: {0}'.format(fileName)) prog.write(fileName)
prog = gcode_cmd.GCodeProg() prog.add(gcode_cmd.GenericStart()) prog.add(gcode_cmd.Space()) prog.add(gcode_cmd.FeedRate(feedrate)) for xPosLayout, yPosLayout in zip(params['xPosList'],params['yPosList']): for drill in params['drillHoleList']: if drill['name'] == 'motorShaftHoles': stopZ = stopZSpecial else: stopZ = stopZNormal prog.add(gcode_cmd.Space()) prog.add(gcode_cmd.Comment(drill['name'])) for xPosRel, yPosRel in zip(drill['xPosList'],drill['yPosList']): xPos = xPosLayout + xPosRel yPos = yPosLayout + yPosRel drillDict = { 'centerX' : xPos, 'centerY' : yPos, 'startZ' : startZ, 'stopZ' : stopZ, 'safeZ' : safeZ, 'stepZ' : stepZ, 'startDwell' : startDwell, }
def createNGCFile(display=False): standoffParam = param['standoffPocket'] motorPocketParam = param['motorPocket'] motorHoleParam = param['motorHole'] boundaryParam = param['boundaryCut'] prog = gcode_cmd.GCodeProg() prog.add(gcode_cmd.GenericStart()) prog.add(gcode_cmd.Space()) for x0, y0 in param['partPos']: # Motor pocket prog.add(gcode_cmd.Comment('-'*60)) prog.add(gcode_cmd.Comment('Motor pocket, partPos = ({0}, {1})'.format(x0,y0))) prog.add(gcode_cmd.Comment('-'*60)) prog.add(gcode_cmd.FeedRate(motorPocketParam['feedRate'])) pocketDict = dict(motorPocketParam) pocketDict['centerX'] = x0 pocketDict['centerY'] = y0 pocket = cnc_pocket.CircPocketXY(pocketDict) prog.add(pocket) # Motor hole prog.add(gcode_cmd.FeedRate(motorHoleParam['feedRate'])) prog.add(gcode_cmd.Comment('-'*60)) prog.add(gcode_cmd.Comment('Motor hole, partPos = ({0}, {1})'.format(x0,y0))) prog.add(gcode_cmd.Comment('-'*60)) holeDict = dict(motorHoleParam) holeDict['centerX'] = x0 holeDict['centerY'] = y0 pocket = cnc_pocket.CircPocketXY(holeDict) prog.add(pocket) # Boundary cut prog.add(gcode_cmd.FeedRate(boundaryParam['feedRate'])) prog.add(gcode_cmd.Comment('-'*60)) prog.add(gcode_cmd.Comment('Boundary cut norm, partPos = ({0}, {1})'.format(x0,y0))) prog.add(gcode_cmd.Comment('-'*60)) boundaryDict = dict(boundaryParam) boundaryDict['centerX'] = x0 boundaryDict['centerY'] = y0 boundaryDict['depth'] = boundaryParam['normDepth'] boundaryDict['maxCutDepth'] = boundaryParam['normMaxCutDepth'] boundaryDict['startZ'] = boundaryParam['normStartZ'] pocket = cnc_pocket.RectAnnulusPocketXY(boundaryDict) prog.add(pocket) prog.add(gcode_cmd.Comment('-'*60)) prog.add(gcode_cmd.Comment('Boundary cut sep, partPos = ({0}, {1})'.format(x0,y0))) prog.add(gcode_cmd.Comment('-'*60)) boundaryDict = dict(boundaryParam) boundaryDict['centerX'] = x0 boundaryDict['centerY'] = y0 boundaryDict['depth'] = boundaryParam['sepDepth'] - boundaryParam['normDepth'] boundaryDict['maxCutDepth'] = boundaryParam['sepMaxCutDepth'] boundaryDict['startZ'] = -boundaryParam['normDepth'] pocket = cnc_pocket.RectAnnulusPocketXY(boundaryDict) prog.add(pocket) prog.add(gcode_cmd.End(),comment=True) baseName, ext = os.path.splitext(__file__) fileName = '{0}.ngc'.format(baseName) if display: print(prog) else: print('creating: {0}'.format(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,