diff --git a/scripts/addons/cam/opencamlib/oclSample.py b/scripts/addons/cam/opencamlib/oclSample.py index 9a9f97c2..c351199b 100644 --- a/scripts/addons/cam/opencamlib/oclSample.py +++ b/scripts/addons/cam/opencamlib/oclSample.py @@ -1,7 +1,6 @@ import os import ocl import tempfile -import pyocl import camvtk stl = camvtk.STLSurf(os.path.join(tempfile.gettempdir(), "model0.stl")) @@ -13,6 +12,8 @@ camvtk.vtkPolyData2OCLSTL(stl_polydata, stl_surf) with open(os.path.join(tempfile.gettempdir(), 'ocl_settings.txt'), 'r') as csv_file: op_cutter_type = csv_file.readline().split()[0] op_cutter_diameter = float(csv_file.readline()) + if op_cutter_type == "VCARVE": + op_cutter_tip_angle = float(csv_file.readline()) op_minz = float(csv_file.readline()) cutter = None @@ -23,7 +24,7 @@ if op_cutter_type == 'END': elif op_cutter_type == 'BALLNOSE': cutter = ocl.BallCutter(op_cutter_diameter * 1000, cutter_length) elif op_cutter_type == 'VCARVE': - cutter = ocl.ConeCutter(op_cutter_diameter * 1000, 1, cutter_length) + cutter = ocl.ConeCutter(op_cutter_diameter * 1000, op_cutter_tip_angle, cutter_length) else: print("Cutter unsupported: {0}\n".format(op_cutter_type)) quit() diff --git a/scripts/addons/cam/opencamlib/oclWaterline.py b/scripts/addons/cam/opencamlib/oclWaterline.py index 4535fef1..7d4c145e 100755 --- a/scripts/addons/cam/opencamlib/oclWaterline.py +++ b/scripts/addons/cam/opencamlib/oclWaterline.py @@ -6,11 +6,13 @@ stl = camvtk.STLSurf(tempfile.gettempdir() + "/model0.stl") stl_polydata = stl.src.GetOutput() stl_surf = ocl.STLSurf() camvtk.vtkPolyData2OCLSTL(stl_polydata, stl_surf) -csv_file = open(tempfile.gettempdir() + '/ocl_settings.txt', 'r') -op_cutter_type = csv_file.readline().split()[0] -op_cutter_diameter = float(csv_file.readline()) -op_minz = float(csv_file.readline()) -csv_file.close(); + +with open(tempfile.gettempdir() + '/ocl_settings.txt', 'r') as csv_file: + op_cutter_type = csv_file.readline().split()[0] + op_cutter_diameter = float(csv_file.readline()) + if op_cutter_type == "VCARVE": + op_cutter_tip_angle = float(csv_file.readline()) + op_minz = float(csv_file.readline()) cutter_length = 150 if op_cutter_type == 'END': @@ -18,7 +20,7 @@ if op_cutter_type == 'END': elif op_cutter_type == 'BALLNOSE': cutter = ocl.BallCutter(op_cutter_diameter * 1000, cutter_length) elif op_cutter_type == 'VCARVE': - cutter = ocl.ConeCutter(op_cutter_diameter * 1000, 1, cutter_length) + cutter = ocl.ConeCutter(op_cutter_diameter * 1000, op_cutter_tip_angle, cutter_length) else: print("Cutter unsupported: " + op_cutter_type + '\n') quit() diff --git a/scripts/addons/cam/opencamlib/opencamlib.py b/scripts/addons/cam/opencamlib/opencamlib.py index 454fec1e..6463b184 100644 --- a/scripts/addons/cam/opencamlib/opencamlib.py +++ b/scripts/addons/cam/opencamlib/opencamlib.py @@ -24,6 +24,8 @@ def operationSettingsToCSV(operation): with open(os.path.join(tempfile.gettempdir(), 'ocl_settings.txt'), 'w') as csv_file: csv_file.write("{}\n".format(operation.cutter_type)) csv_file.write("{}\n".format(operation.cutter_diameter)) + if operation.cutter_type == "VCARVE": + csv_file.write("{}\n".format(operation.cutter_tip_angle)) csv_file.write("{}\n".format(operation.minz))