def __init__(self, toolInfo, speedInfo, parent): CNCObject.__init__(self, parent, "carve:hatch") self.toolInfo = toolInfo self.modified = False self.unsaved = False self.viewTitle = "Cross Hatch Pattern %d" % GridPanel.seqNo self.titleText = "G Code Generator: %s" % self.viewTitle GridPanel.seqNo += 1 wx.Panel.__init__(self, parent, wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.Bind(wx.EVT_CLOSE, self.onClose) sizer = wx.GridBagSizer(wx.HORIZONTAL) sizer.Add(10, 10, wx.GBPosition(0, 4)) ln = 1 self.setTitleFlag() t = wx.StaticText(self, wx.ID_ANY, "Total X Size") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teSizeX = wx.TextCtrl(self, wx.ID_ANY, "100", style=wx.TE_RIGHT) self.addWidget(self.teSizeX, "sizex") sizer.Add(self.teSizeX, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Total Y Size") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teSizeY = wx.TextCtrl(self, wx.ID_ANY, "100", style=wx.TE_RIGHT) self.addWidget(self.teSizeY, "sizey") sizer.Add(self.teSizeY, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Perpendicular Gap") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teGap = wx.TextCtrl(self, wx.ID_ANY, "10", style=wx.TE_RIGHT) self.addWidget(self.teGap, "gap") sizer.Add(self.teGap, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Tool Diameter") td = "%6.3f" % toolInfo["diameter"] sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teToolDiam = wx.TextCtrl(self, wx.ID_ANY, td, style=wx.TE_RIGHT) self.addWidget(self.teToolDiam, "tooldiam") sizer.Add(self.teToolDiam, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Angle") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teAngle = wx.TextCtrl(self, wx.ID_ANY, "45", style=wx.TE_RIGHT) self.addWidget(self.teAngle, "angle") sizer.Add(self.teAngle, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Y Offset") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teYOffset = wx.TextCtrl(self, wx.ID_ANY, "0", style=wx.TE_RIGHT) self.addWidget(self.teYOffset, "yoffset") sizer.Add(self.teYOffset, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Total Depth") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teTotalDepth = wx.TextCtrl(self, wx.ID_ANY, "1", style=wx.TE_RIGHT) self.addWidget(self.teTotalDepth, "depth") sizer.Add(self.teTotalDepth, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Depth/Pass") dpp = "%6.3f" % speedInfo["depthperpass"] sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.tePassDepth = wx.TextCtrl(self, wx.ID_ANY, dpp, style=wx.TE_RIGHT) self.addWidget(self.tePassDepth, "passdepth") sizer.Add(self.tePassDepth, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Start X") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teStartX = wx.TextCtrl(self, wx.ID_ANY, "0", style=wx.TE_RIGHT) self.addWidget(self.teStartX, "startx") sizer.Add(self.teStartX, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Start Y") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teStartY = wx.TextCtrl(self, wx.ID_ANY, "0", style=wx.TE_RIGHT) self.addWidget(self.teStartY, "starty") sizer.Add(self.teStartY, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Start Z") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teStartZ = wx.TextCtrl(self, wx.ID_ANY, "0", style=wx.TE_RIGHT) self.addWidget(self.teStartZ, "startz") sizer.Add(self.teStartZ, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Safe Z above surface") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teSafeZ = wx.TextCtrl(self, wx.ID_ANY, "0.5", style=wx.TE_RIGHT) self.addWidget(self.teSafeZ, "safez") sizer.Add(self.teSafeZ, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 self.cbAddSpeed = wx.CheckBox(self, wx.ID_ANY, "Add Speed Parameter") self.addWidget(self.cbAddSpeed, "addspeed") sizer.Add(self.cbAddSpeed, pos=(ln, 0), span=(1, 4), flag=wx.TOP + wx.BOTTOM + wx.ALIGN_CENTER_HORIZONTAL, border=5) self.Bind(wx.EVT_CHECKBOX, self.onCbAddSpeed, self.cbAddSpeed) self.cbAddSpeed.SetValue(self.settings.addspeed) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Feed Rate XY (G0)") g0xy = "%7.2f" % speedInfo["G0XY"] sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teFeedXYG0 = wx.TextCtrl(self, wx.ID_ANY, g0xy, style=wx.TE_RIGHT) self.addWidget(self.teFeedXYG0, "feedXYG0") sizer.Add(self.teFeedXYG0, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Feed Rate XY (G1)") g1xy = "%7.2f" % speedInfo["G1XY"] sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teFeedXYG1 = wx.TextCtrl(self, wx.ID_ANY, g1xy, style=wx.TE_RIGHT) self.addWidget(self.teFeedXYG1, "feedXYG1") sizer.Add(self.teFeedXYG1, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Feed Rate Z (G0)") g0z = "%7.2f" % speedInfo["G0Z"] sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teFeedZG0 = wx.TextCtrl(self, wx.ID_ANY, g0z, style=wx.TE_RIGHT) self.addWidget(self.teFeedZG0, "feedZG0") sizer.Add(self.teFeedZG0, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Feed Rate Z (G1)") g1z = "%7.2f" % speedInfo["G1Z"] sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teFeedZG1 = wx.TextCtrl(self, wx.ID_ANY, g1z, style=wx.TE_RIGHT) self.addWidget(self.teFeedZG1, "feedZG1") sizer.Add(self.teFeedZG1, pos=(ln, 3), flag=wx.LEFT, border=10) self.teFeedXYG0.Enable(self.settings.addspeed) self.teFeedXYG1.Enable(self.settings.addspeed) self.teFeedZG0.Enable(self.settings.addspeed) self.teFeedZG1.Enable(self.settings.addspeed) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Starting Point") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) sizer.Add(self.getStartingPoints(), pos=(ln, 1), border=5, flag=wx.TOP + wx.BOTTOM + wx.ALIGN_CENTER_VERTICAL) t = wx.StaticText(self, wx.ID_ANY, "Measurement System") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) sizer.Add(self.getMeasurementSystem(), pos=(ln, 3), border=5, flag=wx.TOP + wx.BOTTOM + wx.ALIGN_CENTER_VERTICAL) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Add Border") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.cbBorder = wx.CheckBox(self, wx.ID_ANY) self.addWidget(self.cbBorder, "border") self.Bind(wx.EVT_CHECKBOX, self.onChange, self.cbBorder) sizer.Add(self.cbBorder, pos=(ln, 1), flag=wx.LEFT + wx.RIGHT + wx.ALIGN_CENTER_VERTICAL, border=10) t = wx.StaticText(self, wx.ID_ANY, "Decimal Places") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teDecimals = wx.TextCtrl(self, wx.ID_ANY, "4", style=wx.TE_RIGHT) self.addWidget(self.teDecimals, "decimals") sizer.Add(self.teDecimals, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 sizer.Add(20, 20, wx.GBPosition(ln, 0)) ln += 1 bsz = self.buttons() sizer.Add(bsz, pos=(ln, 0), span=(1, 4), flag=wx.TOP + wx.BOTTOM + wx.ALIGN_CENTER_HORIZONTAL, border=5) ln += 1 sizer.Add(10, 10, wx.GBPosition(ln, 0)) ln += 1 self.gcl = GCodeList(self) sizer.Add(self.gcl, pos=(ln, 0), span=(1, 4), flag=wx.LEFT + wx.EXPAND, border=10) ln += 1 sizer.Add(10, 10, wx.GBPosition(ln, 0)) self.Bind(wx.EVT_TEXT, self.onChange) self.Bind(wx.EVT_RADIOBUTTON, self.onChange) self.SetSizer(sizer) self.Layout() self.Fit()
def __init__(self, toolInfo, speedInfo, parent): CNCObject.__init__(self, parent, "drill:circle") self.toolInfo = toolInfo self.modified = False self.unsaved = False self.viewTitle = "Circular Drill Pattern %d" % CirDrillPanel.seqNo self.titleText = "G Code Generator: %s" % self.viewTitle CirDrillPanel.seqNo += 1 wx.Panel.__init__(self, parent, wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.Bind(wx.EVT_CLOSE, self.onClose) sizer = wx.GridBagSizer(wx.HORIZONTAL) sizer.Add(10, 10, wx.GBPosition(0, 4)) ln = 1 self.setTitleFlag() t = wx.StaticText(self, wx.ID_ANY, "Diameter") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teDiameter = wx.TextCtrl(self, wx.ID_ANY, "10", style=wx.TE_RIGHT) self.addWidget(self.teDiameter, "diameter") sizer.Add(self.teDiameter, pos=(ln, 1), flag=wx.LEFT, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Tool Diameter") td = "%6.3f" % toolInfo["diameter"] sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teToolDiam = wx.TextCtrl(self, wx.ID_ANY, td, style=wx.TE_RIGHT) self.addWidget(self.teToolDiam, "tooldiameter") sizer.Add(self.teToolDiam, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Hole Diameter") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teHoleDiam = wx.TextCtrl(self, wx.ID_ANY, "3", style=wx.TE_RIGHT) self.addWidget(self.teHoleDiam, "holediameter") sizer.Add(self.teHoleDiam, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Stepover") so = "%6.3f" % speedInfo["stepover"] sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teStepover = wx.TextCtrl(self, wx.ID_ANY, so, style=wx.TE_RIGHT) self.addWidget(self.teStepover, "stepover") sizer.Add(self.teStepover, pos=(ln, 1), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=10) t = wx.StaticText(self, wx.ID_ANY, "Minimum space between") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teSpacing = wx.TextCtrl(self, wx.ID_ANY, "2", style=wx.TE_RIGHT) self.addWidget(self.teSpacing, "spacing") sizer.Add(self.teSpacing, pos=(ln, 3), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=10) ln += 1 szOpts = wx.BoxSizer(wx.VERTICAL) self.cbInside = wx.CheckBox(self, wx.ID_ANY, "Inside Circle") self.addWidget(self.cbInside, "inside") self.Bind(wx.EVT_CHECKBOX, self.onChange, self.cbInside) szOpts.Add(self.cbInside) szOpts.AddSpacer(10) self.cbStagger = wx.CheckBox(self, wx.ID_ANY, "Staggered rows") self.addWidget(self.cbStagger, "stagger") self.Bind(wx.EVT_CHECKBOX, self.onChange, self.cbStagger) szOpts.Add(self.cbStagger) szOpts2 = wx.BoxSizer(wx.HORIZONTAL) szOpts2.AddSpacer(80) szOpts2.Add(szOpts) sizer.Add(szOpts2, pos=(ln, 0), span=(1, 2), border=5, flag=wx.TOP+wx.BOTTOM+wx.LEFT+wx.ALIGN_CENTER_VERTICAL) t = wx.StaticText(self, wx.ID_ANY, "Cutting Direction") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) sizer.Add(self.getCuttingDirection(), pos=(ln, 3), border=5, flag=wx.TOP+wx.BOTTOM+wx.ALIGN_CENTER_VERTICAL) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Depth of Cut") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teDepth = wx.TextCtrl(self, wx.ID_ANY, "1", style=wx.TE_RIGHT) self.addWidget(self.teDepth, "depth") sizer.Add(self.teDepth, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Depth/Pass") dpp = "%6.3f" % speedInfo["depthperpass"] sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.tePassDepth = wx.TextCtrl(self, wx.ID_ANY, dpp, style=wx.TE_RIGHT) self.addWidget(self.tePassDepth, "passdepth") sizer.Add(self.tePassDepth, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 self.cbRetract = wx.CheckBox(self, wx.ID_ANY, "Retract each pass") self.addWidget(self.cbRetract, "retract") sizer.Add(self.cbRetract, pos=(ln, 2), span=(1,2), flag=wx.TOP+wx.BOTTOM+wx.ALIGN_CENTER_HORIZONTAL, border=5) self.Bind(wx.EVT_CHECKBOX, self.onChange, self.cbRetract) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Center X") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teStartX = wx.TextCtrl(self, wx.ID_ANY, "0", style=wx.TE_RIGHT) self.addWidget(self.teStartX, "centerx") sizer.Add(self.teStartX, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Center Y") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teStartY = wx.TextCtrl(self, wx.ID_ANY, "0", style=wx.TE_RIGHT) self.addWidget(self.teStartY, "centery") sizer.Add(self.teStartY, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Center Z") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teStartZ = wx.TextCtrl(self, wx.ID_ANY, "0", style=wx.TE_RIGHT) self.addWidget(self.teStartZ, "startz") sizer.Add(self.teStartZ, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Safe Z above surface") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teSafeZ = wx.TextCtrl(self, wx.ID_ANY, "0.5", style=wx.TE_RIGHT) self.addWidget(self.teSafeZ, "safez") sizer.Add(self.teSafeZ, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 self.cbAddSpeed = wx.CheckBox(self, wx.ID_ANY, "Add Speed Parameter") self.addWidget(self.cbAddSpeed, "addspeed") sizer.Add(self.cbAddSpeed, pos=(ln, 0), span=(1,4), flag=wx.TOP+wx.BOTTOM+wx.ALIGN_CENTER_HORIZONTAL, border=5) self.Bind(wx.EVT_CHECKBOX, self.onCbAddSpeed, self.cbAddSpeed) self.cbAddSpeed.SetValue(self.settings.addspeed) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Feed Rate XY (G0)") g0xy = "%7.2f" % speedInfo["G0XY"] sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teFeedXYG0 = wx.TextCtrl(self, wx.ID_ANY, g0xy, style=wx.TE_RIGHT) self.addWidget(self.teFeedXYG0, "feedXYG0") sizer.Add(self.teFeedXYG0, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Feed Rate XY (G1)") g1xy = "%7.2f" % speedInfo["G1XY"] sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teFeedXYG1 = wx.TextCtrl(self, wx.ID_ANY, g1xy, style=wx.TE_RIGHT) self.addWidget(self.teFeedXYG1, "feedXYG1") sizer.Add(self.teFeedXYG1, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Feed Rate Z (G0)") g0z = "%7.2f" % speedInfo["G0Z"] sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teFeedZG0 = wx.TextCtrl(self, wx.ID_ANY, g0z, style=wx.TE_RIGHT) self.addWidget(self.teFeedZG0, "feedZG0") sizer.Add(self.teFeedZG0, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Feed Rate Z (G1)") g1z = "%7.2f" % speedInfo["G1Z"] sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teFeedZG1 = wx.TextCtrl(self, wx.ID_ANY, g1z, style=wx.TE_RIGHT) self.addWidget(self.teFeedZG1, "feedZG1") sizer.Add(self.teFeedZG1, pos=(ln, 3), flag=wx.LEFT, border=10) self.teFeedXYG0.Enable(self.settings.addspeed) self.teFeedXYG1.Enable(self.settings.addspeed) self.teFeedZG0.Enable(self.settings.addspeed) self.teFeedZG1.Enable(self.settings.addspeed) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Decimal Places") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teDecimals = wx.TextCtrl(self, wx.ID_ANY, "4", style=wx.TE_RIGHT) self.addWidget(self.teDecimals, "decimals") sizer.Add(self.teDecimals, pos=(ln, 1), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=10) t = wx.StaticText(self, wx.ID_ANY, "Measurement System") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) sizer.Add(self.getMeasurementSystem(), pos=(ln, 3), border=5, flag=wx.TOP+wx.BOTTOM+wx.ALIGN_CENTER_VERTICAL) ln += 1 sizer.Add(20, 20, wx.GBPosition(ln, 0)) ln += 1 bsz = self.buttons() sizer.Add(bsz, pos=(ln, 0), span=(1,4), flag=wx.TOP+wx.BOTTOM+wx.ALIGN_CENTER_HORIZONTAL, border=5) ln += 1 sizer.Add(10, 10, wx.GBPosition(ln, 0)) ln += 1 self.gcl = GCodeList(self) sizer.Add(self.gcl, pos=(ln, 0), span=(1, 4), flag=wx.LEFT+wx.EXPAND, border=10) ln += 1 sizer.Add(10, 10, wx.GBPosition(ln, 0)) self.Bind(wx.EVT_TEXT, self.onChange) self.Bind(wx.EVT_RADIOBUTTON, self.onChange) self.SetSizer(sizer) self.Layout() self.Fit();
def xcheckEnable(self): print("instance") CNCObject.checkEnable(self)
def __init__(self, toolInfo, speedInfo, parent): CNCObject.__init__(self, parent, "contour:polygon") self.toolInfo = toolInfo self.modified = False self.unsaved = False self.viewTitle = "Regular Polygon %d" % PolyPanel.seqNo self.titleText = "G Code Generator: %s" % self.viewTitle PolyPanel.seqNo += 1 wx.Panel.__init__(self, parent, wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.Bind(wx.EVT_CLOSE, self.onClose) sizer = wx.GridBagSizer(wx.HORIZONTAL) sizer.Add(10, 10, wx.GBPosition(0, 4)) ln = 1 self.setTitleFlag() t = wx.StaticText(self, wx.ID_ANY, "Side length") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teSLength = wx.TextCtrl(self, wx.ID_ANY, "10", style=wx.TE_RIGHT) self.addWidget(self.teSLength, "sidelength") sizer.Add(self.teSLength, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Number of Sides") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teSides = wx.TextCtrl(self, wx.ID_ANY, "6", style=wx.TE_RIGHT) self.addWidget(self.teSides, "numbersides") sizer.Add(self.teSides, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Rotation Angle") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teAngle = wx.TextCtrl(self, wx.ID_ANY, "0", style=wx.TE_RIGHT) self.addWidget(self.teAngle, "angle") sizer.Add(self.teAngle, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Tool Diameter") td = "%6.3f" % toolInfo["diameter"] sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teToolDiam = wx.TextCtrl(self, wx.ID_ANY, td, style=wx.TE_RIGHT) self.addWidget(self.teToolDiam, "tooldiameter") sizer.Add(self.teToolDiam, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Total Depth") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teTotalDepth = wx.TextCtrl(self, wx.ID_ANY, "1", style=wx.TE_RIGHT) self.addWidget(self.teTotalDepth, "depth") sizer.Add(self.teTotalDepth, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Depth/Pass") dpp = "%6.3f" % speedInfo["depthperpass"] sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.tePassDepth = wx.TextCtrl(self, wx.ID_ANY, dpp, style=wx.TE_RIGHT) self.addWidget(self.tePassDepth, "passdepth") sizer.Add(self.tePassDepth, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Center X") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teStartX = wx.TextCtrl(self, wx.ID_ANY, "0", style=wx.TE_RIGHT) self.addWidget(self.teStartX, "centerx") sizer.Add(self.teStartX, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Center Y") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teStartY = wx.TextCtrl(self, wx.ID_ANY, "0", style=wx.TE_RIGHT) self.addWidget(self.teStartY, "centery") sizer.Add(self.teStartY, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Center Z") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teStartZ = wx.TextCtrl(self, wx.ID_ANY, "0", style=wx.TE_RIGHT) self.addWidget(self.teStartZ, "centerz") sizer.Add(self.teStartZ, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Safe Z above surface") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teSafeZ = wx.TextCtrl(self, wx.ID_ANY, "0.5", style=wx.TE_RIGHT) self.addWidget(self.teSafeZ, "safez") sizer.Add(self.teSafeZ, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 self.cbAddSpeed = wx.CheckBox(self, wx.ID_ANY, "Add Speed Parameter") self.addWidget(self.cbAddSpeed, "addspeed") sizer.Add(self.cbAddSpeed, pos=(ln, 0), span=(1, 4), flag=wx.TOP + wx.BOTTOM + wx.ALIGN_CENTER_HORIZONTAL, border=5) self.Bind(wx.EVT_CHECKBOX, self.onCbAddSpeed, self.cbAddSpeed) self.cbAddSpeed.SetValue(self.settings.addspeed) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Feed Rate XY (G0)") g0xy = "%7.2f" % speedInfo["G0XY"] sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teFeedXYG0 = wx.TextCtrl(self, wx.ID_ANY, g0xy, style=wx.TE_RIGHT) self.addWidget(self.teFeedXYG0, "feedXYG0") sizer.Add(self.teFeedXYG0, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Feed Rate XY (G1)") g1xy = "%7.2f" % speedInfo["G1XY"] sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teFeedXYG1 = wx.TextCtrl(self, wx.ID_ANY, g1xy, style=wx.TE_RIGHT) self.addWidget(self.teFeedXYG1, "feedXYG1") sizer.Add(self.teFeedXYG1, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Feed Rate Z (G0)") g0z = "%7.2f" % speedInfo["G0Z"] sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teFeedZG0 = wx.TextCtrl(self, wx.ID_ANY, g0z, style=wx.TE_RIGHT) self.addWidget(self.teFeedZG0, "feedZG0") sizer.Add(self.teFeedZG0, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Feed Rate Z (G1)") g1z = "%7.2f" % speedInfo["G1Z"] sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teFeedZG1 = wx.TextCtrl(self, wx.ID_ANY, g1z, style=wx.TE_RIGHT) self.addWidget(self.teFeedZG1, "feedZG1") sizer.Add(self.teFeedZG1, pos=(ln, 3), flag=wx.LEFT, border=10) self.teFeedXYG0.Enable(self.settings.addspeed) self.teFeedXYG1.Enable(self.settings.addspeed) self.teFeedZG0.Enable(self.settings.addspeed) self.teFeedZG1.Enable(self.settings.addspeed) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Cutting Direction") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) sizer.Add(self.getCuttingDirection(), pos=(ln, 1), border=5, flag=wx.TOP + wx.BOTTOM + wx.ALIGN_CENTER_VERTICAL) t = wx.StaticText(self, wx.ID_ANY, "Tool Movement") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) sizer.Add(self.getToolMovement(), pos=(ln, 3), border=5, flag=wx.TOP + wx.BOTTOM + wx.ALIGN_CENTER_VERTICAL) ln += 1 self.cbPocket = wx.CheckBox(self, wx.ID_ANY, "Pocket") self.addWidget(self.cbPocket, "pocket") sizer.Add(self.cbPocket, pos=(ln, 0), span=(1, 2), flag=wx.TOP + wx.BOTTOM + wx.ALIGN_CENTER_HORIZONTAL, border=5) self.Bind(wx.EVT_CHECKBOX, self.onChange, self.cbPocket) t = wx.StaticText(self, wx.ID_ANY, "Stepover") so = "%6.3f" % speedInfo["stepover"] sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teStepOver = wx.TextCtrl(self, wx.ID_ANY, so, style=wx.TE_RIGHT) self.addWidget(self.teStepOver, "stepover") sizer.Add(self.teStepOver, pos=(ln, 3), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Measurement System") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) sizer.Add(self.getMeasurementSystem(), pos=(ln, 1), border=5, flag=wx.TOP + wx.BOTTOM + wx.ALIGN_CENTER_VERTICAL) t = wx.StaticText(self, wx.ID_ANY, "Decimal Places") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT + wx.ALIGN_CENTER_VERTICAL, border=20) self.teDecimals = wx.TextCtrl(self, wx.ID_ANY, "4", style=wx.TE_RIGHT) self.addWidget(self.teDecimals, "decimals") sizer.Add(self.teDecimals, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 sizer.Add(20, 20, wx.GBPosition(ln, 0)) ln += 1 bsz = self.buttons() sizer.Add(bsz, pos=(ln, 0), span=(1, 4), flag=wx.TOP + wx.BOTTOM + wx.ALIGN_CENTER_HORIZONTAL, border=5) ln += 1 sizer.Add(10, 10, wx.GBPosition(ln, 0)) ln += 1 self.gcl = GCodeList(self) sizer.Add(self.gcl, pos=(ln, 0), span=(1, 4), flag=wx.LEFT + wx.EXPAND, border=10) ln += 1 sizer.Add(10, 10, wx.GBPosition(ln, 0)) self.Bind(wx.EVT_TEXT, self.onChange) self.Bind(wx.EVT_RADIOBUTTON, self.onChange) self.SetSizer(sizer) self.Layout() self.Fit()
def __init__(self, toolInfo, speedInfo, parent): CNCObject.__init__(self, parent, "contour:polyline") self.toolInfo = toolInfo self.modified = False self.unsaved = False self.viewTitle = "Polyline %d" % PolyPanel.seqNo self.titleText = "G Code Generator: %s" % self.viewTitle PolyPanel.seqNo += 1 wx.Panel.__init__(self, parent, wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.Bind(wx.EVT_CLOSE, self.onClose) sizer = wx.GridBagSizer(wx.HORIZONTAL) sizer.Add(10, 10, wx.GBPosition(0, 4)) ln = 1 self.setTitleFlag() t = wx.StaticText(self, wx.ID_ANY, "Point List") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.tePoints = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_RIGHT + wx.TE_READONLY) self.addWidget(self.tePoints, "pointlist") sizer.Add(self.tePoints, pos=(ln, 1), span=(1,2), flag=wx.EXPAND, border=10) self.bEditPoints = wx.Button(self, wx.ID_ANY, "...", size=(30, 20)) self.bEditPoints.SetToolTip("Edit Point List") bsz = wx.BoxSizer(wx.HORIZONTAL) bsz.AddSpacer(20) bsz.Add(self.bEditPoints) sizer.Add(bsz, pos=(ln, 3)) self.Bind(wx.EVT_BUTTON, self.bEditPointsPressed, self.bEditPoints) ln += 1 self.cbClosePath = wx.CheckBox(self, wx.ID_ANY, "Close Path") self.addWidget(self.cbClosePath, "closepath") sizer.Add(self.cbClosePath, pos=(ln, 0), span=(1,4), flag=wx.TOP+wx.BOTTOM+wx.ALIGN_CENTER_HORIZONTAL, border=5) self.Bind(wx.EVT_CHECKBOX, self.onChange, self.cbClosePath) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Start Z") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teStartZ = wx.TextCtrl(self, wx.ID_ANY, "0", style=wx.TE_RIGHT) self.addWidget(self.teStartZ, "startz") sizer.Add(self.teStartZ, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Safe Z above surface") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teSafeZ = wx.TextCtrl(self, wx.ID_ANY, "0.5", style=wx.TE_RIGHT) self.addWidget(self.teSafeZ, "safez") sizer.Add(self.teSafeZ, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Total Depth") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teTotalDepth = wx.TextCtrl(self, wx.ID_ANY, "1", style=wx.TE_RIGHT) self.addWidget(self.teTotalDepth, "totaldepth") sizer.Add(self.teTotalDepth, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Depth/Pass") dpp = "%6.3f" % speedInfo["depthperpass"] sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.tePassDepth = wx.TextCtrl(self, wx.ID_ANY, dpp, style=wx.TE_RIGHT) self.addWidget(self.tePassDepth, "passdepth") sizer.Add(self.tePassDepth, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 self.cbAddSpeed = wx.CheckBox(self, wx.ID_ANY, "Add Speed Parameter") self.addWidget(self.cbAddSpeed, "addspeed") sizer.Add(self.cbAddSpeed, pos=(ln, 0), span=(1,4), flag=wx.TOP+wx.BOTTOM+wx.ALIGN_CENTER_HORIZONTAL, border=5) self.Bind(wx.EVT_CHECKBOX, self.onCbAddSpeed, self.cbAddSpeed) self.cbAddSpeed.SetValue(self.settings.addspeed) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Feed Rate XY (G0)") g0xy = "%7.2f" % speedInfo["G0XY"] sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teFeedXYG0 = wx.TextCtrl(self, wx.ID_ANY, g0xy, style=wx.TE_RIGHT) self.addWidget(self.teFeedXYG0, "feedXYG0") sizer.Add(self.teFeedXYG0, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Feed Rate XY (G1)") g1xy = "%7.2f" % speedInfo["G1XY"] sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teFeedXYG1 = wx.TextCtrl(self, wx.ID_ANY, g1xy, style=wx.TE_RIGHT) self.addWidget(self.teFeedXYG1, "feedXYG1") sizer.Add(self.teFeedXYG1, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Feed Rate Z (G0)") g0z = "%7.2f" % speedInfo["G0Z"] sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teFeedZG0 = wx.TextCtrl(self, wx.ID_ANY, g0z, style=wx.TE_RIGHT) self.addWidget(self.teFeedZG0, "feedZG0") sizer.Add(self.teFeedZG0, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Feed Rate Z (G1)") g1z = "%7.2f" % speedInfo["G1Z"] sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teFeedZG1 = wx.TextCtrl(self, wx.ID_ANY, g1z, style=wx.TE_RIGHT) self.addWidget(self.teFeedZG1, "feedZG1") sizer.Add(self.teFeedZG1, pos=(ln, 3), flag=wx.LEFT, border=10) self.teFeedXYG0.Enable(self.settings.addspeed) self.teFeedXYG1.Enable(self.settings.addspeed) self.teFeedZG0.Enable(self.settings.addspeed) self.teFeedZG1.Enable(self.settings.addspeed) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Tool Movement") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) sizer.Add(self.getToolMovement(), pos=(ln, 1), border=5, flag=wx.TOP+wx.BOTTOM+wx.ALIGN_CENTER_VERTICAL) t = wx.StaticText(self, wx.ID_ANY, "Tracks") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.scTracks = wx.SpinCtrl(self, wx.ID_ANY, "", size=(50, -1), style=wx.ALIGN_RIGHT) self.addWidget(self.scTracks, "tracks") self.scTracks.SetRange(1,20) self.scTracks.SetValue(1) self.Bind(wx.EVT_SPINCTRL, self.onTracks, self.scTracks) sz = wx.BoxSizer(wx.HORIZONTAL) sz.AddSpacer(30) sz.Add(self.scTracks) sizer.Add(sz, pos=(ln, 3), border=5, flag=wx.LEFT+wx.TOP+wx.BOTTOM+wx.ALIGN_CENTER_VERTICAL) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Tool Diameter") td = "%6.3f" % toolInfo["diameter"] sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teToolDiam = wx.TextCtrl(self, wx.ID_ANY, td, style=wx.TE_RIGHT) self.addWidget(self.teToolDiam, "tooldiameter") sizer.Add(self.teToolDiam, pos=(ln, 1), flag=wx.LEFT, border=10) t = wx.StaticText(self, wx.ID_ANY, "Stepover") so = "%6.3f" % speedInfo["stepover"] sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teStepOver = wx.TextCtrl(self, wx.ID_ANY, so, style=wx.TE_RIGHT) self.addWidget(self.teStepOver, "stepover") sizer.Add(self.teStepOver, pos=(ln, 3), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=10) ln += 1 t = wx.StaticText(self, wx.ID_ANY, "Measurement System") sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) sizer.Add(self.getMeasurementSystem(), pos=(ln, 1), border=5, flag=wx.TOP+wx.BOTTOM+wx.ALIGN_CENTER_VERTICAL) t = wx.StaticText(self, wx.ID_ANY, "Decimal Places") sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20) self.teDecimals = wx.TextCtrl(self, wx.ID_ANY, "4", style=wx.TE_RIGHT) self.addWidget(self.teDecimals, "decimals") sizer.Add(self.teDecimals, pos=(ln, 3), flag=wx.LEFT, border=10) ln += 1 sizer.Add(20, 20, wx.GBPosition(ln, 0)) ln += 1 bsz = self.buttons() sizer.Add(bsz, pos=(ln, 0), span=(1,4), flag=wx.TOP+wx.BOTTOM+wx.ALIGN_CENTER_HORIZONTAL, border=5) ln += 1 sizer.Add(10, 10, wx.GBPosition(ln, 0)) ln += 1 self.gcl = GCodeList(self) sizer.Add(self.gcl, pos=(ln, 0), span=(1, 4), flag=wx.LEFT+wx.EXPAND, border=10) ln += 1 sizer.Add(10, 10, wx.GBPosition(ln, 0)) self.Bind(wx.EVT_TEXT, self.onChange) self.Bind(wx.EVT_RADIOBUTTON, self.onChange) self.SetSizer(sizer) self.Layout() self.Fit();