Hello Guest it is April 25, 2024, 11:48:35 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.


Topics - DAAD

Pages: 1 2 3 »
1
Mach4 General Discussion / Adding Physical button check code Take 2
« on: December 30, 2020, 10:42:47 AM »
At the moment i'm implementing some Physical buttons for easier acces to some of my most used functions.

2 of them are Park and goto zero, both of the use an input signal from the button to run some g code.
Problem is that it's possible to press both buttons after each other which is no good news for my machine!

I've tried to solde this with an axisisstill api, but it's not working smoothly at the moment. If i press the button when the machine moves, it does what it's need to do (nothing + return error axis moving). But when i press the button when the machine is not moving, it starts whit a little yerk and moves into the correct spot. But it also returns the error "machine is moving"

I've already added a millisleep, to overcome this, but the problem persists.

Any idea howto implement this the correct way?

Code: [Select]
mc.ISIG_INPUT4 = Function (state) -- Park Button

local MotorIsStillX = mc.mcAxisIsStill (inst, 1)
local MotorIsStillXs = mc.mcAxisIsStill (inst, 3)
local MotorIsStillY = mc.mcAxisIsStill (inst, 0)

if (( state==1) and (MotorIsStillX == 1) and (MotorIsStillXs == 1) and (MotorIsStillY == 1)) then
wx.wxMillisleep (500)
local msg = " G00 G53 X3100 Y1200"
mc.mcCntlSetLastError(inst, "Goto Park")
mc.mcCntlGcodeExecute(inst, msg)

else

mc.mcCntlSetLastError (inst, "Machine is moving")

end
end,





Keep Safe & Best wishes for the year to come!

Adam

2
Mach4 General Discussion / Zero Z / probing to different offsets
« on: December 09, 2020, 02:56:51 PM »
At the moment i’m using different offset zones to place my workpieces into.

I have setup a probing point so i can swap tools rapidly. The problem is that only the current offset is updated with the new tool probing. At the moment i have to type in the correct coordinates for each offset zone (g54/g55/g56) or do the probing per zone to get gooing.
Is there a way that i can script a bitton to update the needed zones?

Keep safe,

Adam

3
Mach4 General Discussion / Mach 4 back up / Modus operandi
« on: December 01, 2020, 04:40:43 AM »
Hello,

I've finally got mach 4 setup and running as i wanted.
I've already created a hdd backup just in case. But how can i save all data i need from mach 4?

What i've done already:
-Save profile package (screenset / macro's)
-Save separate modules i've made

But how do i save the following info:
-Created registers
-Created keyboard mapping
-Screen load/unload/plc/ scripts.

I can't seem to find these back in the profile package.

Adam

Keep Safe

4
Mach4 General Discussion / Z positioning gets disturbed during headswap
« on: November 28, 2020, 02:30:00 PM »
Hello,

At the moment i have a working dual head setup with some hickups:

If i probe both spindles after each other, all is good. If i don't (because only one tool gets changed), strange things happen with my Z offset.
The spindle last probed is correct, but the other spindle gets the wrong settings, as if some measures get accumulated.

Same thing happens when i put the call for the module function in a toggle button. If i manually swap between the router and spindle, the z value keeps adding up and i loose my correct Z height.

Strangest thing is this works perfectly during usage with my m6 file. Ik can swap multiple times between router/spindlewithout losing my Z refence height. This can be done for multiple gcode files after each other also.

The problem starts when i do a button swap or don't probe both after each other..

same code used for M6/probing/button.

Do i need to tackle this differently to get these problems sorted?

code below:

Code: [Select]
function zControl.UseRouter()
if (zControl.UnmapMotors() == 1) then  --Return out of UseRouter if unmapmotors returns an error
return 1 --failure
end

mc.mcAxisMapMotor(inst, mc.Z_AXIS, Router)
mc.mcAxisMapMotor(inst, mc.A_AXIS, Spindle)
mc.mcCntlSetPoundVar(inst, mc.SV_HEAD_SHIFT_X, OffsetX)
mc.mcCntlSetPoundVar(inst, mc.SV_HEAD_SHIFT_Y, OffsetY)
local TempZ = mc.mcAxisGetPos(inst, mc.Z_AXIS) -- Get work position of Z-Axis
local TempA = mc.mcAxisGetPos(inst, mc.A_AXIS) -- Get work position of A-Axis
mc.mcAxisSetPos(inst, mc.A_AXIS, TempZ) -- Replace A-axis value with Z value
mc.mcAxisSetPos(inst, mc.Z_AXIS, TempA) -- Replace Z-axis value with A value
local h_OUTPUT4 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT4) --Spindle-Router swap output
local h_OUTPUT5 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT5) --Spindle dust pneumatics
local h_OUTPUT6 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT6) --Router dust pneumatics
mc.mcSignalSetState(h_OUTPUT4, 0)
mc.mcSignalSetState(h_OUTPUT5, 0)
mc.mcSignalSetState(h_OUTPUT6, 1)
--mc.mcSignalSetState(h_RELAY2, 1) --Future dust collection
local axisID, rc = mc.mcMotorGetAxis(inst,Router) --Z axis maakt deel uit van variable rc om return code te bekomen
local state = mc.mcSignalGetState(h_OUTPUT4)
if ((axisID == mc.Z_AXIS) and (state == 0)and (rc==mc.MERROR_NOERROR)) then
mc.mcCntlSetLastError(inst, 'Router active - Output set')
return

