Machsupport Forum
		Mach Discussion => Mach Screens => Screen designer tips and tutorials => Topic started by: gabi68 on October 11, 2009, 09:39:29 AM
		
			
			- 
				Hi to all,
 
 I have this macro (writen by Graham I think):
 
 ' Boxford 160TCL Toolchanger Macro.
 '
 ' Works by turning CW to just past the tool position
 ' and then CCW into a stop.
 ' Axis setup as rotary e.g. move 360 = 1 full turn.
 
 
 
 If IsLoading() Then
 ' Do Nothing, program loading
 Else
 
 ' Dim Variables
 
 Dim Num_Tools As Integer
 Dim CW_Steps_Per_Tool As Integer
 Dim CCW_Steps As Integer
 Dim HoldingDRO As Integer
 Dim Requested_Tool As Integer
 Dim Current_Tool As Integer
 Dim CW_Feed As Integer
 Dim CCW_Feed As Integer
 
 Dim moves As Integer
 Dim total_move As Integer
 
 
 ' set up some vars
 
 Num_Tools = 6
 CW_Move_Per_Tool = 360/Num_Tools
 CCW_Move = 10
 HoldingDRO = 1050
 Requested_Tool = GetSelectedTool()
 Current_Tool = GetUserDRO(HoldingDRO)
 CW_Feed = 1500
 CCW_Feed = 1000
 Current_Feed = GetOEMDRO(818)
 
 
 ' start tool change
 
 Message ("Requested Tool No=" & Requested_Tool)
 
 If Requested_Tool > Num_Tools Then
 Message "Requested Tool No. too high, program stopped."
 Code "M30"
 End
 End If
 
 If Requested_Tool < 1 Then
 'Message "Requested Tool No. too low, program stopped."
 Code "M30"
 End
 End If
 
 If Requested_Tool = Current_Tool Then
 ' do nothing
 Else
 ' lets do some changing
 If Requested_Tool > Current_Tool Then moves = Requested_Tool -Current_Tool
 If Requested_Tool < Current_Tool Then moves = Num_Tools - Current_Tool +Requested_Tool
 
 total_move = (moves * CW_Move_Per_Tool)+(CCW_Move/2)
 
 Code "G0 z-10 F1300"
 Code "G0 x-10"
 Code "G91 G94" 'incremental & Feed per minute
 Code "G0 A" & total_move '& "F" & CW_Feed
 Code "G0 A" & "-" & CCW_Move '& "F" & CCW_Feed
 While IsMoving()
 Wend
 
 SetCurrentTool Requested_Tool
 SetUserDRO HoldingDRO, Requested_Tool
 Code "G90" ' back to absolute movement
 Code "F" & Current_Feed
 End If
 End If
 
 ' end of tool change
 I need to put a A DRO on my lathe screen to see if my A axis is running. I don't have anything connects yet. I just want a simulation.
 How can I do that?
 
 RGDS
 Gabi
- 
				Download Mach Screen or screen 4 and open your screen set and add a dro and save the screen set. You can look in the Wiki to find the a axis dro number. Also, video tutorials that will help can be found in the support tab at the top of this page.  
 
 Mach Screen link.  http://www.kd-dietz.de/index.htm   Click on the english button then project.
 
 Screen 4 link.  http://www.machsupport.com/downloads/Screen4.zip
 
 Brett
- 
				Hi Brett,
 
 I already try that. Here it is what I do:
 -  I put that DRO on screen
 - OEM code is 86
 - X an Z axis show the right value from macro
 
 A DRO dosent show anything. Why?
 
 RGDS
 Gabi
- 
				Instead of makeing the DRO an OEM number, make it a system function, a axis.
 
 Brett
- 
				Hi Brett,
 
 I try that too and I don't see any numeber moving. Remember it is a screen for a lathe. Sorry to be a PITA but I don't know how to do that. Please help me
 
 RGDS
 Gabi
- 
				Hi Gabi,
 
 is the macro in the correct directory? Try putting a "message" like  Message ("Test toolchange") on top of the macro and run it from the mdi. This message should appear in the status line.
 
 
 Klaus
- 
				Hi Klaus,
 
 I think it is. The  path it is: C:\Mach3\macros\Mach3Turn and the name of that file it is m6661.m1s.
 
 RGDS
 Gabi
- 
				Hi Gabi
 
 did you see the message in the status line?
 
 
 Klaus
- 
				Hi Klaus,
 
 I think so. In the macro message it is "Requested Tool NO=1 till 6" It apperas on message line. That is the message you are talking about?
 
 RGDS
 Gabi
- 
				Hi Gabi,
 
 I just made a test screen.set and it worked OK, I couldn't test on a machine, because I don't have a cnc lathe. One nother thing came into my mind, do you have the A-axis enabled in your pin/port settings?
 
 Klaus
- 
				Hi Klaus,
 
 After a better look on config I found my problem. Your assumption was correct. A axis wasn't enabled. Every thing it is as should be now. I think I need more sleep  ;D.
 
 RGDS
 Gabi
- 
				 :)
 
 Thanks Klaus,
 
 Glad your running now Gabi.
 
 Brett