示例#1
0
    def __init__(self, master, app):
        CNCRibbon.PageFrame.__init__(self, master, "ProbeCommon", app)

        lframe = tkExtra.ExLabelFrame(self,
                                      text="Common",
                                      foreground="DarkBlue")
        lframe.pack(side=TOP, fill=X)
        frame = lframe.frame

        # ----
        row = 0
        col = 0

        Label(frame, text=_("Probe Feed:")).grid(row=row, column=col, sticky=E)
        col += 1
        ProbeCommonFrame.probeFeed = tkExtra.FloatEntry(frame,
                                                        background="White",
                                                        width=5)
        ProbeCommonFrame.probeFeed.grid(row=row, column=col, sticky=EW)
        tkExtra.Balloon.set(ProbeCommonFrame.probeFeed,
                            _("Set probe feed rate"))
        self.addWidget(ProbeCommonFrame.probeFeed)

        # ----
        # Tool offset
        row += 1
        col = 0
        Label(frame, text=_("TLO")).grid(row=row, column=col, sticky=E)
        col += 1
        ProbeCommonFrame.tlo = tkExtra.FloatEntry(frame, background="White")
        ProbeCommonFrame.tlo.grid(row=row, column=col, sticky=EW)
        tkExtra.Balloon.set(ProbeCommonFrame.tlo,
                            _("Set tool offset for probing"))
        self.addWidget(ProbeCommonFrame.tlo)
        self.tlo.bind("<Return>", self.tloSet)
        self.tlo.bind("<KP_Enter>", self.tloSet)

        col += 1
        b = Button(frame, text=_("set"), command=self.tloSet, padx=2, pady=1)
        b.grid(row=row, column=col, sticky=EW)
        self.addWidget(b)

        # ---
        # feed command
        row += 1
        col = 0
        Label(frame, text=_("Probe Command")).grid(row=row,
                                                   column=col,
                                                   sticky=E)
        col += 1
        ProbeCommonFrame.probeCmd = tkExtra.Combobox(frame,
                                                     True,
                                                     background="White",
                                                     width=16)
        ProbeCommonFrame.probeCmd.grid(row=row, column=col, sticky=EW)
        ProbeCommonFrame.probeCmd.fill(PROBE_CMD)
        self.addWidget(ProbeCommonFrame.probeCmd)

        frame.grid_columnconfigure(1, weight=1)
        self.loadConfig()
