class ProfileDlg(SketchOpDlg): def __init__(self, object, title = 'Profile Operation'): SketchOpDlg.__init__(self, object, title) def AddLeftControls(self): # add all the controls to the left side tool_on_side_choices = ['Left', 'Right', 'On'] self.cmbToolOnSide = ComboBoxBinded(self, choices = tool_on_side_choices) self.MakeLabelAndControl("Tool On Side", self.cmbToolOnSide).AddToSizer(self.sizerLeft) #self.SetSketchOrderAndCombo(self.sketch) cut_mode_choices = ["Conventional", "Climb"] self.cmbCutMode = ComboBoxBinded(self, choices = cut_mode_choices) self.MakeLabelAndControl("Cut Mode", self.cmbCutMode).AddToSizer(self.sizerLeft) #self.Bind(wx.EVT_COMBOBOX, self.OnComboOrCheck, self.cmbCutMode) self.lgthRollRadius = LengthCtrl(self) self.MakeLabelAndControl("Roll Radius", self.lgthRollRadius).AddToSizer(self.sizerLeft) self.lgthOffsetExtra = LengthCtrl(self) self.MakeLabelAndControl("Offset Extra", self.lgthOffsetExtra).AddToSizer(self.sizerLeft) self.chkDoFinishingPass = wx.CheckBox(self, wx.ID_ANY, 'Do Finishing Pass') HControl(wx.ALL, self.chkDoFinishingPass).AddToSizer(self.sizerLeft) self.chkOnlyFinishingPass = wx.CheckBox(self, wx.ID_ANY, 'Only Finishing Pass') HControl(wx.ALL, self.chkOnlyFinishingPass).AddToSizer(self.sizerLeft) self.lgthFinishingFeedrate = LengthCtrl(self) self.staticFinishingFeedrate = wx.StaticText(self, wx.ID_ANY, "Finishing Feed Rate") self.MakeControlUsingStaticText(self.staticFinishingFeedrate, self.lgthFinishingFeedrate).AddToSizer(self.sizerLeft) self.cmbFinishingCutMode = ComboBoxBinded(self, choices = cut_mode_choices) self.staticFinishingCutMode = wx.StaticText(self, wx.ID_ANY, "Finishing Cut Mode") self.MakeControlUsingStaticText(self.staticFinishingCutMode, self.cmbFinishingCutMode).AddToSizer(self.sizerLeft) self.lgthFinishStepDown = LengthCtrl(self) self.staticFinishStepDown = wx.StaticText(self, wx.ID_ANY, "Finish Step Down") self.MakeControlUsingStaticText(self.staticFinishStepDown, self.lgthFinishStepDown).AddToSizer(self.sizerLeft) SketchOpDlg.AddLeftControls(self) def OnSketchCombo(self, event): choice = self.cmbToolOnSide.GetSelection() self.SetSketchOrderAndCombo(self.cmbSketch.GetSelectedId()) self.cmbToolOnSide.SetSelection(choice) def SetDefaultFocus(self): #self.cmbSketch.SetFocus() pass def GetDataRaw(self): if self.cmbToolOnSide.GetSelection() == 0: self.object.tool_on_side = Profile.PROFILE_LEFT_OR_OUTSIDE elif self.cmbToolOnSide.GetSelection() == 1: self.object.tool_on_side = Profile.PROFILE_RIGHT_OR_INSIDE elif self.cmbToolOnSide.GetSelection() == 2: self.object.tool_on_side = Profile.PROFILE_ON self.object.cut_mode = Profile.PROFILE_CLIMB if self.cmbCutMode.GetValue().lower() == 'climb' else Profile.PROFILE_CONVENTIONAL self.object.auto_roll_radius = self.lgthRollRadius.GetValue() self.object.offset_extra = self.lgthOffsetExtra.GetValue() self.object.do_finishing_pass = self.chkDoFinishingPass.GetValue() self.object.only_finishing_pass = self.chkOnlyFinishingPass.GetValue() self.object.finishing_h_feed_rate = self.lgthFinishingFeedrate.GetValue() self.object.finishing_cut_mode = Profile.PROFILE_CLIMB if self.cmbFinishingCutMode.GetValue().lower() == 'climb' else Profile.PROFILE_CONVENTIONAL self.object.finishing_step_down = self.lgthFinishStepDown.GetValue() SketchOpDlg.GetDataRaw(self) def SetFromDataRaw(self): choice = 2 if self.object.tool_on_side == Profile.PROFILE_RIGHT_OR_INSIDE: choice = 1 elif self.object.tool_on_side == Profile.PROFILE_LEFT_OR_OUTSIDE: choice = 0 self.cmbToolOnSide.SetSelection(choice) self.cmbCutMode.SetValue("Climb" if self.object.cut_mode == Profile.PROFILE_CLIMB else "Conventional") self.lgthRollRadius.SetValue(self.object.auto_roll_radius) self.lgthOffsetExtra.SetValue(self.object.offset_extra) self.chkDoFinishingPass.SetValue(self.object.do_finishing_pass) self.chkOnlyFinishingPass.SetValue(self.object.only_finishing_pass) self.lgthFinishingFeedrate.SetValue(self.object.finishing_h_feed_rate) self.cmbFinishingCutMode.SetValue("Climb" if self.object.finishing_cut_mode == Profile.PROFILE_CLIMB else "Conventional") self.lgthFinishStepDown.SetValue(self.object.finishing_step_down) self.EnableControls() SketchOpDlg.SetFromDataRaw(self) self.SetSketchOrderAndCombo(self.cmbSketch.GetSelectedId()) def EnableControls(self): finish = self.chkDoFinishingPass.GetValue() self.chkOnlyFinishingPass.Enable(finish) self.lgthFinishingFeedrate.Enable(finish) self.cmbFinishingCutMode.Enable(finish) self.lgthFinishStepDown.Enable(finish) self.staticFinishingFeedrate.Enable(finish) self.staticFinishingCutMode.Enable(finish) self.staticFinishStepDown.Enable(finish) def SetPictureByName(self, name): self.SetPictureByNameAndFolder( name, 'profile') def SetPictureByWindow(self, w): if w == self.cmbToolOnSide: sel = self.cmbToolOnSide.GetSelection() if sel == 2: ProfileDlg.SetPictureByName(self, 'side on') else: if self.order == cad.SketchOrderType.SketchOrderTypeOpen: ProfileDlg.SetPictureByName(self, 'side right' if sel == 1 else 'side left') elif self.order == cad.SketchOrderType.SketchOrderTypeCloseCW or self.order == cad.SketchOrderType.SketchOrderTypeCloseCCW: ProfileDlg.SetPictureByName(self, 'side inside' if sel == 1 else 'side outside') else: ProfileDlg.SetPictureByName(self, 'side inside or right' if sel == 1 else 'side outside or left') elif w == self.cmbCutMode: if self.cmbCutMode.GetValue() == 'Climb': self.SetPictureByNameAndFolder('climb milling', 'pocket') else: self.SetPictureByNameAndFolder('conventional milling', 'pocket') elif w == self.lgthRollRadius: ProfileDlg.SetPictureByName(self, 'roll radius') elif w == self.lgthOffsetExtra: ProfileDlg.SetPictureByName(self, 'offset extra') elif w == self.chkDoFinishingPass or w == self.chkOnlyFinishingPass: if self.chkDoFinishingPass.GetValue(): if self.chkOnlyFinishingPass.GetValue(): ProfileDlg.SetPictureByName(self, 'only finishing') else: ProfileDlg.SetPictureByName(self, 'no finishing pass') elif w == self.cmbFinishingCutMode: if self.cmbFinishingCutMode.GetValue() == 'Climb': self.SetPictureByNameAndFolder('climb milling', 'pocket') else: self.SetPictureByNameAndFolder('conventional milling', 'pocket') elif w == self.lgthFinishStepDown: self.SetPictureByNameAndFolder('step down', 'depthop') # else: # SketchOpDlg.SetPictureByWindow(self, w) def SetSketchOrderAndCombo(self, s): self.order = cad.SketchOrderType.SketchOrderTypeUnknown sketch = cad.GetObjectFromId(cad.OBJECT_TYPE_SKETCH, s) if sketch and sketch.GetType() == cad.OBJECT_TYPE_SKETCH: self.order = sketch.GetSketchOrder() if self.order == cad.SketchOrderType.SketchOrderTypeOpen: self.cmbToolOnSide.SetString(0, 'Left') self.cmbToolOnSide.SetString(1, 'Right') elif self.order == cad.SketchOrderType.SketchOrderTypeCloseCW or self.order == cad.SketchOrderType.SketchOrderTypeCloseCCW: self.cmbToolOnSide.SetString(0, 'Outside') self.cmbToolOnSide.SetString(1, 'Inside') else: self.cmbToolOnSide.SetString(0, 'Outside or Left') self.cmbToolOnSide.SetString(1, 'Inside or Right')
class ToolDlg(HeeksObjDlg): def __init__(self, object, title="Tool Definition"): HeeksObjDlg.__init__(self, object, title, True) def AddLeftControls(self): self.txtToolNumber = wx.TextCtrl(self) self.MakeLabelAndControl("Tool Number", self.txtToolNumber).AddToSizer(self.sizerLeft) self.cmbMaterial = wx.ComboBox(self, choices=["High Speed Steel", "Carbide"]) self.Bind(wx.EVT_COMBOBOX, self.OnComboMaterial, self.cmbMaterial) self.MakeLabelAndControl("Tool Material", self.cmbMaterial).AddToSizer(self.sizerLeft) self.cmbToolType = wx.ComboBox(self, choices=Tool.GetToolTypeNames()) self.Bind(wx.EVT_COMBOBOX, self.OnComboToolType, self.cmbToolType) self.MakeLabelAndControl("Tool Type", self.cmbToolType).AddToSizer(self.sizerLeft) self.lgthDiameter = LengthCtrl(self) self.MakeLabelAndControl("Diameter", self.lgthDiameter).AddToSizer(self.sizerLeft) self.Bind(wx.EVT_TEXT, self.OnDiamChange, self.lgthDiameter) self.lgthToolLengthOffset = LengthCtrl(self) self.MakeLabelAndControl("Tool Length Offset", self.lgthToolLengthOffset).AddToSizer( self.sizerLeft) self.lgthFlatRadius = LengthCtrl(self) self.MakeLabelAndControl( "Flat Radius", self.lgthFlatRadius).AddToSizer(self.sizerLeft) self.lgthCornerRadius = LengthCtrl(self) self.MakeLabelAndControl( "Corner Radius", self.lgthCornerRadius).AddToSizer(self.sizerLeft) self.lgthCuttingEdgeAngle = DoubleCtrl(self) self.MakeLabelAndControl("Cutting Edge Angle", self.lgthCuttingEdgeAngle).AddToSizer( self.sizerLeft) self.lgthCuttingEdgeHeight = LengthCtrl(self) self.MakeLabelAndControl("Cutting Edge Height", self.lgthCuttingEdgeHeight).AddToSizer( self.sizerLeft) HeeksObjDlg.AddLeftControls(self) def AddRightControls(self): self.txtTitle = wx.TextCtrl(self, wx.ID_ANY) self.MakeLabelAndControl('Title', self.txtTitle).AddToSizer(self.sizerRight) self.txtTitle.Bind(wx.EVT_TEXT, self.OnTitleEdited) self.cmbTitleType = wx.ComboBox(self, choices=[ "Leave manually assigned title", "Automatically Generate Title" ]) self.MakeLabelAndControl("Title Type", self.cmbTitleType).AddToSizer(self.sizerRight) self.cmbTitleType.Bind(wx.EVT_COMBOBOX, self.OnTitleType) HeeksObjDlg.AddRightControls(self) def GetDataRaw(self): self.object.tool_number = int(self.txtToolNumber.GetValue()) self.object.material = self.cmbMaterial.GetSelection() self.object.type = Tool.GetToolTypeValues()[ self.cmbToolType.GetSelection()] self.object.diameter = self.lgthDiameter.GetValue() self.object.tool_length_offset = self.lgthToolLengthOffset.GetValue() self.object.flat_radius = self.lgthFlatRadius.GetValue() self.object.corner_radius = self.lgthCornerRadius.GetValue() self.object.cutting_edge_angle = self.lgthCuttingEdgeAngle.GetValue() self.object.cutting_edge_height = self.lgthCuttingEdgeHeight.GetValue() self.object.title = self.txtTitle.GetValue() self.object.automatically_generate_title = ( self.cmbTitleType.GetSelection() != 0) HeeksObjDlg.GetDataRaw(self) def SetFromDataRaw(self): self.txtToolNumber.SetValue(str(self.object.tool_number)) self.cmbMaterial.SetSelection(self.object.material) self.cmbToolType.SetSelection(Tool.GetToolTypeIndex(self.object.type)) self.lgthDiameter.SetValue(self.object.diameter) self.lgthToolLengthOffset.SetValue(self.object.tool_length_offset) self.lgthFlatRadius.SetValue(self.object.flat_radius) self.lgthCornerRadius.SetValue(self.object.corner_radius) self.lgthCuttingEdgeAngle.SetValue(self.object.cutting_edge_angle) self.lgthCuttingEdgeHeight.SetValue(self.object.cutting_edge_height) self.txtTitle.SetValue(self.object.title) self.cmbTitleType.SetSelection( 1 if self.object.automatically_generate_title else 0) self.EnableAndSetCornerFlatAndAngle() HeeksObjDlg.SetFromDataRaw(self) def SetPictureByName(self, name): self.SetPictureByNameAndFolder(name, "tool") def SetPictureByNameAndFolder(self, name, folder): if self.picture: self.picture.SetPicture(wx.GetApp().cam_dir + '/bitmaps/' + folder + '/' + name + '.png') def SetPictureByWindow(self, w): type = Tool.GetToolTypeValues()[self.cmbToolType.GetSelection()] if type == TOOL_TYPE_DRILL: if w == self.lgthDiameter: self.SetPictureByName('drill_diameter') elif w == self.lgthToolLengthOffset: self.SetPictureByName('drill_offset') elif w == self.lgthFlatRadius: self.SetPictureByName('drill_flat') elif w == self.lgthCornerRadius: self.SetPictureByName('drill_corner') elif w == self.lgthCuttingEdgeAngle: self.SetPictureByName('drill_angle') elif w == self.lgthCuttingEdgeHeight: self.SetPictureByName('drill_height') else: self.SetPictureByName('drill') elif type == TOOL_TYPE_CENTREDRILL: if w == self.lgthDiameter: self.SetPictureByName('centre_drill_diameter') elif w == self.lgthToolLengthOffset: self.SetPictureByName('centre_drill_offset') elif w == self.lgthFlatRadius: self.SetPictureByName('centre_drill_flat') elif w == self.lgthCornerRadius: self.SetPictureByName('centre_drill_corner') elif w == self.lgthCuttingEdgeAngle: self.SetPictureByName('centre_drill_angle') elif w == self.lgthCuttingEdgeHeight: self.SetPictureByName('centre_drill_height') else: self.SetPictureByName('centre_drill') elif type == TOOL_TYPE_ENDMILL or type == TOOL_TYPE_SLOTCUTTER: if w == self.lgthDiameter: self.SetPictureByName('end_mill_diameter') elif w == self.lgthToolLengthOffset: self.SetPictureByName('end_mill_offset') elif w == self.lgthFlatRadius: self.SetPictureByName('end_mill_flat') elif w == self.lgthCornerRadius: self.SetPictureByName('end_mill_corner') elif w == self.lgthCuttingEdgeAngle: self.SetPictureByName('end_mill_angle') elif w == self.lgthCuttingEdgeHeight: self.SetPictureByName('end_mill_height') else: self.SetPictureByName('end_mill') elif type == TOOL_TYPE_BALLENDMILL: if w == self.lgthDiameter: self.SetPictureByName('ball_mill_diameter') elif w == self.lgthToolLengthOffset: self.SetPictureByName('ball_mill_offset') elif w == self.lgthFlatRadius: self.SetPictureByName('ball_mill_flat') elif w == self.lgthCornerRadius: self.SetPictureByName('ball_mill_corner') elif w == self.lgthCuttingEdgeAngle: self.SetPictureByName('ball_mill_angle') elif w == self.lgthCuttingEdgeHeight: self.SetPictureByName('ball_mill_height') else: self.SetPictureByName('ball_mill') elif type == TOOL_TYPE_CHAMFER: if w == self.lgthDiameter: self.SetPictureByName('chamfer_diameter') elif w == self.lgthToolLengthOffset: self.SetPictureByName('chamfer_offset') elif w == self.lgthFlatRadius: self.SetPictureByName('chamfer_flat') elif w == self.lgthCornerRadius: self.SetPictureByName('chamfer_corner') elif w == self.lgthCuttingEdgeAngle: self.SetPictureByName('chamfer_angle') elif w == self.lgthCuttingEdgeHeight: self.SetPictureByName('chamfer_height') else: self.SetPictureByName('chamfer') elif type == TOOL_TYPE_ENGRAVER: if w == self.lgthDiameter: self.SetPictureByName('engraver_diameter') elif w == self.lgthToolLengthOffset: self.SetPictureByName('engraver_offset') elif w == self.lgthFlatRadius: self.SetPictureByName('engraver_flat') elif w == self.lgthCornerRadius: self.SetPictureByName('engraver_corner') elif w == self.lgthCuttingEdgeAngle: self.SetPictureByName('engraver_angle') elif w == self.lgthCuttingEdgeHeight: self.SetPictureByName('engraver_height') else: self.SetPictureByName('engraver') def OnComboToolType(self, e): self.EnableAndSetCornerFlatAndAngle() self.SetTitleFromControls() HeeksObjDlg.SetPicture(self) def OnComboMaterial(self, e): self.SetTitleFromControls() HeeksObjDlg.SetPicture(self) def EnableAndSetCornerFlatAndAngle(self): type = Tool.GetToolTypeValues()[self.cmbToolType.GetSelection()] if type == TOOL_TYPE_DRILL or type == TOOL_TYPE_CENTREDRILL: self.lgthCornerRadius.Enable(False) self.lgthCornerRadius.SetLabel("") self.lgthFlatRadius.Enable(False) self.lgthFlatRadius.SetLabel("") self.lgthCuttingEdgeAngle.Enable() self.lgthCuttingEdgeAngle.SetValue(self.object.cutting_edge_angle) elif type == TOOL_TYPE_ENDMILL or type == TOOL_TYPE_SLOTCUTTER: self.lgthCornerRadius.Enable() self.lgthCornerRadius.SetValue(self.object.corner_radius) self.lgthFlatRadius.Enable(False) self.lgthFlatRadius.SetLabel("") self.lgthCuttingEdgeAngle.Enable(False) self.lgthCuttingEdgeAngle.SetLabel("") elif type == TOOL_TYPE_BALLENDMILL: self.lgthCornerRadius.Enable(False) self.lgthCornerRadius.SetLabel("") self.lgthFlatRadius.Enable(False) self.lgthFlatRadius.SetLabel("") self.lgthCuttingEdgeAngle.Enable(False) self.lgthCuttingEdgeAngle.SetLabel("") elif type == TOOL_TYPE_CHAMFER or type == TOOL_TYPE_ENGRAVER: self.lgthCornerRadius.Enable(False) self.lgthCornerRadius.SetLabel("") self.lgthFlatRadius.Enable() self.lgthFlatRadius.SetValue(self.object.flat_radius) self.lgthCuttingEdgeAngle.Enable() self.lgthCuttingEdgeAngle.SetValue(self.object.cutting_edge_angle) def SetTitleFromControls(self): if self.ignore_event_functions: return if self.cmbTitleType.GetSelection() == 0: return save_object = self.object self.object = self.object.MakeACopy() self.GetData() self.ignore_event_functions = True self.object.ResetTitle() self.txtTitle.SetValue(self.object.title) self.object = save_object self.ignore_event_functions = False def OnDiamChange(self, e): self.SetTitleFromControls() def OnTitleEdited(self, event): if self.ignore_event_functions: return # if the user starts typing in the title, change type to manually assigned self.ignore_event_functions = True self.cmbTitleType.SetSelection(0) self.ignore_event_functions = False def OnTitleType(self, event): if self.ignore_event_functions: return self.SetTitleFromControls()
class MirrorDlg(HDialog): def __init__(self, axis, pos, axis_type, copy, title): HDialog.__init__(self, title) self.ignore_event_functions = True sizerMain = wx.BoxSizer(wx.VERTICAL) self.copy = copy self.axis = axis self.axis_type = axis_type self.pos = pos self.btnPick = None self.btnVectorPick = None self.chkCopy = wx.CheckBox(self, wx.ID_ANY, 'Keep Original') HControl(wx.ALL, self.chkCopy).AddToSizer(sizerMain) self.chkCopy.SetValue(copy) sizerPosAndAxis = wx.BoxSizer(wx.HORIZONTAL) sizerMain.Add(sizerPosAndAxis, 0, wx.EXPAND) sizerPos = wx.BoxSizer(wx.VERTICAL) sizerPosAndAxis.Add(sizerPos, 0, wx.EXPAND) if axis_type == 0: sizerPos.Add(wx.StaticText(self, label='Position to Mirror About'), 0, wx.EXPAND | wx.ALL, control_border) else: self.btnPick = wx.Button(self, label='Select') self.AddLabelAndControl(sizerPos, 'Position to Mirror About', self.btnPick) self.posx = LengthCtrl(self) self.AddLabelAndControl(sizerPos, 'X', self.posx) self.posy = LengthCtrl(self) self.AddLabelAndControl(sizerPos, 'Y', self.posy) self.posz = LengthCtrl(self) self.AddLabelAndControl(sizerPos, 'Z', self.posz) if axis_type == 0: self.btnPick = wx.Button(self, label='Select') sizerPos.Add(self.btnPick, wx.EXPAND | wx.ALL, control_border) self.posx.SetValue(self.pos.x) self.posy.SetValue(self.pos.y) self.posz.SetValue(self.pos.z) if axis_type != 0: self.posx.Enable(axis_type == 1) self.posy.Enable(axis_type == 2) self.posz.Enable(axis_type == 3) if axis_type == 0: # non standard axis sizerAxis = wx.BoxSizer(wx.VERTICAL) sizerPosAndAxis.Add(sizerAxis, 0, wx.EXPAND) sizerAxis.Add(wx.StaticText(self, label='Axis to Mirror Through'), 0, wx.EXPAND | wx.ALL, control_border) self.vectorx = DoubleCtrl(self) self.AddLabelAndControl(sizerAxis, 'X', self.vectorx) self.vectory = DoubleCtrl(self) self.AddLabelAndControl(sizerAxis, 'Y', self.vectory) self.vectorz = DoubleCtrl(self) self.AddLabelAndControl(sizerAxis, 'Z', self.vectorz) self.btnVectorPick = wx.Button(self, label='Select Axis Point') sizerAxis.Add(self.btnVectorPick, 0, wx.EXPAND | wx.ALL, control_border) self.vectorx.SetValue(axis.x) self.vectory.SetValue(axis.y) self.vectorz.SetValue(axis.z) else: self.vectorx = None # add picture self.picture = PictureWindow(self, wx.Size(150, 100)) pictureSizer = wx.BoxSizer(wx.HORIZONTAL) pictureSizer.Add(self.picture, 1, wx.EXPAND) sizerMain.Add(pictureSizer, 0, wx.ALL, control_border) sizerPlane = wx.BoxSizer(wx.VERTICAL) pictureSizer.Add(sizerPlane, 0, wx.EXPAND) self.rbH = wx.RadioButton(self, label='Horizontal', style=wx.RB_GROUP) self.rbV = wx.RadioButton(self, label='Vertical') self.rbZ = wx.RadioButton(self, label='Z') self.rbOther = wx.RadioButton(self, label='Other') sizerPlane.Add(self.rbH, 0, wx.ALL, control_border) sizerPlane.Add(self.rbV, 0, wx.ALL, control_border) sizerPlane.Add(self.rbZ, 0, wx.ALL, control_border) sizerPlane.Add(self.rbOther, 0, wx.ALL, control_border) self.rbH.SetValue(axis_type == 1) self.rbV.SetValue(axis_type == 2) self.rbZ.SetValue(axis_type == 3) self.rbOther.SetValue(axis_type == 0) self.MakeOkAndCancel(wx.HORIZONTAL).AddToSizer(sizerMain) self.SetPicture() self.SetSizer(sizerMain) sizerMain.SetSizeHints(self) sizerMain.Fit(self) self.chkCopy.SetFocus() self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton, self.rbH) self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton, self.rbV) self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton, self.rbZ) self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton, self.rbOther) if self.btnPick: self.Bind(wx.EVT_BUTTON, self.OnPick, self.btnPick) if self.btnVectorPick: self.Bind(wx.EVT_BUTTON, self.OnPickVector, self.btnVectorPick) self.ignore_event_functions = False def OnPick(self, event): self.EndModal(self.btnPick.GetId()) def OnPickVector(self, event): self.EndModal(self.btnVectorPick.GetId()) def OnRadioButton(self, event): if self.ignore_event_functions: return if event.GetId() == self.rbH.GetId() or event.GetId( ) == self.rbV.GetId() or event.GetId() == self.rbZ.GetId(): if self.axis_type == 0: self.EndModal(event.GetId()) if event.GetId() == self.rbOther.GetId() and self.axis_type != 0: self.EndModal(event.GetId()) self.SetPicture() def SetPictureByName(self, name): self.picture.SetPicture(wx.GetApp().cad_dir + '/bitmaps/mirror/' + name + '.png') def SetPicture(self): if self.rbH.GetValue(): self.SetPictureByName('horiz') elif self.rbV.GetValue(): self.SetPictureByName('vert') elif self.rbZ.GetValue(): self.SetPictureByName('z') elif self.rbOther.GetValue(): self.SetPictureByName('other') def GetAllValues(self): if self.rbH.GetValue(): axis = geom.Point3D(1, 0, 0) axis_type = 1 elif self.rbV.GetValue(): axis = geom.Point3D(0, 1, 0) axis_type = 2 elif self.rbZ.GetValue(): axis = geom.Point3D(0, 0, 1) axis_type = 3 else: if self.vectorx == None: axis = self.axis else: axis = geom.Point3D(self.vectorx.GetValue(), self.vectory.GetValue(), self.vectorz.GetValue()) axis_type = 0 pos = geom.Point3D(self.posx.GetValue(), self.posy.GetValue(), self.posz.GetValue()) copy = self.chkCopy.GetValue() return axis, pos, axis_type, copy