RE: More Tkemc stuff
Based on an earlier e-mail from you I have changed the Set_Coordinates to
update as soon as the "Write" button is pushed. Would that work if I am
updating variable # 1000?
I have in mind to set the variables once at the beginning of a run of parts
and write the G-code to use variables instead of values. Does EMC read the
variables every time through the program so changes would be reflected the
next time it's run?
Is there a list that deals with Tcl programming?
Thanks.
Ethan
-----Original Message-----
From: Ray [SMTP:rehenry-at-up.net]
Sent: Tuesday, September 04, 2001 11:28 AM
To: Multiple recipients of list
Subject: Re: More Tkemc stuff
Ethan
(comments mixed in)
On Tue, 04 Sep 2001, Ethan wrote:
> 1. How can I get the estop button to be red when the estop is on? I tried
a
> million things but could not get it to work. All I succeeded in doing was
> getting it red all the time.
Now you are getting into Tickle programming and that is not the primary
purpose of this list. But you can do it using a process something like the
toggleEstop process but for the standard tkemc, modifying the
updateStatus process and adding the configure commands to make changes to
the estop button. But there is a caution here that I will add after I go
through the code.
-----snip of updateStatus process-----
# now update labels
if {[emc_estop] == "on"} {
set estoplabel "ESTOP"
} elseif {[emc_machine] == "on"} {
set estoplabel "ON"
} else {
set estoplabel "ESTOP RESET"
}
-----end of snip -> suggested new-----
# now update labels
global estopbutton
if {[emc_estop] == "on"} {
set estoplabel "ESTOP"
$estopbutton configure -bg darkgray -fg white -relief sunken
} elseif {[emc_machine] == "on"} {
set estoplabel "ON"
$estopbutton configure -bg red -fg white -relief raised
} else {
set estoplabel "ESTOP RESET"
$estopbutton configure -bg green -fg black -relief raised
}
-----end of modifications-----
The caution is that NIST has a philosophy concerning their motion software.
They are building their API so that multiple HMI's and GUI's can connect to
and take control of a running motion control system. I walked into Fred's
office a couple years ago with some beautiful and functional drawings of a
control panel, the logic of which lasted a few seconds because I was using
hard wired switches and HMI software that limited the control of the EMC to
only that panel.
Now you can do that for your machine and no one will really care but it
will be more difficult to get help because most of us here are working with
the standard EMC running within the NIST philosophy. Those of us that
build custom stuff to go with it accept the fact that we are out on a limb
by ourselves.
Let me apply this back to the code that I wrote for you above and see if
we can understand the difference between updateStatus and toggleEstop.
Since updateStatus executes several times a second as a loop, putting
something in it that references the running EMC "emc_estop" the values of
the button will always be reasonably current regardless of what has caused
a
change to estop condition.
If I were to make those changes only to a process called toggleEstop and
then ran that process when I pressed the estopbutton, I would have created
a bit of code that does okay as long as it is the only process that has
access to estop. If estop changes state for some other reason, the gui
will not reflect the current state of the EMC accurately.
The down side of doing this kind of stuff in a loop process is that it
stretches the time required for the loop to complete or demands more
speed in the processor to run the program.
> 2. Could someone please send me a quick .tcl that will write a number to
> variable # 1000? I just can't seem to get it.
The most basic way to set a variable is g-code (n10 #1000 = 50) or you can
iterate it using (n140 #1000 = #1000 + 0.050). Then you can command an
axis using the variable (n150 X#1000) See
linuxcnc.org.handbook/gcode/variables.html for more.
Both genedit and Set_Coordinates.tcl show examples of how to control a
parameter value from Tcl. You should note that you will need to re-read
the var file after the set using emc_task_plan_init if you are running
emcsh. And there are other effects of that command as well that will have
to be restored after the read.
Hope this helps. If you want to develop a specific application, contact me
off list with the details.
Ray
Date Index |
Thread Index |
Back to archive index |
Back to Mailing List Page
Problems or questions? Contact