Hello Guest it is March 29, 2024, 10:40:46 AM

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.


Messages - Zvo

Pages: 1
1
Mach4 General Discussion / Re: A few MCode questions - Mach 4
« on: May 09, 2019, 03:48:24 PM »
Thanks for the ideas...

1st question - yes the G0 in front of the line solves the problem but... My post processor does not issue the G0 in front of the code (it is going to be a punching machine so no G0 is in front of the line.) and off course M25/M20 are fixed commands and in the same line as movement commands.

Maybe something like this can solve it:

if (mc.mcInEditor()==1) then
mc.mcCntlGcodeExecuteWait(inst,"G0""X"..go to code.."Y"..go to code)
m25()
end

off course ..go to code.. has to be something that makes sence :P

2nd Question:

The script is just an example - the real script should make the movement on every line an then fire the output on 50ms and turn it off and repeat this procedure on every line until it hits M20.

3rd question:


3) Yup. In the M125 have it draw the square. In the top of script you should also check the feed rate and G90/91 mode and set them back to what they were before M125 changes them. CV will not work on the square doing it like this. But, why not just run a sb-program each time you want the square? Why reinvent the wheel? Doing it in a macro seems like going around your elbow to get to your thumb.

Code: [Select]
function m125()
local inst = mc.mcGetInstance()
local rc = mc.mcCntlGcodeExecuteWait(inst, "G91\nG1 F5.00 X1.00\nY1.00\nX-1.00\nY-1.00\nG90")
end

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


I may have explained wrong - I was thinking about the the tool path display on the screen.

Thanks,

Zvo
 

2
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