def __init__(self): SpeedOp.__init__(self) self.user_depths = '' self.clearance_height = 5.0 self.start_depth = 0.0 self.step_down = 1.0 self.final_depth = -1.0 self.rapid_safety_space = 2.0 self.z_finish_depth = 0.0 self.z_thru_depth = 0.0
def DoGCodeCallsForPass(self, finishing_pass): failure = self.CheckToolExists() if failure: return failure tool = Tool.FindTool(self.tool_number) depthparams = self.GetDepthParams() if not finishing_pass or self.only_finishing_pass: SpeedOp.DoGCodeCalls(self) if self.auto_roll_on or self.auto_roll_off: roll_radius = self.auto_roll_radius / wx.GetApp().program.units else: roll_radius = None depth_params = self.GetDepthParams() tool_diameter = tool.CuttingRadius(True) * 2.0 cutting_edge_angle = tool.cutting_edge_angle if finishing_pass: feedrate_hv(self.finishing_h_feed_rate / wx.GetApp().program.units, self.vertical_feed_rate / wx.GetApp().program.units) flush_nc() offset_extra = 0.0 depth_params.step_down = self.finishing_step_down depth_params.z_finish_depth = 0.0 else: offset_extra = self.offset_extra / wx.GetApp().program.units cut_mode = self.finishing_cut_mode if finishing_pass else self.cut_mode self.DoEachSketch(self.DoGCodeCallsForSketch, (cut_mode, depth_params, tool_diameter, roll_radius, offset_extra, cutting_edge_angle))
def AppendTextToProgram(self): SpeedOp.AppendTextToProgram(self) wx.GetApp().program.python_program += "clearance = float(" + str( self.clearance_height / wx.GetApp().program.units) + ")\n" wx.GetApp( ).program.python_program += "rapid_safety_space = float(" + str( self.rapid_safety_space / wx.GetApp().program.units) + ")\n" wx.GetApp().program.python_program += "start_depth = float(" + str( self.start_depth / wx.GetApp().program.units) + ")\n" wx.GetApp().program.python_program += "step_down = float(" + str( self.step_down / wx.GetApp().program.units) + ")\n" wx.GetApp().program.python_program += "final_depth = float(" + str( self.final_depth / wx.GetApp().program.units) + ")\n" tool = wx.GetApp().program.tools.FindTool(self.tool_number) if tool != None: wx.GetApp( ).program.python_program += "tool_diameter = float(" + str( tool.diameter) + ")\n" if self.abs_mode == ABS_MODE_ABSOLUTE: wx.GetApp().program.python_program += "#absolute() mode\n" else: wx.GetApp().program.python_program += "rapid(z=clearance)\n" wx.GetApp().program.python_program += "incremental()\n"
def WriteDefaultValues(self): SpeedOp.WriteDefaultValues(self) config = CNCConfig() config.WriteInt("DepthOpAbsMode", self.abs_mode) config.WriteFloat("DepthOpClearance", self.clearance_height) config.WriteFloat("DepthOpStartDepth", self.start_depth) config.WriteFloat("DepthOpStepDown", self.step_down) config.WriteFloat("DepthOpFinalDepth", self.final_depth) config.WriteFloat("DepthOpRapidSpace", self.rapid_safety_space)
def ReadDefaultValues(self): SpeedOp.ReadDefaultValues(self) config = CNCConfig() self.abs_mode = config.ReadInt("DepthOpAbsMode", ABS_MODE_ABSOLUTE) self.clearance_height = config.ReadFloat("DepthOpClearance", 5.0) self.start_depth = config.ReadFloat("DepthOpStartDepth", 0.0) self.step_down = config.ReadFloat("DepthOpStepDown", 1.0) self.final_depth = config.ReadFloat("DepthOpFinalDepth", -1.0) self.rapid_safety_space = config.ReadFloat("DepthOpRapidSpace", 2.0)
def CopyFrom(self, object): SpeedOp.CopyFrom(self, object) self.clearance_height = object.clearance_height self.start_depth = object.start_depth self.step_down = object.step_down self.final_depth = object.final_depth self.rapid_safety_space = object.rapid_safety_space self.z_finish_depth = object.z_finish_depth self.z_thru_depth = object.z_thru_depth self.user_depths = object.user_depths
def WriteDefaultValues(self): SpeedOp.WriteDefaultValues(self) config = HeeksConfig() config.WriteFloat("ClearanceHeight", self.clearance_height) config.WriteFloat("StartDepth", self.start_depth) config.WriteFloat("StepDown", self.step_down) config.WriteFloat("FinalDepth", self.final_depth) config.WriteFloat("RapidSpace", self.rapid_safety_space) config.WriteFloat("ZFinish", self.z_finish_depth) config.WriteFloat("ZThru", self.z_thru_depth)
def ReadDefaultValues(self): SpeedOp.ReadDefaultValues(self) config = HeeksConfig() self.clearance_height = config.ReadFloat("ClearanceHeight", 5.0) self.start_depth = config.ReadFloat("StartDepth", 0.0) self.step_down = config.ReadFloat("StepDown", 1.0) self.final_depth = config.ReadFloat("FinalDepth", -1.0) self.rapid_safety_space = config.ReadFloat("RapidSpace", 2.0) self.z_finish_depth = config.ReadFloat("ZFinish", 0.0) self.z_thru_depth = config.ReadFloat("ZThru", 0.0)
def WriteXml(self): cad.BeginXmlChild('depthop') cad.SetXmlValue('clear', self.clearance_height) cad.SetXmlValue('down', self.step_down) if self.z_finish_depth > 0.0000001: cad.SetXmlValue('zfinish', self.z_finish_depth) if self.z_thru_depth > 0.0000001: cad.SetXmlValue('zthru', self.z_thru_depth) cad.SetXmlValue('userdepths', self.user_depths) cad.SetXmlValue('startdepth', self.start_depth) cad.SetXmlValue('depth', self.final_depth) cad.SetXmlValue('r', self.rapid_safety_space) cad.EndXmlChild() SpeedOp.WriteXml(self)
def ReadXml(self): child_element = cad.GetFirstXmlChild() while child_element != None: if child_element == 'depthop': self.clearance_height = cad.GetXmlFloat( 'clear', self.clearance_height) self.step_down = cad.GetXmlFloat('down', self.step_down) self.z_finish_depth = cad.GetXmlFloat('zfinish', self.z_finish_depth) self.z_thru_depth = cad.GetXmlFloat('zthru', self.z_thru_depth) self.user_depths = cad.GetXmlValue('userdepths', self.user_depths) self.start_depth = cad.GetXmlFloat('startdepth', self.start_depth) self.final_depth = cad.GetXmlFloat('depth', self.final_depth) self.rapid_safety_space = cad.GetXmlFloat( 'r', self.rapid_safety_space) child_element = cad.GetNextXmlChild() SpeedOp.ReadXml(self)
def GetProperties(self): properties = [] properties.append( PyPropertyLength("Clearance Height", 'clearance_height', self)) properties.append(PyPropertyLength("Start Depth", 'start_depth', self)) properties.append(PyPropertyLength("Final Depth", 'final_depth', self)) properties.append( PyPropertyLength("Maximum Step Down", 'step_down', self)) properties.append( PyPropertyLength("Rapid Safety Space", 'rapid_safety_space', self)) properties.append( PyPropertyLength("Z Finish Depth", 'z_finish_depth', self)) properties.append( PyPropertyLength("Z Thru Depth", 'z_thru_depth', self)) properties.append(PyProperty("User Depths", 'user_depths', self)) properties += SpeedOp.GetProperties(self) return properties
def DoGCodeCalls(self): failure = self.CheckToolExists() if failure: return failure tool = Tool.FindTool(self.tool_number) depth_params = self.GetDepthParams() tool_diameter = tool.CuttingRadius(True) * 2.0 SpeedOp.DoGCodeCalls(self) for point in self.points: object = cad.GetObjectFromId(cad.OBJECT_TYPE_POINT, point) pos = object.GetEndPoint() drill(x=pos.x / wx.GetApp().program.units, y=pos.y / wx.GetApp().program.units, dwell=self.dwell, depthparams=depth_params, retract_mode=self.retract_mode, spindle_mode=self.spindle_mode, internal_coolant_on=self.internal_coolant_on, rapid_to_clearance=self.rapid_to_clearance) end_canned_cycle()
def __init__(self): SpeedOp.__init__(self)