Hello Guest it is April 19, 2024, 02:26:53 PM

Author Topic: IsStill example (M4 version of IsMoving)  (Read 4145 times)

0 Members and 1 Guest are viewing this topic.

Offline Bodini

*
  •  216 216
    • View Profile
IsStill example (M4 version of IsMoving)
« 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!

Code: [Select]
--[[--------------------------------------------------------------------------------------------------------
||_/\\\\____________/\\\\_____/\\\\\\\\\___________/\\\\\\\\\__/\\\________/\\\____________/\\\____________
||_\/\\\\\\________/\\\\\\___/\\\\\\\\\\\\\______/\\\////////__\/\\\_______\/\\\__________/\\\\\____________
||__\/\\\//\\\____/\\\//\\\__/\\\/////////\\\___/\\\/___________\/\\\_______\/\\\________/\\\/\\\___________
||___\/\\\\///\\\/\\\/_\/\\\_\/\\\_______\/\\\__/\\\_____________\/\\\\\\\\\\\\\\\______/\\\/\/\\\__________
||____\/\\\__\///\\\/___\/\\\_\/\\\\\\\\\\\\\\\_\/\\\_____________\/\\\/////////\\\____/\\\/__\/\\\_________
||_____\/\\\____\///_____\/\\\_\/\\\/////////\\\_\//\\\____________\/\\\_______\/\\\__/\\\\\\\\\\\\\\\\_____
||______\/\\\_____________\/\\\_\/\\\_______\/\\\__\///\\\__________\/\\\_______\/\\\_\///////////\\\//_____
||_______\/\\\_____________\/\\\_\/\\\_______\/\\\____\////\\\\\\\\\_\/\\\_______\/\\\___________\/\\\______
||________\///______________\///__\///________\///________\/////////__\///________\///____________\///______
||++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
||                               
||++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
||   
||  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

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: IsStill example (M4 version of IsMoving)
« Reply #1 on: June 05, 2014, 11:55:10 AM »
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
fun times

Offline Bodini

*
  •  216 216
    • View Profile
Re: IsStill example (M4 version of IsMoving)
« Reply #2 on: June 05, 2014, 01:08:53 PM »
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

Code: [Select]
  ____            _   _   
 / ___|  ___ ___ | |_| |_
 \___ \ / __/ _ \| __| __|
  ___) | (_| (_) | |_| |_
 |____/ \___\___/ \__|\__|
                   


ascii art generator --> http://patorjk.com/software/taag/

-Nick

Offline Bodini

*
  •  216 216
    • View Profile
Re: IsStill example (M4 version of IsMoving)
« Reply #3 on: June 06, 2014, 10:20:59 PM »
Build 1817: Use IsStill with caution.  It worked OK in the above script, but beyond that it is causing all sorts of problems.

Offline Bodini

*
  •  216 216
    • View Profile
Re: IsStill example (M4 version of IsMoving)
« Reply #4 on: June 07, 2014, 09:12:35 PM »