else
mc.mcCntlSetLastError(inst, "Router or output not activated / process stopped")
mc.mcCntlEnable (inst, false)
end
end

Code: [Select]
function zControl.UseSpindle()

if (zControl.UnmapMotors() == 1) then --Return out of UseRouter if unmapmotors returns an error
return 1 -- failure
end

mc.mcAxisMapMotor(inst, mc.Z_AXIS, Spindle)
mc.mcAxisMapMotor(inst, mc.A_AXIS, Router)
mc.mcCntlSetPoundVar(inst, mc.SV_HEAD_SHIFT_X, 0)
mc.mcCntlSetPoundVar(inst, mc.SV_HEAD_SHIFT_Y, 0)
local TempZ = mc.mcAxisGetPos(inst, mc.Z_AXIS) -- Get work position of Z-Axis
local TempA = mc.mcAxisGetPos(inst, mc.A_AXIS) -- Get work position of A-Axis
mc.mcAxisSetPos(inst, mc.A_AXIS, TempZ) -- Replace A-axis value with Z value
mc.mcAxisSetPos(inst, mc.Z_AXIS, TempA) -- Replace Z-axis value with A value
local h_OUTPUT4 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT4) --Spindle-Router swap output
local h_OUTPUT5 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT5) --Spindle dust pneumatics
local h_OUTPUT6 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT6) --Router dust pneumatics
--local h_RELAY2 = mc.mcSignalGetHandle(inst, mc.OSIG_MISTON) --Future dust collection
mc.mcSignalSetState(h_OUTPUT4, 1)
mc.mcSignalSetState(h_OUTPUT5, 1)
mc.mcSignalSetState(h_OUTPUT6, 0)

local axisID, rc = mc.mcMotorGetAxis(inst,Spindle) --Z axis maakt deel uit van variable rc om return code te bekomen
local state = mc.mcSignalGetState(h_OUTPUT4)
if ((axisID == mc.Z_AXIS) and (state == 1) and (rc==mc.MERROR_NOERROR)) then
mc.mcCntlSetLastError(inst, 'Spindle active - Output set')
return
else
mc.mcCntlSetLastError(inst, "Spindle or output not activated / process stopped")
mc.mcCntlEnable (inst, false)
end
end






5
Mach4 General Discussion / Vfd power safety output
« on: November 22, 2020, 07:56:47 AM »
Hello,

Because my spindles are setup on a second control box i would like to add a safety feature in my m6 macro.
I would like it to check if there is power on the vfd, but honestly i would not know where to start or whats done best in this situation.
I would like to rule out operation error if someone forgets to power on the spindles...
 
Is there a signal i can "get" from the vfd this way i can program an input around this that needs to be checked before the gcode can start.

Keep Safe,

Adam





6
Mach4 General Discussion / Adding field for value input
« on: November 19, 2020, 07:31:31 AM »
At the moment i have a probe height point on my table to setup quickly correct height of my tools.
But if i flycut my table, i need to adjust the value into my module each time.

Would there be a way to put a field inside my screenset where i can put the value into so that my module can pick it up?

It would save me some hassle of editing the module each time.

Keep Safe,

Adam


7
Mach4 General Discussion / Mach 4 and 2 vfd Spindles setup
« on: November 09, 2020, 05:45:09 AM »
Hello,

At the moment i'm running a setup with a 2,2kw spindle 1x230V and a 1kw router as a dual z system.
I'm quite happy with the setup except the 2.2kw spindle is too light for the machining i do.
So i've ordered a new VFD 3x230V and a 6kw spindle. I can run the new spindle along the router wich would make the mach 4 proces much easier, but would prefer to use the 2,2kw spindle as my second Z. Any ideas of how to tackle this situation in mach 4?
Can it be done to control 2 spindles within mach 4?

