21
Mach4 Toolbox / Re: IsStill example (M4 version of IsMoving)
« 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.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
print( _VERSION )
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
BTW: YOU have FAR, FAR, FAR to much time on your hands for Mach4 Ascii art!!!! hehehhee
Scott
____ _ _
/ ___| ___ ___ | |_| |_
\___ \ / __/ _ \| __| __|
___) | (_| (_) | |_| |_
|____/ \___\___/ \__|\__|
Changing LUA versions is not something we will do once we release. We just made a push to get to the latest code base for everything we use so that we don't feel the need to do it at a later date after release. In the future, a normal user should never see this.Great! As long as you know about the problem and plan on doing something about it, then case closed. Thx for the reply.
It is because some mcc file is still in there somewhere when it tried to roll all of them up into the one big mcLua.mcc file. Incompatible mcc files prevent this from happening.
The rule of thumb is if there is no mcLua.mcc file, then there is an error in at least one script or the mcc files are incompatible. Those are the only two instances we have found that prevent the mcLua.mcc file from being built.
Be sure that if your scripts reference any scripts external to the profile (like in Mach4/Modules dir), that those scripts also have their mcc files deleted. You may have to compile external scripts in the mcLuaEditor as the auto compile will not work for scrips outside of the macros dir.
Steve
Once you press Start Cycle, they will build and the mcLua.mcc will be created.
--[[--------------------------------------------------------------------------------------------------------
||_/\\\\____________/\\\\_____/\\\\\\\\\___________/\\\\\\\\\__/\\\________/\\\____________/\\\____________
||_\/\\\\\\________/\\\\\\___/\\\\\\\\\\\\\______/\\\////////__\/\\\_______\/\\\__________/\\\\\____________
||__\/\\\//\\\____/\\\//\\\__/\\\/////////\\\___/\\\/___________\/\\\_______\/\\\________/\\\/\\\___________
||___\/\\\\///\\\/\\\/_\/\\\_\/\\\_______\/\\\__/\\\_____________\/\\\\\\\\\\\\\\\______/\\\/\/\\\__________
||____\/\\\__\///\\\/___\/\\\_\/\\\\\\\\\\\\\\\_\/\\\_____________\/\\\/////////\\\____/\\\/__\/\\\_________
||_____\/\\\____\///_____\/\\\_\/\\\/////////\\\_\//\\\____________\/\\\_______\/\\\__/\\\\\\\\\\\\\\\\_____
||______\/\\\_____________\/\\\_\/\\\_______\/\\\__\///\\\__________\/\\\_______\/\\\_\///////////\\\//_____
||_______\/\\\_____________\/\\\_\/\\\_______\/\\\____\////\\\\\\\\\_\/\\\_______\/\\\___________\/\\\______
||________\///______________\///__\///________\///________\/////////__\///________\///____________\///______
||++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
||
||++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
||
|| 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
inst = mc.mcGetInstance()
local SNv = mc.mcCntlGetPoundVar(inst,590) --gets #var
scr.SetProperty('udro18', 'Value', tostring(SNv)) --sets dro
local droval = scr.GetProperty('udro18', 'Value') --gets dro
mc.mcCntlSetPoundVar(inst, 590, tonumber(droval)) --set #var
print(type(YOUR_VARIABLE) --inserting the variable you want to know about
Hit F5 and then F11 to step through it, and watch the console at the bottom of Lua.