Hello Guest it is April 25, 2024, 01:28:22 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 - smurph

61
Mach4 General Discussion / Re: Mach4 cycles outputs during loading
« on: September 17, 2022, 01:34:24 PM »
I was going to say that a lot of this has to do with how the motion controller starts up.  Specifically what state the inputs are in.  If the inputs are steady, you will see no cycling.  It is important to note that the SigLib is called when the state of the input changes.  So if the code is cycling, that means the input itself is cycling.  I would go so far as to say that my Galil does NOT exhibit this behavior.  And it certainly isn't Mach cycling the inputs.  So you must concentrate on how to mitigate the issue.  First, I would ask for support from the motion controller vendor.  Failing that, try to fix hardware in software (like we do every day!) and see if some script changes and switch wiring can help. 

The below code will ONLY respond to signal changes AFTER the screen has loaded.  However, this may not always be optimal as you may miss the initial state of the input.  If you have toggle switches, it may be better to use momentary on switches. 

Code: [Select]
[mc.ISIG_INPUT9] = function (S20ActivateCoolantPump)
if (scr.IsLoaded()) then --- only process if the screen has completely loaded.
local inst = mc.mcGetInstance();
local hsig = mc.mcSignalGetHandle(inst, mc.OSIG_COOLANTON);

if (S20ActivateCoolantPump == 1) then
        mc.mcSignalSetState(hsig, 1);
        mc.mcCntlSetLastError(inst, "Flood coolant is ON")
else
mc.mcSignalSetState(hsig, 0);
mc.mcCntlSetLastError(inst, "Flood coolant is OFF")
end
end
end,

Another thing you can do is see if you can shut the power off to the inputs while the machine is starting up and then once it is stable, power the inputs so that their state is then immediately seen. 

Steve

62
Mach4 General Discussion / Re: IMTS 2022
« on: September 16, 2022, 05:45:04 PM »
I used to go.  But then I decided I didn't want to get shot and quit going.  :(

63
Mach4 General Discussion / Re: Mach4 cycles outputs during loading
« on: September 16, 2022, 05:42:30 PM »
In a screen script, just don't set signal states until the system is loaded.

if scr.IsLoaded() then
...  signal setting code here ...
end

In a PMC object, you can wait on the machine to be enabled the first time or somethin go f the like.

Steve

64
Take it from a guy that has and STILL IS trying to upgrade from 3-4. It will make you very angry and there is a huge learning curve and anyone suggesting there isn't is full of it. Mach4 is a good software for programmers and not DIYers. There are a lot of mods that need to be done not to mention the setup of the pins, spindle, etc. I work on mine a little and then walk away so I don't drop kick the computer. Here is a small example, my WORK ZERO does NOTHING so I have to go in and modify the script to tell it to work. You would think that would be a "from the factory" thing but evidently it isn't. Just several little things like that that can make you say WHY DID I JUST SPEND $200 ON THIS!! I am still hoping I can overcome, and it works good in the end but I am still using Mach3 after almost 8 months of switching over.

No disrespect meant here at all.  I'm just trying to point somethings out that may not be obvious.  There is a certain amount of setup that has to be done with Mach 3 or Mach 4.  Buying an OEM machine that is preconfigured relieves you from becoming the "machine integrator".   However, the OP has not used Mach 3 before so he doesn't have Mach 3 habits to break.  Like it or not, that is what it is.  We all get used to doing thing a certain way and resist change even if change will make something better.  But make no mistake, if you built a machine and installed Mach 3 from scratch, you would spend about the same amount of time configuring Mach 3 as you would Mach 4.  It is just different, not harder.  Just different.

BTW, the "Goto Work Zero" button used to move X, Y, then Z.  But people who had just 2 axis machines complained about trying to move the unconfigured Z axis.  Then we made it just move X and Y without touching Z and people complained that they crashed their Z because it didn't move the Z to a safe level.  So then we just made it where you have to make it do exactly what you want it to do.  And people still complain.  :(

When I install Mach 4, the only thing I will touch after setting up the motion controller is the "Goto Work Zero" button and the keyboard bindings if I'm not using a panel and the machine doesn't have a tool changer.  It runs machines quite well "out of the box".  Now, it may not be how you want it to be, especially if you are used to Mach 3.  And then you are going to have to learn a bit to customize Mach 4 to your liking.  I see a lot of Mach 3 users wanting to change Mach 4 to be more like Mach 3.  It is like upgrading from XP to Windows 10.  Sure XP was good, but so is Windows 10.  But they are different and most of us don't go trying to change Windows 10 to look or act like Windows XP.  And I think the reason is there just isn't much way of doing that.  Maybe we shouldn't have made Mach 4 as configurable as it is.  But that is what people told us they wanted when they couldn't "do" some task or functionality in Mach 3.  So we have figured out (very painfully I might add) that we can't make everyone happy.  :(

