コード例 #1
0
ファイル: Tool.py プロジェクト: danheeks/PyCAM
 def OCLDefinition(self, surface):
     import ocl
     if self.type == TOOL_TYPE_BALLENDMILL:
         return ocl.BallCutter(self.diameter + surface.material_allowance * 2, 1000)
     elif self.type == TOOL_TYPE_CHAMFER or self.type == TOOL_TYPE_ENGRAVER:
         return ocl.CylConeCutter(self.flat_radius * 2 + surface.material_allowance, self.diameter + surface.material_allowance * 2, self.cutting_edge_angle * math.pi/360)
     else:
         if self.corner_radius > 0.000000001:
             return ocl.BullCutter(self.diameter + surface.material_allowance * 2, self.corner_radius, 1000)
         else:
             return ocl.CylCutter(self.diameter + surface.material_allowance * 2, 1000)
コード例 #2
0
ファイル: oclSample.py プロジェクト: Franckapik/blendercam
def ocl_sample(operation, chunks):

    oclSTL = get_oclSTL(operation)

    op_cutter_type = operation.cutter_type
    op_cutter_diameter = operation.cutter_diameter
    op_minz = operation.minz
    op_cutter_tip_angle = math.radians(operation.cutter_tip_angle)/2
    if op_cutter_type == "VCARVE": 
        cutter_length = (op_cutter_diameter/math.tan(op_cutter_tip_angle))/2
    else:
     cutter_length = 10

    cutter = None

    if op_cutter_type == 'END':
        cutter = ocl.CylCutter((op_cutter_diameter + operation.skin * 2) * 1000, cutter_length)
    elif op_cutter_type == 'BALLNOSE':
        cutter = ocl.BallCutter((op_cutter_diameter + operation.skin * 2) * 1000, cutter_length)
    elif op_cutter_type == 'VCARVE':
        cutter = ocl.ConeCutter((op_cutter_diameter + operation.skin * 2) * 1000, op_cutter_tip_angle, cutter_length)
    elif op_cutter_type =='CYLCONE':
        cutter = ocl.CylConeCutter((operation.cylcone_diameter/2+operation.skin)*2000,(op_cutter_diameter + operation.skin * 2) * 1000, op_cutter_tip_angle)
    elif op_cutter_type == 'BALLCONE':
        cutter = ocl.BallConeCutter((operation.ball_radius + operation.skin) * 2000,
                                    (op_cutter_diameter + operation.skin * 2) * 1000, op_cutter_tip_angle)
    elif op_cutter_type =='BULLNOSE':
        cutter = ocl.BullCutter((op_cutter_diameter + operation.skin * 2) * 1000,operation.bull_corner_radius*1000, cutter_length)
    else:
        print("Cutter unsupported: {0}\n".format(op_cutter_type))
        quit()

    bdc = ocl.BatchDropCutter()
    bdc.setSTL(oclSTL)
    bdc.setCutter(cutter)

    for chunk in chunks:
        for coord in chunk.points:
            bdc.appendPoint(ocl.CLPoint(coord[0] * 1000, coord[1] * 1000, op_minz * 1000))

    bdc.run()

    cl_points = bdc.getCLPoints()

    return cl_points
コード例 #3
0
 zheights.append(0.29)
 zheights.append(0.28)
 zheights.append(0.27)
 zheights.append(0.26)
 zheights.append(0.25)
 """
 #zheights=[ -0.35,  -0.25,  -0.15,  -0.05, 0.05,  0.15,   0.25]
 #zheights=[ 0.1]
 
 length = 10
 diam = 0.6
 cutter1 = ocl.CylCutter( diam , length )
 cutter2 = ocl.BallCutter( diam , length )
 cutter3 = ocl.BullCutter( diam , diam/5, length )
 cutter4 = ocl.ConeCutter( diam , math.pi/5, length )
 cutter5 =  ocl.CylConeCutter(diam/float(3),diam,math.pi/float(9))
 
 for zh in zheights:
     loops = calcWaterline(zh, cutter5, s)
     drawLoops(myscreen, loops[0], camvtk.red)
     
     #loops = calcWaterline(zh, cutter2, s)
     #drawLoops(myscreen, loops[0], camvtk.green)
     #loops = calcWaterline(zh, cutter3, s)
     #drawLoops(myscreen, loops[0], camvtk.yellow)
     
     #loops = calcWaterline(zh, cutter4, s)
     #drawLoops(myscreen, loops[0], camvtk.pink)
     
     #for f in loops[1]:
     #    drawFiber(myscreen, f, camvtk.red)