Machsupport Forum
		G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: robert.rakay on March 13, 2018, 02:58:06 AM
		
			
			- 
				Hi everybody.
 
 I´m looking for help with a nailgun machine.
 
 I need to activate and deactivate an output for an exact amount of time (50-100 ms) during movement of  X or Y axis, by moving the 2,5D Z-axis
 
 Im trying to do that manually for each activation with code like
 G1 G91 X40  f2000
 G1 G91 X50 Z1 F2000
 G1 G91 X60 Z-1 F2000
 ... and repeat this on every 50 x-y move
 
 But its not effective.
 
 I was thinking of using the macropump.
 Maybe with an IF (M3 is active) statement and While is Moving combination.
 
 But I dont have any solution.
 
 Im looking forward for your help or suggestions.
 
 Thanks.
 
 Robert
 
 
 
- 
				and what will be the exact Trigger for the Output.
 
 M3 isActive AND ISMoving can not be all for the Trigger.
 
 if you Need the pulse length realy exact i would use a external timer module and only do the Trigger via Mach3 Output.
 
 pls decribe a Little bit more what you are trying to do.
- 
				Thank you for your fast response
 
 
 I want to place a nail every 50 - 60 mm  (or exact lenght), but to do this the nail gun needs at least 50ms.
 
 Also I need to start every side of the product with a nail.
 
 I tought to use the actual X or Y coordinates  and maybe a variable  to send the virtual Z axis into positive state and back.
 
 Maybe something like this would work when the M3 is activated???
 
 While IsMoving()
 IF GetOEMDRO(83)= 10  Then ´ if the X position = 10mm
 Code "G1 G91 Z1 F1000"   ´To fire the first nail
 var=var+1 ´to count the number of nails
 Code "G1 G91 Z-1 F1000" ´to deactivate the output signal
 Endif
 IF GetOEMDRO(83)= 60 THen  ´here i need the next nail and like this every 50-60 mm until the end of this side of the product,
 Code "G1 G91 Z1 F1000"   ´To fire the first nail
 var=var+1 ´to count the number of nails
 Code "G1 G91 Z-1 F1000" ´to deactivate the output signal
 Endif
 
 Thanks for your help
- 
				ok Looks like you want to "fire" the nails during continious x travel ?
 
 i am sure that will not work because:
 
 -you can not execute GCode while other GCode (X/Y travel) is running.
 
 the normal way to do this is like this
 
 G1 X10 F2000
 M444
 G1 X60 F2000
 M444
 G1 X110 F2000
 M444
 ... and so on.
 
 tha macro M444 (just an example random number) will have the code to enable the nailgun.
 
 
- 
				Thank you. I will try it.
 
 I know that this is the normal way. But I was trying to do it with continous travel.
 
- 
				something like this might work in macropump
 
 	If IsMoving() Then
 If GetUserDro(1301) = 0 Then
 If (GetDro(0) > 10) And (GetDro(0) < 15)  Then
 ActivateSignal(OUTPUT2)
 SetUserDro(1300,10)
 SetUserDro(1301,1)
 End If
 
 
 If (GetDro(0) > 60) And (GetDro(0) < 65)  Then
 ActivateSignal(OUTPUT2)
 SetUserDro(1300,10)
 SetUserDro(1301,1)
 End If
 
 If (GetDro(0) > 110) And (GetDro(0) < 115)  Then
 ActivateSignal(OUTPUT2)
 SetUserDro(1300,10)
 SetUserDro(1301,1)
 End If
 End if
 End If
 
 If GetUserDro(1300) >= 0 Then
 SetUserDro(1300,GetUserDro(1300)-1)
 If GetUserDro(1300) = 0 Then
 DeactivateSignal(OUTPUT2)
 SetUserDro(1301,0)
 End If
 End If
 
- 
				Oh wow. You suprised me, thank you. I will try it later if I get to the machine
			
- 
				I wonder if you could use the M10/M11 laser fire commands to fire the nail gun? They are like a M03/M05 but without the delays. Using a G64 at the beginning of the file and using the  M10/M11 to fire the nail gun might get you what you want.
 
 
 Mike