Hello Guest it is April 27, 2024, 12:20:25 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 - SwiftyJ

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 »
21
You need to make a copy of the screenset you are using as well inside the c:/mach4hobby/screens folder. As you are using the mill profile it will be using the wx4 screenset that you are using. This is where all the lua code is actually stored. After making a copy of the screen file and renaming it, you can load it when you open mach4 through the View menu

22
Mach4 General Discussion / Re: Mach4 Closing
« on: August 26, 2023, 04:47:27 AM »
You can do something like this:
Code: [Select]
function m166()
local inst = mc.mcGetInstance()

--Wait for input0 to go high, timeout 2 seconds
rc = mc.mcSignalWait(inst, mc.ISIG_INPUT0, mc.WAIT_MODE_HIGH, 2)

if (rc == mc.MERROR_TIMED_OUT) then
--Stop the program if timed out
mc.mcCntlMacroStop(inst, rc, "Timeout waiting for signal")
return
end

end

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

You'll have to adjust it for the signal you're waiting for and the wait mode. There are a few options FALL, HIGH, RISE, NONE, LOW

23
Mach4 General Discussion / Re: Problem with custom M5 macro
« on: August 13, 2023, 05:27:49 AM »
I'm getting the same result as you, trying to execute a custom macro within another macro causes it to hang. You will have to turn off the spindle in the m30 using mc.mcSpindleSetDirection like you did in the m6.. it's probably the better way to do it anyway

24
Mach4 General Discussion / Re: FIFO Drain Error
« on: August 12, 2023, 06:17:58 AM »

25
Mach4 General Discussion / Re: Problem with custom M5 macro
« on: August 10, 2023, 03:15:34 PM »
Can you post your m6 and m30 macro?

26
Mach4 General Discussion / Re: I want to make a runtime time counter
« on: July 23, 2023, 06:20:02 AM »
Hi, you can use wxStopWatch for this. It allows you to pause and resume

https://docs.wxwidgets.org/3.0/classwx_stop_watch.html

27
Mach4 General Discussion / Re: Mach4 Signal Tower script
« on: June 22, 2023, 03:20:12 PM »
Thank you very much for your input!
Can you please share an example script for one LED? (and where to put it)

I have attached an example I did in the PMC. Currently it is configured to turn on Output2 when Tool Change is active, but if you go into the PMC editor and double click 'FYellowLight' you can change it to whatever you have it mapped to.

To get it to work:
  • Copy the file into C:\Mach4Hobby\PMC.
  • Access the PMC editor within Mach4 by going to Configure>PMC. Then load the .pmc file through the File>Open menu.
  • After any changes you need to generate the lua code.
  • Within the PMC editor go to Settings>Code Generator and select 'Lua Code'.
  • Then go to Generate>Generate as and save the lua file.
  • To load the file you need to go into the screen editor, select the top level item in the tree, go to the Properties tab and at the bottom is PMC Objects where you can select the file just generated.

Or just watch this video which I found after typing all that out https://www.youtube.com/watch?v=jVhH9qyjjf0

28
Mach4 General Discussion / Re: Mach4 Signal Tower script
« on: June 21, 2023, 03:02:09 AM »
As far as I know you can’t use the LED to control the output. The Output controls the state of the LED. Therefore wxTimer can be used or an easier option will be using the PMC if you’re familiar with ladder logic

29
You can use the following API

Code: [Select]
rc = mc.mcJogSetAccel(
number mInst,
number axisId,
double percent)

30
Code: [Select]
        --Jog Axes accordingly

rc = mc.mcJogSetRate(inst, 1, jogVelX);
rc = mc.mcJogVelocityStart(inst, 1, xAxisDirection);
rc = mc.mcJogSetRate(inst, 2, jogVelY);
rc = mc.mcJogVelocityStart(inst, 2, yAxisDirection);

What values do you have for jogVelX and jogVelY as mc.mcJogSetRate is a % of maximum motor velocity?
Also, you have the values for the X and Y axis incorrect. X axis is 0 and Y axis is 1. Alternatively you can use mc.X_AXIS and mc.Y_AXIS

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 »