Machsupport Forum
Mach Discussion => Mach4 General Discussion => Mach4 Toolbox => Topic started by: Bodini on June 04, 2014, 08:16:31 PM
-
Or: "How to pause your script while an axis is moving."
Hey! It works in build 1817!
--[[--------------------------------------------------------------------------------------------------------
||_/\\\\____________/\\\\_____/\\\\\\\\\___________/\\\\\\\\\__/\\\________/\\\____________/\\\____________
||_\/\\\\\\________/\\\\\\___/\\\\\\\\\\\\\______/\\\////////__\/\\\_______\/\\\__________/\\\\\____________
||__\/\\\//\\\____/\\\//\\\__/\\\/////////\\\___/\\\/___________\/\\\_______\/\\\________/\\\/\\\___________
||___\/\\\\///\\\/\\\/_\/\\\_\/\\\_______\/\\\__/\\\_____________\/\\\\\\\\\\\\\\\______/\\\/\/\\\__________
||____\/\\\__\///\\\/___\/\\\_\/\\\\\\\\\\\\\\\_\/\\\_____________\/\\\/////////\\\____/\\\/__\/\\\_________
||_____\/\\\____\///_____\/\\\_\/\\\/////////\\\_\//\\\____________\/\\\_______\/\\\__/\\\\\\\\\\\\\\\\_____
||______\/\\\_____________\/\\\_\/\\\_______\/\\\__\///\\\__________\/\\\_______\/\\\_\///////////\\\//_____
||_______\/\\\_____________\/\\\_\/\\\_______\/\\\____\////\\\\\\\\\_\/\\\_______\/\\\___________\/\\\______
||________\///______________\///__\///________\///________\/////////__\///________\///____________\///______
||++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
||
||++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
||
|| By ::: NJL Bodini
||
|| Mach 4 Build ::: 1817
||
|| Date ::: 06 04 2014
||
|| Script Desc ::: Pause script execution while an axis is in motion (m4 version of IsMoving )
||
||++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]]
inst = mc.mcGetInstance()
mc.mcCntlGcodeExecute(inst, "g91 g1 x1") --execute gcode
while (mc.mcCntlIsStill(inst)==1) do --loops through this while an axis is moving
mc.mcCntlSetLastError(inst, "axis in motion") --do this while axis is moving
end --ends the loop
mc.mcCntlSetLastError(inst, "axis is stopped") --continues here after axis is done moving
mc.mcCntlGcodeExecute(inst, "g90") --execute gcode
-
here is what gets me..
mc.mcCntlIsStill(inst)==1, if the axis IS STILL, (i.e. not moving), it should give you a 1, if it IS Moving, it should return a 0.....
seams to me it should ask the question "Are you still?" 1 = yes, 0 = no..
just my own quirks I guess..
BTW: YOU have FAR, FAR, FAR to much time on your hands for Mach4 Ascii art!!!! hehehhee
Scott
-
here is what gets me..
mc.mcCntlIsStill(inst)==1, if the axis IS STILL, (i.e. not moving), it should give you a 1, if it IS Moving, it should return a 0.....
seams to me it should ask the question "Are you still?" 1 = yes, 0 = no..
just my own quirks I guess..
Scott
I thought the same thing as you when I tried the script the first time. But it didn't work, so I flipped 0 for 1 and it did work. I imagine that the programmers may have something else in mind but that wouldn't be the first time I couldn't follow the logic. Oh well, once it worked I just accepted it and thats that. ;-)
BTW: YOU have FAR, FAR, FAR to much time on your hands for Mach4 Ascii art!!!! hehehhee
Scott
I like to give that illusion on the interwebz. ;D
____ _ _
/ ___| ___ ___ | |_| |_
\___ \ / __/ _ \| __| __|
___) | (_| (_) | |_| |_
|____/ \___\___/ \__|\__|
ascii art generator --> http://patorjk.com/software/taag/
-Nick
-
Build 1817: Use IsStill with caution. It worked OK in the above script, but beyond that it is causing all sorts of problems.
-
Bug has been reported here --> http://www.machsupport.com/forum/index.php/topic,27119.msg193580.html#msg193580