Also, I say this over and over.  Mach 4 is not Mach 3.  Just like XP isn't Windows 10.  Which Mach is better?  Well...  one (Mach 3) hasn't any development on it in nearly a decade.  In fact, it REQUIRES an XP machine and a very old compiler to compile it.  The other (Mach 4) is compiled daily and actively developed.  I'd go with Mach 4 for that reason alone.  How long will Mach 3 continue to run on modern versions of Windows?  They (Microsoft) basically made it where the parallel port plugin won't work anymore already.  And the very compiler that Mach 3 used (written by Microsoft!) will not run on anything newer than Windows XP.  So that would be a very real concern for me.  But that's my opinion.  I'm rather like Craig and would start slashing if I had to go back to Mach 3.   

And to the OP, I hate it that you got one of those Chinese controllers.  I know the price was appealing vs. others but it is usually just wasted money in the end.  I wish there was a way to put up a huge warning anytime someone searched on hobby CNC machines that says "Noooooooooo!".  Those guys will probably bundle their machines with Mach 3 for 20 more years.  Why?  Because they can't bundle it with Mach 4!  And I don't think they can bundle with LinuxCNC either. 

Steve

65
Mach4 General Discussion / Re: Mach4 Lua programatically clicking button
« on: September 14, 2022, 01:20:31 PM »
Typically it is a BAD idea to try and "click" buttons programmatically.  The correct way to do this in Mach 4 is to use the API to do the same function the button does.  Now, if the button does some custom LUA code, put the code in a function in the screen load script and then call that function from the button AND your other code.  If you want to call this function from a M code script, you will have to put the function in a module that both the screen and the m code scripts load. 

I typically like to put all of my custom code in a LUA module.  That way I can call the functions from the screen buttons, screen PLC script, and M code macro scripts.  But be aware that there no global variables shared between the screen and macro LUA environments.  Use Mach registers to share data. 

And I really really hate to mention this because it is the WRONG way to do it and I regret putting this function in the GUI.  But inside the screen LUA environment, you can use scr.ButtonClick('button-name').  If you want to use this function in a macro script, you will have to load the screen api.  See load_modules.mcs in the lua examples.

scr=require('screenipc') -- require the screen api.
scr.scIpcInit('localhost:48500') -- init the screen api.

Steve

66
You can use the Mach4GUIR.exe Remote GUI pretty easily.  Install Mach on the remote PC.  You will have to make a shortcut to launch the remote GUI and pass parameters to it.  A license is not required for the remote PC.

Mach4GUIR </r mach4.ip.address> </s screen name> [/e] [/f] [/m]

/r is required.  substitute mach4.ip.address with the ip address of the PC running the licensed Mach4.
/s is required.  It is the name of the screen set that the remote GUI uses.  You probably want to make your own custom screen set that does just what you want.  It has to be located in Screens directory of the remote PC.
/e is optional -- start the GUI in screen edit mode.
/f is optional -- start in full screen mode
/m is optional -- remove the menu.

You have to launch the remote GUI AFTER Mach is started on the controller PC.  There is no way to remotely start Mach with the remote GUI.  However, you can do Windows remote execution methods, given it is setup properly, with psexec.  https://ss64.com/nt/psexec.html

Steve

67
Mach4 General Discussion / Re: Initiating values from "ini file"
« on: March 31, 2022, 07:43:48 PM »
... so I put this code at the end of the Screen Load Script:

The screen load script is run when the screen is first loaded.  Meaning the screen hasn't yet loaded.  So you will never be able to do it this way.

You could probably use the PLC script and scr.IsLoaded() in combination with a flag to only allow the code to run once.

But the better way, as others have mentioned, is to use the register plugin to create a persistent register.  Then point a DRO (Register Property) to that register in the screen editor. 

Steve

68
It does both by default.  Why would you want to prevent it?  Just use the machine coordinates.

Steve

69
Mach4 General Discussion / Re: Mach4, Pandant xhc HB04B wireless help
« on: March 20, 2022, 02:19:00 AM »
The plugin I wrote will handle the newer wired or wireless WHB04B-4/6 pendants.  But unfortunately not your older HB04B pendant.

Steve

70
Mach4 General Discussion / Re: New to forum, I have mach4 issues
« on: February 17, 2022, 04:55:06 PM »
I have no idea, unfortunately.  I'm not familiar enough with sheetcam or the warprunner to comment.  But maybe someone will come a long though. 

Steve