All the best,

Adam

8
Mach4 General Discussion / Cancel function not working in messagebox?
« on: April 23, 2020, 03:38:43 AM »
If've added ,16 to the function and get the ok and cancel option, but it aparantly does not matter.
When pushing ok or cancel, it both executes the script. So i have no option to abort when needed.

Code: [Select]
function ProbeMBZ()
mc.mcCntlSetLastError(inst, "Goto machine bed probe point")
local val = mc.mcCntlGetPoundVar(inst, mc.SV_MOD_GROUP_14) --PoundVar 4014 coordinates sytem
local msg = "G00 G90 G53 Z-20 A-20\n G59 X0 Y0\nG"..val--Use G59 as workpiece zero for position Return to current fixture
mc.mcCntlGcodeExecute(inst, msg) --Use G59 as workpiece zero for position Return to G54
wx.wxMessageBox("Load the correct tool & lower the bit within 50mm before probing. Attach the MAGNET!!!","Abort if needed",16)
mc.mcCntlSetLastError(inst, "Probing in progress!")
mc.mcCntlGcodeExecuteWait(inst,"G91 G31 Z-50 F200")
--local ToolSet = -12.8 -- Toolset plate difference machine bed / plate
mc.mcAxisSetPos(inst, mc.Z_AXIS, ToolSet)
mc.mcCntlGcodeExecute(inst,"G00 G90 G53 Z-20")
end

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

Suggestions?

Keef Safe,

David

9
I'm writing a script which involves using G59 fixture to locate my spindle and router setup to a specific point.
After the code has run i want it to return to the current fixture for example G54/G55.
Anyone who knows with api or variable i need to call and save to get this information?

I've looked trough the list, but don't seem to find the aswer to my question.

Is this even possible?

added som code to show what i want to do:

Code: [Select]
function zControl.ProbeMBZ()
mc.mcCntlSetLastError(inst, "Goto machine bed probe point")
mc.mcCntlGcodeExecute(inst, "G00 G90 G53 Z-20 A-20\n G59 X0 Y0\n G54 ") --Use G59 as workpiece zero for position Return to G54
wx.wxMessageBox("Load the correct tool & lower the bit within 50mm before probing. Attach the MAGNET!!!","If not abort",16)
mc.mcCntlSetLastError(inst, "Probing in progress!")
mc.mcCntlGcodeExecuteWait(inst,"G91 G31 Z-50 F200")
--local ToolSet = -12.8 -- Toolset plate difference machine bed / plate
mc.mcAxisSetPos(inst, mc.Z_AXIS, ToolSet)
mc.mcCntlGcodeExecute(inst,"G00 G90 G53 Z-20")
end

Adam

Keep Safe!

10
Mach4 General Discussion / Screen script to module function for button
« on: April 15, 2020, 03:39:03 AM »
I have the following code in the screen script that i want to add to the module i'm writing.
This way all my custom functions are in one place.
So if i have ever to do a rebuild of mach 4 all i have to do is to call  the functions in the buttons wanted.

For some reason i can't get the following 2 functions working:

Goto Zero (adapted screen script to module)
Code: [Select]
function GoToWorkZero() -- Screen script code
local inst = mc.mcGetInstance("GoToWorkZero()")
local val = mc.mcCntlGetPoundVar(inst, mc.SV_MOD_GROUP_3)
local msg = "G0 G53 Z-20 A-20\n G90 X0 Y0\nG" .. val
mc.mcCntlMdiExecute(inst, msg)

end

Code: [Select]
---------------Goto Work Zero module button -----------------------------------------------------------------
function zControl.GoToZero()
local val = mc.mcCntlGetPoundVar(inst, mc.SV_MOD_GROUP_3)
local msg = "G0 G53 Z-20 A-20\n G90 X0 Y0\nG" .. val
mc.mcCntlGcodeExecute(inst, msg)
mc.mcCntlSetLastError(inst, "GoTO Work Zero")
end


Park position (works directly in a button)

Code: [Select]
---------------Park position button-----------------------------------------------------------------------
function zControl.Park()
mc.mcCntlSetLastError(inst, "GoTo park position")
mc.mcCntlGcodeExecute(inst, "G00 G53 Z-20 A-20\n G53 X3100 Y1200")
end


Keep Safe!

Adam

Pages: 1 2 3 »