Hello Guest it is April 16, 2024, 03:37:16 PM

Show Posts

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.


Topics - Zvo

Pages: 1
1
Mach4 General Discussion / A few MCode questions - Mach 4
« on: May 09, 2019, 02:27:19 PM »
Hi All,

I'm new to scripting and have a few questions if anyone can help. (I tried to search the forum but didn't find my answer - I'm sure it's here somewhere :-[)

Question1:

I did my simple M script :

function m25()
local inst=mc.mcGetInstance()
local hsig=mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT0)
local bla=mc.mcSignalGetState(hsig)

if (bla == 0) then
mc.mcSignalSetState(hsig, 1)
else
mc.mcSignalSetState(hsig, 0)
end

end
if (mc.mcInEditor()==1) then
   m25()
end

and when I try to run it in MDI, for example:

X10M25

it skips the X goto 10 command and executes only M25 script. Why?

Question 2:

I need to create a loop - something like this:

When I get M25 command
repeat the command in every next line until i give M20 command

GCode example:

X100M25
x90Y100
x80Y80
x70Y50
...
X50Y50M20

Is there a command in lua that will execute the command once ,every line, till something?

Question 3 :

This is more for discussion, can I for example give out an command that every time there is an M25 code - in the toolpath view it draws a small square on the exact coordinates?

Thanks in advance,

Zvo

Pages: 1