Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: Damir on April 15, 2015, 11:52:05 AM
-
Hello
If someone can help me with the script, I currently use 4-axis in the tangential mode.
4-axis rotates servo motor (step / dir), which serves as a spindle motor.
My question is, spindle motor should run only until the 4-axis is not moving, and stop when moving 4-axis.
4-axis movement detected by capacitive sensor (input1)
thanks
-
Hi,
macropump can help:
If IsActive(Input1) Then
DoSpinStop()
End If
Thomas
-
I tried with this script:
If Not IsActive(Input1) Then
DoSpinCW()
End if
If IsActive(Input1) Then
DoSpinStop()
End if
End
and works but it is immediately activated and working all the time and to jog, G0 and G1.
I need a script that would be activated only in G1.
Thanks
-
Hi,
something like this might work:
act_feedrate=GetDro(18)
If (act_feedrate<1500) and (GetLed(4)=1) Then
If Not IsActive(Input1) Then
DoSpinCW()
End if
If IsActive(Input1) Then
DoSpinStop()
End if
End If
Thomas
-
Thank you for helping me.
Unfortunately does not work, script the Start spindle motor but not turn off spindle when the input is active.
thanks
-
Ok seems not to be so easy,
act_feedrate=GetDro(18)
If (act_feedrate<1500) and (GetLed(4)=1) Then
If Not IsActive(Input1) Then
DoSpinCW()
End if
End If
If IsActive(Input1) Then
DoSpinStop()
End if
Thomas
-
does not work
when first detected active (input1) turns off spindle motor and then do not turn on spindle.
question:
Could we use M code in the G-code to activate the script, for example M3 activate script, M5 deactivate script (or we can create some other M code),
because we are in the script from before had a problem because she started immediately as soon as start Mach3?
thanks
Damir
-
Hello,
--Could we use M code in the G-code to activate the script, for example M3 activate script, M5 deactivate script (or we can create some other M code),
--because we are in the script from before had a problem because she started immediately as soon as start Mach3?
--thanks
--Damir
please try to explane what is the real clue behind this fuctionality,
because for the moment i am not that i understand 100% the thing.
maybe a snipped of your g-code wold help.
Thomas
-
I make a machine for making rugs and use tufting head (driven by servo motor) tufting head rotates 360 degrees.Such a script I need to stop the servo motor while the tufting head rotates, otherwise makes mistakes and hitting too many yarns in one place.
this is an example of my G-coda:
G21 (metric ftw)
G90 (absolute mode)
G91.1 X0.00 Y0.00 Z0.00 F2500.00 (axis position)
G91.1 Z0.00 F2500.00
M01 (Tufting yarn colors 'Layer 1')
(Tufting consisting of 1 segments.)
G0 X98.20 Y120.82
Z70.00 (z-axis in the position)
M3 G4 P3 (needle start wait 3ms)
G1 X-96.94 Y120.82
G1 X-96.94 Y114.33
G1 X98.20 Y114.33
G1 X98.20 Y107.84
G1 X-96.94 Y107.84
G1 X-96.94 Y101.35
G1 X98.20 Y101.35
G1 X98.20 Y94.86
G1 X-96.94 Y94.86
G1 X-96.94 Y88.36
G1 X98.20 Y88.36
G1 X98.20 Y81.87
G1 X-96.94 Y81.87
G1 X-96.94 Y75.38
G1 X98.20 Y75.38
G1 X98.20 Y68.89
G1 X-96.94 Y68.89
G1 X-96.94 Y62.40
G1 X98.20 Y62.40
G1 X98.20 Y55.91
G1 X-96.94 Y55.91
G1 X-96.94 Y49.42
G1 X98.20 Y49.42
G1 X98.20 Y42.93
G1 X-96.94 Y42.93
G1 X-96.94 Y36.44
G1 X98.20 Y36.44
G1 X98.20 Y29.94
G1 X-96.94 Y29.94
G1 X-96.94 Y23.45
G1 X98.20 Y23.45
G1 X98.20 Y16.96
G1 X-96.94 Y16.96
G1 X-96.94 Y10.47
G1 X98.20 Y10.47
G1 X98.20 Y3.98
G1 X-96.94 Y3.98
M5 Z0.00 (needle stop z-axis in the position)
G4 P0 (wait 0ms)
(end of tuft job)
M5 Z0 (needle stop z-axis in the position)
G4 P0 (wait 0ms)
G0 X0 Y0 Z0 A0 F2500.00 (go back to zero)
-
Hi Damir,
makes it a little bit clearer
put this in macropump:
act_feedrate=GetDro(13)
If (act_feedrate<3500) and (GetLed(4)=True) Then
If Not IsActive(Input1) Then
DoSpinCW()
End if
End If
If IsActive(Input1) Then
DoSpinStop()
End if
what i try to do with this:
act_feedrate=GetDro(13)
If (act_feedrate<3500) and (GetLed(4)=True) Then
is to the check the atual feedrate the 3500 must be lower than your G0 feedrate and
higher than your max G1.
try to use this to seperate between G0 and G1.
the GetLed(4)=True is to check that a g-code programm ist started.
Thomas
-
changed getdro(18) to getdro(13)
sorry wrong dro
-
Hello Damir,
the feedrate thing is not working to seperate between
G0 and G1. if i look to your g-code maybe we can use the
z-axis as second trigger like this:
act_Z=GetDro(2)
If (act_Z>69) and (GetLed(4)=True) Then
If Not IsActive(Input1) Then
DoSpinCW()
End if
End If
If IsActive(Input1) Then
DoSpinStop()
End if
Thomas
-
What exactly is it that you are trying to do ?? I would love to help BUT I have no idea as to what you need. Do you have a picture of the machine ??
(;-) TP
-
Hello Damir,
the feedrate thing is not working to seperate between
G0 and G1. if i look to your g-code maybe we can use the
z-axis as second trigger like this:
act_Z=GetDro(2)
If (act_Z>69) and (GetLed(4)=True) Then
If Not IsActive(Input1) Then
DoSpinCW()
End if
End If
If IsActive(Input1) Then
DoSpinStop()
End if
Thomas
My Z-axis is never constant so that every time I need to change the script.
-
Thanks BR549
-
Hello Damir,
if the function should only be enabled between M3 and M5 call in
g-code we can use them to enable like this:
add this conde in M3
setUserLed(2100,1)
add this conde in M5
setUserLed(2100,0)
and this in macropump
If (GetUserLed(2100)=True) and (GetLed(4)=True) Then
If Not IsActive(Input1) Then
DoSpinCW()
End if
End If
If IsActive(Input1) Then
DoSpinStop()
End if
the only thing i see, that nothing resets the UserLed if
you cancle a program.
but give it a try.
Thomas
-
Unfortunately again nothing
Start spindle motor and turn it off when it detects input, after that it does not start spindle motor.
Damir
-
Hello Damir,
tested here:
M3
setUserLed(2100,1)
M5
setUserLed(2100,0)
macropump
If GetOEMLed(2100) and GetLed(4) Then
If IsActive(Input1) Then
DoSpinStop()
else
DoSpinCW()
End if
End If
don't ask me why GetUserLed does not work, GetOEMLed is working.
Thomas
-
ok i am pretty sure the next problem will be the dwell of the spindle,
because it is locking axis movement and so Input1 will go off again.
so i think the only practicable way well be to drive a axis not tangential and
control it miz g-code, something like this:
G0 Z0 A0
G0 X100 Y100
G0 Z70
M3
G1 X0
M5
G1 A90
M3
G1 Y80
M5
G1 A180
M3
G1 X100
M5
G1 A90
and so on.
what means you can only do straight line an no circles
(witch would not work anyway with this code for turn on/off spindle)
Thomas
-
OK there are 2 servos one drives the tufting head ( C axis ) and the other(Z axis) does what ? Why don't you simply program the stops and starts in the Gcode program ??
(;-) TP
-
Hello Damir,
tested here:
M3
setUserLed(2100,1)
M5
setUserLed(2100,0)
macropump
If GetOEMLed(2100) and GetLed(4) Then
If IsActive(Input1) Then
DoSpinStop()
else
DoSpinCW()
End if
End If
don't ask me why GetUserLed does not work, GetOEMLed is working.
Thomas
Thanks TPS
I just tried this script and works perfectly.
thank you very much