def __init__(self): CamObject.__init__(self, id_named=True) self.active = True self.comment = '' self.tool_number = 0 self.pattern = 1 self.surface = 0
def __init__(self): CamObject.__init__(self, id_named=True) self.copies1 = 1 self.x_shift1 = 10.0 self.y_shift1 = 0.0 self.copies2 = 1 self.x_shift2 = 10.0 self.y_shift2 = 0.0
def ReadXml(self): self.comment = cad.GetXmlValue('comment', self.comment) self.active = cad.GetXmlBool('active', self.active) self.tool_number = cad.GetXmlInt('tool_number', self.tool_number) self.pattern = cad.GetXmlInt('pattern', self.pattern) self.surface = cad.GetXmlInt('surface', self.surface) CamObject.ReadXml(self)
def WriteXml(self): if len(self.comment) > 0: cad.SetXmlValue('comment', self.comment) cad.SetXmlValue('active', self.active) cad.SetXmlValue('tool_number', self.tool_number) cad.SetXmlValue('pattern', self.pattern) cad.SetXmlValue('surface', self.surface) CamObject.WriteXml(self)
def CopyFrom(self, object): CamObject.CopyFrom(self, object) self.active = object.active self.comment = object.comment self.tool_number = object.tool_number self.pattern = object.pattern self.surface = object.surface
def WriteXml(self): cad.SetXmlValue('x', self.pos.x) cad.SetXmlValue('y', self.pos.y) cad.SetXmlValue('width', self.width) cad.SetXmlValue('angle', self.angle) cad.SetXmlValue('height', self.height) CamObject.WriteXml(self)
def ReadXml(self): self.pos.x = cad.GetXmlFloat('x', self.pos.x) self.pos.y = cad.GetXmlFloat('y', self.pos.y) self.width = cad.GetXmlFloat('width', self.width) self.angle = cad.GetXmlFloat('angle', self.angle) self.height = cad.GetXmlFloat('height', self.height) CamObject.ReadXml(self)
def CopyFrom(self, object): self.tolerance = object.tolerance self.material_allowance = object.material_allowance self.same_for_each_pattern_position = object.same_for_each_pattern_position self.solids = [] self.solids += object.solids CamObject.CopyFrom(self, object)
def CopyFrom(self, object): CamObject.CopyFrom(self, object) self.copies1 = object.copies1 self.x_shift1 = object.x_shift1 self.y_shift1 = object.y_shift1 self.copies2 = object.copies2 self.x_shift2 = object.x_shift2 self.y_shift2 = object.y_shift2
def WriteXml(self): cad.SetXmlValue('copies1', self.copies1) cad.SetXmlValue('x_shift1', self.x_shift1) cad.SetXmlValue('y_shift1', self.y_shift1) cad.SetXmlValue('copies2', self.copies2) cad.SetXmlValue('x_shift2', self.x_shift2) cad.SetXmlValue('y_shift2', self.y_shift2) CamObject.WriteXml(self)
def ReadXml(self): self.copies1 = cad.GetXmlInt('copies1', self.copies1) self.x_shift1 = cad.GetXmlFloat('x_shift1', self.x_shift1) self.y_shift1 = cad.GetXmlFloat('y_shift1', self.y_shift1) self.copies2 = cad.GetXmlInt('copies2', self.copies2) self.x_shift2 = cad.GetXmlFloat('x_shift2', self.x_shift2) self.y_shift2 = cad.GetXmlFloat('y_shift2', self.y_shift2) CamObject.ReadXml(self)
def __init__(self, diameter = 3.0, title = None, tool_number = 0, type = TOOL_TYPE_SLOTCUTTER): CamObject.__init__(self, type) self.tool_number = tool_number self.type = type self.diameter = diameter self.material = TOOL_MATERIAL_UNDEFINED self.tool_length_offset = 0.0 self.corner_radius = 0.0 self.flat_radius = 0.0 self.cutting_edge_angle = 0.0 self.cutting_edge_height = 0.0 # How far, from the bottom of the cutter, do the flutes extend? self.automatically_generate_title = True #// Set to true by default but reset to false when the user edits the title. if title != None: self.title = title else: self.title = self.GenerateMeaningfulName() self.ResetParametersToReasonableValues()
def CopyFrom(self, o): self.units = o.units self.alternative_machines_file = o.alternative_machines_file self.machine = o.machine self.output_file = o.output_file self.output_file_name_follows_data_file_name = o.output_file_name_follows_data_file_name self.path_control_mode = o.path_control_mode self.motion_blending_tolerance = o.motion_blending_tolerance self.naive_cam_tolerance = o.naive_cam_tolerance CamObject.CopyFrom(self, o)
def GetProperties(self): properties = [] properties.append(PropertyMachine(self)) properties.append( PyProperty("output file name follows data file name", "output_file_name_follows_data_file_name", self)) properties.append(PropertyOutputFile(self)) properties.append(PropertyProgramUnits(self)) properties += CamObject.GetBaseProperties(self) return properties
def WriteXml(self): cad.SetXmlValue('machine', self.machine.description) cad.SetXmlValue('output_file', self.output_file) cad.SetXmlValue('output_file_name_follows_data_file_name', self.output_file_name_follows_data_file_name) cad.SetXmlValue('units', self.units) cad.SetXmlValue('ProgramPathControlMode', self.path_control_mode) cad.SetXmlValue('ProgramMotionBlendingTolerance', self.motion_blending_tolerance) cad.SetXmlValue('ProgramNaiveCamTolerance', self.naive_cam_tolerance) CamObject.WriteXml(self)
def WriteXml(self): cad.SetXmlValue('tolerance', self.tolerance) cad.SetXmlValue('material_allowance', self.material_allowance) cad.SetXmlValue('same_for_posns', self.same_for_each_pattern_position) for solid in self.solids: cad.BeginXmlChild('solid') cad.SetXmlValue('id', solid) cad.EndXmlChild() CamObject.WriteXml(self)
def GetProperties(self): properties = [] properties.append(PyProperty("Position", 'pos', self)) properties.append(PyPropertyLength("Width", 'width', self)) properties.append(PyProperty("Angle", 'angle', self)) properties.append(PyPropertyLength("Height", 'height', self)) properties += CamObject.GetProperties(self) return properties
def GetProperties(self): properties = [] properties.append(PyProperty("Comment", 'comment', self)) properties.append(PyProperty("Active", 'active', self)) properties.append(PyToolProperty(self)) properties.append(PyProperty("Pattern", 'pattern', self)) properties.append(PyProperty("Surface", 'surface', self)) properties += CamObject.GetProperties(self) return properties
def __init__(self): CamObject.__init__(self, type) self.units = 1.0 # set to 25.4 for inches self.alternative_machines_file = "" self.raw_material = RawMaterial( ) #// for material hardness - to determine feeds and speeds. self.machine = self.GetMachine("LinuxCNC") import wx self.output_file = str( (wx.StandardPaths.Get().GetTempDir() + "/test.tap").replace( '\\', '/') ) # // NOTE: Only relevant if the filename does NOT follow the data file's name. self.output_file_name_follows_data_file_name = True # // Just change the extension to determine the NC file name self.path_control_mode = PATH_CONTROL_UNDEFINED self.motion_blending_tolerance = 0.0001 # Only valid if m_path_control_mode == eBestPossibleSpeed self.naive_cam_tolerance = 0.0001 # Only valid if m_path_control_mode == eBestPossibleSpeed self.ReadDefaultValues() self.tools = None self.patterns = None self.surfaces = None self.stocks = None self.operations = None self.nccode = None
def ReadXml(self): self.tolerance = cad.GetXmlFloat('tolerance', self.tolerance) self.material_allowance = cad.GetXmlFloat('material_allowance', self.material_allowance) self.same_for_each_pattern_position = cad.GetXmlBool( 'same_for_posns', self.same_for_each_pattern_position) child_element = cad.GetFirstXmlChild() while child_element != None: if child_element == 'solid': solid = cad.GetXmlInt('id') self.solids.append(solid) child_element = cad.GetNextXmlChild() CamObject.ReadXml(self)
def CopyFrom(self, object): self.tool_number = object.tool_number self.type = object.type self.diameter = object.diameter self.material = object.material self.tool_length_offset = object.tool_length_offset self.corner_radius = object.corner_radius self.flat_radius = object.flat_radius self.cutting_edge_angle = object.cutting_edge_angle self.cutting_edge_height = object.cutting_edge_height self.automatically_generate_title = object.automatically_generate_title self.title = object.title CamObject.CopyFrom(self, object)
def GetProperties(self): properties = [] properties.append(PyProperty("Tool Number", 'tool_number', self)) properties.append(PyChoiceProperty("Automatic Title", 'automatically_generate_title', ['Leave manually assigned title', 'Automatically generate title'], self)) properties.append(PyChoiceProperty("Material", 'material', ['High Speed Steel', 'Carbide'], self, recalculate = self.ResetTitle)) properties.append(PyChoiceProperty("Type", 'type', GetToolTypeNames(), self, GetToolTypeValues(), recalculate = self.ResetTitle)) properties.append(PyPropertyLength("Diameter", 'diameter', self, recalculate = self.ResetTitle)) properties.append(PyPropertyLength("Tool Length Offset", 'tool_length_offset', self)) properties.append(PyPropertyLength("Flat Radius", 'flat_radius', self)) properties.append(PyPropertyLength("Corner Radius", 'corner_radius', self)) properties.append(PyProperty("Cutting Edge Angle", 'cutting_edge_angle', self)) properties.append(PyPropertyLength("Cutting Edge Height", 'cutting_edge_height', self)) properties += CamObject.GetBaseProperties(self) return properties
def WriteXml(self): cad.SetXmlValue('title', self.title) cad.SetXmlValue('tool_number', self.tool_number) cad.BeginXmlChild('params') cad.SetXmlValue('diameter', self.diameter) cad.SetXmlValue('tool_length_offset', self.tool_length_offset) cad.SetXmlValue('automatically_generate_title', self.automatically_generate_title) cad.SetXmlValue('material', self.material) cad.SetXmlValue('type', GetToolTypeXMLString(self.type)) cad.SetXmlValue('corner_radius', self.corner_radius) cad.SetXmlValue('flat_radius', self.flat_radius) cad.SetXmlValue('cutting_edge_angle', self.cutting_edge_angle) cad.SetXmlValue('cutting_edge_height', self.cutting_edge_height) cad.EndXmlChild() CamObject.WriteXml(self)
def ReadXml(self): self.machine = self.GetMachine(cad.GetXmlValue('machine')) self.output_file = cad.GetXmlValue('output_file') self.output_file_name_follows_data_file_name = cad.GetXmlBool( 'output_file_name_follows_data_file_name') self.units = cad.GetXmlFloat('units') self.path_control_mode = cad.GetXmlInt('ProgramPathControlMode') self.motion_blending_tolerance = cad.GetXmlFloat( 'ProgramMotionBlendingTolerance') self.naive_cam_tolerance = cad.GetXmlFloat('ProgramNaiveCamTolerance') CamObject.ReadXml(self) self.ReloadPointers() self.add_initial_children() # add any missing children
def ReadXml(self): self.tool_number = cad.GetXmlInt('tool_number') self.title = cad.GetXmlValue('title') child_element = cad.GetFirstXmlChild() while child_element != None: if child_element == 'params': self.diameter = cad.GetXmlFloat('diameter', self.diameter) self.tool_length_offset = cad.GetXmlFloat('tool_length_offset', self.tool_length_offset) self.automatically_generate_title = cad.GetXmlBool('automatically_generate_title', self.automatically_generate_title) self.material = cad.GetXmlInt('material', self.material) type_str = GetToolTypeXMLString(self.type) xml_value = cad.GetXmlValue('type', type_str) self.type = GetToolTypeFromString(xml_value) self.corner_radius = cad.GetXmlFloat('corner_radius', self.corner_radius) self.flat_radius = cad.GetXmlFloat('flat_radius', self.flat_radius) self.cutting_edge_angle = cad.GetXmlFloat('cutting_edge_angle', self.cutting_edge_angle) self.cutting_edge_height = cad.GetXmlFloat('cutting_edge_height', self.cutting_edge_height) child_element = cad.GetNextXmlChild() CamObject.ReadXml(self) self.ResetTitle()
def __init__(self): CamObject.__init__(self, id_named=True) self.solids = []
def WriteXml(self): for solid in self.solids: cad.BeginXmlChild('solid') cad.SetXmlValue('id', solid) cad.EndXmlChild() CamObject.WriteXml(self)
def CopyFrom(self, object): CamObject.CopyFrom(self, object) self.solids = [] self.solids += object.solids
def __init__(self): CamObject.__init__(self)
def GetProperties(self): properties = [] properties.append(cad.PropertyStringReadOnly('number of lines', str(self.nc_code.GetNumBlocks()))) properties += CamObject.GetProperties(self) return properties