示例#2
0
	def __init__(self, master, app):
		CNCRibbon.PageFrame.__init__(self, master, "Probe:Probe", app)

		#----------------------------------------------------------------
		# Single probe
		#----------------------------------------------------------------
		lframe = tkExtra.ExLabelFrame(self, text=_("Probe"), foreground="DarkBlue")
		lframe.pack(side=TOP, fill=X)

		row,col = 0,0
		Label(lframe(), text=_("Probe:")).grid(row=row, column=col, sticky=E)

		col += 1
		self._probeX = Label(lframe(), foreground="DarkBlue", background="gray90")
		self._probeX.grid(row=row, column=col, padx=1, sticky=EW+S)

		col += 1
		self._probeY = Label(lframe(), foreground="DarkBlue", background="gray90")
		self._probeY.grid(row=row, column=col, padx=1, sticky=EW+S)

		col += 1
		self._probeZ = Label(lframe(), foreground="DarkBlue", background="gray90")
		self._probeZ.grid(row=row, column=col, padx=1, sticky=EW+S)

		# ---
		col += 1
		b = Button(lframe(), #"<<Probe>>",
				image=Utils.icons["probe32"],
				text=_("Probe"),
				compound=TOP,
				command=self.probe)
		b.grid(row=row, column=col, rowspan=2, padx=1, sticky=EW+S)
		self.addWidget(b)
		tkExtra.Balloon.set(b, _("Perform a single probe cycle"))

		# ---
		row,col = row+1,0
		Label(lframe(), text=_("Pos:")).grid(row=row, column=col, sticky=E)

		col += 1
		self.probeXdir = tkExtra.FloatEntry(lframe(), background="White")
		self.probeXdir.grid(row=row, column=col, sticky=EW+S)
		tkExtra.Balloon.set(self.probeXdir, _("Probe along X direction"))
		self.addWidget(self.probeXdir)

		col += 1
		self.probeYdir = tkExtra.FloatEntry(lframe(), background="White")
		self.probeYdir.grid(row=row, column=col, sticky=EW+S)
		tkExtra.Balloon.set(self.probeYdir, _("Probe along Y direction"))
		self.addWidget(self.probeYdir)

		col += 1
		self.probeZdir = tkExtra.FloatEntry(lframe(), background="White")
		self.probeZdir.grid(row=row, column=col, sticky=EW+S)
		tkExtra.Balloon.set(self.probeZdir, _("Probe along Z direction"))
		self.addWidget(self.probeZdir)

		lframe().grid_columnconfigure(1,weight=1)
		lframe().grid_columnconfigure(2,weight=1)
		lframe().grid_columnconfigure(3,weight=1)

		#----------------------------------------------------------------
		# Center probing
		#----------------------------------------------------------------
		lframe = tkExtra.ExLabelFrame(self, text=_("Center"), foreground="DarkBlue")
		lframe.pack(side=TOP, expand=YES, fill=X)

		Label(lframe(), text=_("Diameter:")).pack(side=LEFT)
		self.diameter = tkExtra.FloatEntry(lframe(), background="White")
		self.diameter.pack(side=LEFT, expand=YES, fill=X)
		tkExtra.Balloon.set(self.diameter, _("Probing ring internal diameter"))
		self.addWidget(self.diameter)

		# ---
		b = Button(lframe(),
				image=Utils.icons["target32"],
				text=_("Center"),
				compound=TOP,
				command=self.probeCenter)
		b.pack(side=RIGHT)
		self.addWidget(b)
		tkExtra.Balloon.set(b, _("Center probing using a ring"))

		#----------------------------------------------------------------
		# Align / Orient / Square ?
		#----------------------------------------------------------------
		lframe = tkExtra.ExLabelFrame(self, text=_("Orient"), foreground="DarkBlue")
		lframe.pack(side=TOP, expand=YES, fill=X)

		# ---
		row, col = 0,0

		Label(lframe(), text=_("Markers:")).grid(row=row, column=col, sticky=E)
		col += 1

		self.scale_orient = Scale(lframe(),
					from_=0, to_=0,
					orient=HORIZONTAL,
					showvalue=1,
					state=DISABLED,
					command=self.changeMarker)
		self.scale_orient.grid(row=row, column=col, columnspan=2, sticky=EW)
		tkExtra.Balloon.set(self.scale_orient, _("Select orientation marker"))

		# Add new point
		col += 2
		b = Button(lframe(), text=_("Add"),
				image=Utils.icons["add"],
				compound=LEFT,
				command=lambda s=self: s.event_generate("<<AddMarker>>"),
				padx = 1,
				pady = 1)
		b.grid(row=row, column=col, sticky=NSEW)
		self.addWidget(b)
		tkExtra.Balloon.set(b, _("Add an orientation marker. " \
				"Jog first the machine to the marker position " \
				"and then click on canvas to add the marker."))

		# ----
		row += 1
		col = 0
		Label(lframe(), text="Gcode:").grid(row=row, column=col, sticky=E)
		col += 1
		self.x_orient = tkExtra.FloatEntry(lframe(), background="White")
		self.x_orient.grid(row=row, column=col, sticky=EW)
		self.x_orient.bind("<FocusOut>", self.orientUpdate)
		self.x_orient.bind("<Return>",   self.orientUpdate)
		self.x_orient.bind("<KP_Enter>", self.orientUpdate)
		tkExtra.Balloon.set(self.x_orient, _("GCode X coordinate of orientation point"))

		col += 1
		self.y_orient = tkExtra.FloatEntry(lframe(), background="White")
		self.y_orient.grid(row=row, column=col, sticky=EW)
		self.y_orient.bind("<FocusOut>", self.orientUpdate)
		self.y_orient.bind("<Return>",   self.orientUpdate)
		self.y_orient.bind("<KP_Enter>", self.orientUpdate)
		tkExtra.Balloon.set(self.y_orient, _("GCode Y coordinate of orientation point"))

		# Buttons
		col += 1
		b = Button(lframe(), text=_("Delete"),
				image=Utils.icons["x"],
				compound=LEFT,
				command = self.orientDelete,
				padx = 1,
				pady = 1)
		b.grid(row=row, column=col, sticky=EW)
		self.addWidget(b)
		tkExtra.Balloon.set(b, _("Delete current marker"))

		# ---
		row += 1
		col = 0

		Label(lframe(), text="WPos:").grid(row=row, column=col, sticky=E)
		col += 1
		self.xm_orient = tkExtra.FloatEntry(lframe(), background="White")
		self.xm_orient.grid(row=row, column=col, sticky=EW)
		self.xm_orient.bind("<FocusOut>", self.orientUpdate)
		self.xm_orient.bind("<Return>",   self.orientUpdate)
		self.xm_orient.bind("<KP_Enter>", self.orientUpdate)
		tkExtra.Balloon.set(self.xm_orient, _("Machine X coordinate of orientation point"))

		col += 1
		self.ym_orient = tkExtra.FloatEntry(lframe(), background="White")
		self.ym_orient.grid(row=row, column=col, sticky=EW)
		self.ym_orient.bind("<FocusOut>", self.orientUpdate)
		self.ym_orient.bind("<Return>",   self.orientUpdate)
		self.ym_orient.bind("<KP_Enter>", self.orientUpdate)
		tkExtra.Balloon.set(self.ym_orient, _("Machine Y coordinate of orientation point"))

		# Buttons
		col += 1
		b = Button(lframe(), text=_("Clear"),
				image=Utils.icons["clear"],
				compound=LEFT,
				command = self.orientClear,
				padx = 1,
				pady = 1)
		b.grid(row=row, column=col, sticky=EW)
		self.addWidget(b)
		tkExtra.Balloon.set(b, _("Delete all markers"))

		# ---
		row += 1
		col = 0
		Label(lframe(), text=_("Angle:")).grid(row=row, column=col, sticky=E)

		col += 1
		self.angle_orient = Label(lframe(), foreground="DarkBlue", background="gray90", anchor=W)
		self.angle_orient.grid(row=row, column=col, columnspan=2, sticky=EW, padx=1, pady=1)

		# Buttons
		col += 2
		b = Button(lframe(), text=_("Orient"),
				image=Utils.icons["setsquare32"],
				compound=TOP,
				command = lambda a=app:a.insertCommand("ORIENT",True),
				padx = 1,
				pady = 1)
		b.grid(row=row, rowspan=3, column=col, sticky=EW)
		self.addWidget(b)
		tkExtra.Balloon.set(b, _("Align GCode with the machine markers"))

		# ---
		row += 1
		col = 0
		Label(lframe(), text=_("Offset:")).grid(row=row, column=col, sticky=E)

		col += 1
		self.xo_orient = Label(lframe(), foreground="DarkBlue", background="gray90", anchor=W)
		self.xo_orient.grid(row=row, column=col, sticky=EW, padx=1)

		col += 1
		self.yo_orient = Label(lframe(), foreground="DarkBlue", background="gray90", anchor=W)
		self.yo_orient.grid(row=row, column=col, sticky=EW, padx=1)

		# ---
		row += 1
		col = 0
		Label(lframe(), text=_("Error:")).grid(row=row, column=col, sticky=E)
		col += 1
		self.err_orient = Label(lframe(), foreground="DarkBlue", background="gray90", anchor=W)
		self.err_orient.grid(row=row, column=col, columnspan=2, sticky=EW, padx=1, pady=1)

		lframe().grid_columnconfigure(1, weight=1)
		lframe().grid_columnconfigure(2, weight=1)

		#----------------------------------------------------------------
		self.warn = True
		self.loadConfig()