Hello Guest it is April 03, 2026, 03:29:57 PM

Recent Posts

Pages: « 1 2 3 4 5 6 7 8 9 10 »
71
M31 Motion Controller / Re: VFD
« Last post by edcross on March 12, 2026, 04:15:51 AM »
When i load Machpro and turn on VFD , my spindle turns very slowly ( 2.37 hz ) , can stop it with vfd stop button


    Ed
72
MachPro General Discussion / Re: PLC Scripts
« Last post by paul.stephens on March 11, 2026, 12:44:58 PM »
Currently, I do wish to add other logic gates like NAND, NOR, XOR, XNOR.

When it comes to an elseif statement, you're right. You would have to make multiple GMS processes Each one setting a register or #var and base the other processes to read said register or #var making your conditions work. It is a lot of extra clutter and steps. I'll try to think of a process that can cover these things and go to make a proposal.
73
MachPro General Discussion / Re: PLC Scripts
« Last post by cd_edwards on March 11, 2026, 11:03:21 AM »
There is also no method of sorting the items. What I'm looking for is a big if then elseif  end or switch solution. Some things take priority over others. ESTOP for example should be an absolute. Nothing else matters. it looks like this will go through ALL of the options and without sorting it, well it's not correct interpreting what the state of the machine is.
74
Here is a example Mcode I would reccomend starting with that has error checking. Make sure that your file name is also the name of your mcode.

Example with parameters:

File name: m100.mcs
Code: [Select]
function m100()-- It uses pcall to call the _m100 function in protected mode, which means that any errors that occur during the execution of _m100 will be caught, preventing the script from crashing.
local is_ok, msg = pcall(_m100)
if is_ok ~= true then
wx.wxMessageBox(tostring(msg))
end
end

function _m100()
--Your Code contents here
end

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

Here is a real example I have used in the past:

This code Swapped motors and ran and then ran a M3 code

Code: [Select]
function m23(hParam)-- It uses pcall to call the _m23 function in protected mode, which means that any errors that occur during the execution of _m23 will be caught, preventing the script from crashing.
local is_ok, msg = pcall(_m23, hParam)
if is_ok ~= true then
wx.wxMessageBox(tostring(msg))
end
end

function _m23(hParam)
local inst = mc.mcGetInstance()
local motor_5 = 5 --Setting your motor_5 to index 5 for readability
local axis_A = 3 --Setting your axis_A to index 3 for readability
local axis_OB1 = 6 --Setting your axis_OB1 to index 6 for readability
local getAxis = mc.mcMotorGetAxis(inst, motor_5)
local varS = 0 -- Setting S as your Spindle speed

if (getAxis == 3) then
mc.mcAxisUnmapMotor(inst, axis_A, motor_5) -- Changing these will not change the default settings.. this will just change for the duration of the session.
mc.mcAxisMapMotor(inst, axis_OB1, motor_5) -- Changing these will not change the default settings.. this will just change for the duration of the session.
mc.mcMotionSync(inst) --It's a good idea to sync when you change this information.
end

if (hParam ~= nil) then
varS = mc.mcCntlGetLocalVar(inst, hParam, mc.SV_S) -- This passes S into your varS value
end
gCode= ''
gCode= gCode..string.format("M3 S%0.f\n", varS)--This runs the gcode M3 S####
mc.mcCntlGcodeExecuteWait(inst, gCode)
end
if (mc.mcInEditor() == 1) then
m23()
end

I recommend looking at this documentation as this has the basic M Codes that are typically used.

https://support.machmotion.com/books/software/page/mach4-g-code-and-m-code-reference
75
MachPro General Discussion / Re: PLC Scripts
« Last post by cd_edwards on March 11, 2026, 10:41:34 AM »
maybe make it so it works as well. I've found a couple of errors which make it unusable. For instance it does not save the custom IO. When you restart the program, they disappear completely. Then there's the unhandled exception that pops up and causes Machpro to be unusable. I've already posted about this to Carl.
76
MachPro General Discussion / Re: PLC Scripts
« Last post by paul.stephens on March 11, 2026, 10:37:57 AM »
Technically the GMS flow is a standard of flow but it's not very intuitive for users who are not used to it. We are trying to determine what kind of flow we want in the future. Personally I'm for a drag and drop method, but we could technically also do ladder logic or refine the text based version we currently have It's more about deciding how we want the product to look and feel at the end of the day. We have been moving towards the AI route to do prototyping. For example, we are trying to do a web based interface and using AI to help test for what is possible and not possible to determine what and how we want to implement said technology.
77
Share Your GCode / The best Gcode I have come up with
« Last post by smav on March 10, 2026, 10:52:12 PM »
Well it has be quite a long time since I have stopped by here to see what is going on in the Mach3/4 and cnc world but came across an idea today that I tried out that I would be surprised if a bunch of others haven't already come across this little gcoding tidbit. But just in case no one else has I figured I would share it.
I was going to turn down a pin on my little cnc and was about to start writing a little gcode program for it when I thought, I wonder if ole AI Joe (the little AI guy that showed up on my cnc computer one day and I figured he was just another regular Joe app, hence the name) could write it up for me instead. Well I gave him some information about the machine, tooling, material and dimensions and he went right to work and spit out a program, lickity split. After proofing it I had to ask him to change some of the formatting that wouldn't be compatible with my machine and a little bit more guidance on want I was looking for in a tool path geometry he got me something that worked quite well and spit it out faster than I could have typed it out.
Anyway as I stated earlier I would guess that this is old news by now but just in case I have learned that you never assume everyone or anyone knows something just because it was obvious to you.
78
Building or Buying a Wood routing table.. Beginnners guide.. / Re: Router issue
« Last post by BazookaJoe on March 10, 2026, 10:00:46 PM »
Thank you - very much appreciated. I can now begin  the Mach3 adventure! 
79
MachPro General Discussion / Re: MachPro Documentation.
« Last post by tbadger on March 10, 2026, 05:07:27 PM »
Lots of good stuff there, but still very much a work in progress...  If you see something that doesn't align with what you see, or might be missing, send them an email I've found them responsive and open to feedback (positive or negative.)
80
MachPro General Discussion / Re: PLC Scripts
« Last post by tbadger on March 10, 2026, 05:04:54 PM »
If you meant Clunky, I'd agree with you!  ;D  Given the movement towards AI, I was just thinking about how it could be used to implement things like this in the CNC world. Besides creating 3D imagery, this seems to be an underserved area in the CNC world.

I've used AI when doing coding on Android, and have found it pretty useful to help me when I've got stuck. Why not here?  Someone needs to create an LLM around the scripting and other languages used in the CNC world. That would be killer.
Pages: « 1 2 3 4 5 6 7 8 9 10 »