Hello Guest it is May 30, 2023, 01:18:49 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.


Messages - SwiftyJ

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 »
1
You can use the following API

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

2
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

3
Mach4 General Discussion / Re: PLC Script not updating all registers?
« on: March 01, 2023, 08:30:43 AM »
Hi, it looks like you are not reading the value of the register before performing calculations. You are performing calculations on the handle of the register which is just a number.. hence why everything executes correctly.

See below

Code: [Select]
---------------------------------------------------------
--          scale VFD readbacks
---------------------------------------------------------

local iVoltsHANDLE=mc.mcRegGetHandle(inst,"MbVFD/R_VFDVolt_V");

local iVolts = mc.mcRegGetValue(inst, iVoltsHANDLE) ----------------Missing this

local hVolts=mc.mcRegGetHandle(inst,"iRegs0/MbVFD/Volts_S");
local readBackVolts=iVolts/10;                                  ---------------- Now calculations will be performed on the value of the register just read
mc.mcRegSetValue(hVolts,readBackVolts);

4
Mach4 General Discussion / Re: Script Debugging
« on: March 01, 2023, 08:19:03 AM »
Instead of using mc.mcAxisGetPos for getting the xstart and ystart position, use mc.mcAxisGetMachinePos. You are currently getting the axis position for the current work offset and then using these positions with G53 which moves the machine in machine coordinates.

By using mc.mcAxisGetMachinePos, you will get the start positions in machine coordinates and then the G53 will work correctly.


5
Mach4 General Discussion / Re: Keyboard jogging safety
« on: February 27, 2023, 05:03:45 PM »
You can use the following screen API call to get the active window name - scr.GetActiveWindowText(). You can monitor this in the PLC script and disable the keyboard output when it's not the name of the main GUI window. You can get the name of the main GUI with the following register "core/global/GuiName"

6
Mach4 General Discussion / Re: how Fire up the timer on screen set
« on: December 14, 2022, 04:28:30 PM »
Hi, you can use:

scr.SetProperty(“tmr(1)”, “Command”, “START”)

Be sure to use the name of the timer in your screen. I’m guessing STOP works as well to stop it

7
Mach4 General Discussion / Re: touchscreen shut down button
« on: December 14, 2022, 12:07:17 PM »
You can use:

scr.Exit(false)

8
Mach4 General Discussion / Re: PLC Inputs
« on: December 04, 2022, 12:34:33 PM »
Which type of button are you using to activate input 1?

9
Mach4 General Discussion / Re: How to remember DRO and Fixtures in Mach4?
« on: November 19, 2022, 05:35:23 AM »
You can use mc.mcFixtureSaveFile(inst) to save the fixture offsets file. So you can add this to the end of any button script that you use to set the offsets

10
Mach4 General Discussion / Re: Sound in Mach4
« on: September 26, 2022, 03:15:26 PM »
Try this...just replace the path with the path to your sound

Code: [Select]
local sound = wx.wxSound("C:\\Windows\\Media\\chimes.wav", false)
sound:Play(wx.wxSOUND_ASYNC)

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