Hello Guest it is April 23, 2024, 10:53:06 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 - reuelt

181
VB and the development of wizards / Re: VB script converstion to Mach4
« on: April 27, 2019, 01:30:13 AM »
"Any help would be appreciated"

Hi
I have just translated your m6start.mls (for MACH3)
to m6.mcs  (for MACH4)

It is an OFF THE CUFF draft, so you need to check for syntax errors with the zerobrane editor and do all the debugging by yourself and/or with the help of others.
Without knowing what will be your MACH4 motion controller, I can only do this much.


 ‘m6.mcs - untested
function m6()
local inst = mc.mcGetInstance()
local hsig = mc.mcSignalGetHandle(inst, mc.OSIG_SPINDLEFWD)
local spinstate = mc.mcSignalGetState(hsig)
[mc.ISIG_INPUT2]=function(input2State)
local SelectedTool = mc.mcToolGetSelected(inst)
local CurrentTool = mc.mcToolGetCurrent(inst)
local TurretClickOut =  mc.mcSignalGetHandle (inst,mc.OSIG_OUTPUT2)
local Turretsig = mc.mcSignalGetHandle(inst, TurretClickOut)
------ Get current state ------
local CurFeed = mc.mcCntlGetPoundVar(inst, 2134)
local CurFeedMode = mc.mcCntlGetPoundVar(inst, 4001)
local CurAbsMode = mc.mcCntlGetPoundVar(inst, 4003)
if input2State ==1 then
mc.mcCntlSetLastError(inst, string.format(‘Connect Air Pressure to Turret!!'))
   else
mc.mcCntlSetLastError(inst, string.format(‘Turret Index Warning '))
   end
end
currentFace = (currentTool - 1) % 4
targetFace = (selectedTool - 1) % 4
'rotate turret required number of "clicks"
For click = 1, (targetFace - currentFace + 4) % 4,1  'rotate accounting for rollover
Do
mc.mcSignalSetState(Turretsig, 1)
wx.wxMilliSleep(500)
mc.mcSignalSetState(Turretsig, 0)
wx.wxMilliSleep(1500)
if input2State ==1 then
wx.wxMilliSleep(100)
end
end
return

182
[CycleStart] is Alt-R on keyboard
So what you need to do is
connect a relay to an unused INPUT pin.
Then assign an OEM Trigger to it in INPUT SIGNALS settings of ports and pins say OEM_Trig#1
Then make the OEM_Trig#1  emulate keyboard scan code of Alt-R which is 1000.
see attached

Then your PLC triggering a relay (connected to OEM_trig#1  pin) should be able to remotely [CYCLE-START] loaded Mach3 program.


183
G-Code, CAD, and CAM discussions / Re: Simple M6 Manual Tool Change
« on: April 26, 2019, 03:24:53 PM »

'please add safez=0 to get it defined


ToolChangeX = GetUserDRO(1200)            'Get user defined tool change location
ToolChangeY = GetUserDRO(1201)
ToolChangeZ = GetUserDRO(1202)   
safeZ=0

If IsSafeZ() Then               'If SafeZ is defined,
   safeZ = GetSafeZ()            'use it for positioning commands
Else
   safeZ = 0               'Otherwise, moves are made at MC Z0
End If
Code" G53 G0 Z" & safeZ               'Position spindle for tool change
While IsMoving()
Wend
Code"G53 G0 X" & ToolChangeX & "Y" & ToolChangeY
While IsMoving()
Wend
Code"G53 G0 Z" & ToolChangeZ
While IsMoving()
Wend

184
G-Code, CAD, and CAM discussions / Re: Simple M6 Manual Tool Change
« on: April 26, 2019, 02:45:11 PM »
is there a macro available to get the "tool change location" option in mach3 to function,,,and goto x,y,z bed location when a tool change is requested .

'You will need to edit m6Start.m1s macro (add the following lines there) to do that.

ToolChangeX = GetUserDRO(1200)            'Get user defined tool change location
ToolChangeY = GetUserDRO(1201)
ToolChangeZ = GetUserDRO(1202)   
     
If IsSafeZ() Then               'If SafeZ is defined,
   safeZ = GetSafeZ()            'use it for positioning commands
Else
   safeZ = 0               'Otherwise, moves are made at MC Z0
End If
Code" G53 G0 Z" & safeZ               'Position spindle for tool change
While IsMoving()
Wend
Code"G53 G0 X" & ToolChangeX & "Y" & ToolChangeY
While IsMoving()
Wend
Code"G53 G0 Z" & ToolChangeZ
While IsMoving()
Wend

185

Is there a Gcode type command that could be added at the beginning of the program - Wait for input to go true and if that input went true then start running and executing the Gcode program again.
If so, can you assign the start to a input in mach3?

Miscellaneous functions, called M codes, are used by
the CNC to command on/off signals to the machine
functions.
i.e.
MØ3 - spindle forward (CW),
MØ5 - spindle stop stop, etc.....
M07 -  mist coolant on
M08 -  Flood coolant on
M09 - All coolant off

You would note that M## codes normally output a signal to a pin of a parallel port that can be used in the Break Out Board (BOB) to control a RELAY on or off.
So the RELAY is what will "push the button" to on your extruder or conveyor belt to load material etc

Attached is the MACH3 std M-codes list.

Std M codes can be edited (modified) and you can also create your own (higher number) M codes too.

But for your requirements, you can for simplicity (& proof of concept) initially adapt
M03 or M04 to on  and M5 to off
M07 or M08 to on and M9 to off
YOUR extruder machine.
The PWM or 0-10V output can be used to control the flow rate of the extruder material

You could use G4 to wait

To further assist you, it would be good that you let us know your motion controller (parallel port or ext USB or ext Ethernet) and BOB brand and model.




186
'  Faster Ref. ALL Home script by Reuel  updated thanks to ZASto & TPS - now works in either imperial or metric unit

Speak (" FASTER Referencing all home.") 'VOICE Alert

Message "************ FASTER Reference all home Started************"
Sleep (1000) ' Pause 1 second
CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state

DoOEMButton( 1024 ) ' Ref (home) Z Axis
While IsMoving()
Wend
DoOEMButton(135)  ' Zero Z Encoder

Code "G90"
If GetOemLed(801) Then 'imperial units check
  Code "G53 G0 Y1 X1"  'fast move to Y1 X1 in inches
Else
  Code "G53 G0 Y25 X25" 'fast move to Y25 X25 in mm
End If
While IsMoving()
Wend

DoOEMButton( 1023 )' Ref Y Axis
DoOEMButton( 1022 )' Ref X Axis
DoOEMButton( 1025 )' Ref A Axis
DoOEMButton( 1026 )' Ref B Axis
DoOEMButton( 1027 )' Ref C Axis

DoOEMButton(134)  ' Zero Y Encoder
DoOEMButton(133)  ' Zero X Encoder
DoOEMButton(136)  ' Zero A Encoder
DoOEMButton(137)  ' Zero B Encoder
DoOEMButton(138)  ' Zero C Encoder
While IsMoving()
Wend

Code "G54"
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If   


Speak ("FASTER Reference all home Completed") 'Voice Alert
Message "************  FASTER Reference all home Completed************"     

187
Mach Screens / Re: chinese cnc probing macros?
« on: April 26, 2019, 02:53:17 AM »
Quote
'Note that there are also, FRENCH and ITALIAN probing macros (posted in this forum) that DO NOT use those legacy setvar() and getvar() functions.

GetVAR() is not a "legacy" function. It's the proper and only accurate way to read the trip point. And the majority of chinese controllers do not support it's use.

See attached cut from "Mach3 V3.x Macro Programmers Reference.pdf" by NFS.


188
Thanks
Do you know how make the script grab the data from the "SLOW ZONE" column of  in config | motor home/soft limits?
Then it is not only units independent but also slow zone distance can be easily changed by users too.

Reuel

189
' Faster Ref. ALL Home script by Reuel
Speak (" FASTER Referencing all home.") 'VOICE Alert

Message "************ FASTER Reference all home Started************"
Sleep (1000) ' Pause 1 second
CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state

DoOEMButton( 1024 ) ' Ref (home) Z Axis
While IsMoving()
Wend
DoOEMButton(135)  ' Zero Z Encoder

Code "G90"
Code "G53 G0 Y25"  '25 mm may be change to 1 inch
While IsMoving()
Wend
Code "G53 G0 X25"  '25 mm may be change to 1 inch
While IsMoving()
Wend

Code "F1200"
DoOEMButton( 1023 ) ' Ref Y Axis
DoOEMButton( 1022 )' Ref X Axis
DoOEMButton( 1025 )' Ref A Axis

DoOEMButton(134)  ' Zero Y Encoder
DoOEMButton(133)  ' Zero X Encoder
DoOEMButton(136)  ' Zero A Encoder
While IsMoving()
Wend

Code "G54"
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If   


Speak ("FASTER Reference all home Completed") 'Voice Alert
Message "************  FASTER Reference all home Completed************"     



'idea is to get Z to the top slowly first (for safety) then move Y and X at G0 speed to 25mm from home switches and then move slowly towards the switch. The slow speed part is still controlled by speed % settings in config || motor home/soft limits as usual.
' Change 25 (mm) to 1 (inch) in 2 places if you use inches units.

'suggestions to improve on it welcomed

190
Mach4 General Discussion / Re: Tangential knife Mach 4
« on: April 25, 2019, 06:13:36 PM »
I have a feeling the knife may need to be lowered a little more so that it is oscillating deeper & hence slightly wider.