Hello Guest it is April 26, 2024, 05:06:39 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 - uniquerc

Pages: 1
1
Feature Requests / Re: Commission work, Macro needed please help!
« on: February 01, 2018, 07:39:00 PM »
 
' ---------------------------------------------------------------------------------
' TPS 26.01.2018 
' ATC macro for 8 places
' V 1.0.0
' ---------------------------------------------------------------------------------

' Main routine for tool change -----------------------------------------------------
Sub Main()

' declare ten global variables ----------------------------------------------------
  Dim Pos_X_Tool(8) as double

' variables for the feedrate
F_slow   = 400      'feedrate for slow moves
F_fast   = 2000      'feedrate for fast moves


'remark all TC position are in machine coordinates !!!

'variables for the X positions
Pos_X_Tool(1)   = 100.0000   'X position for tool 1
Pos_X_Tool(2)   = 200.0000   'X position for tool 2
Pos_X_Tool(3)   = 300.0000   'X position for tool 3
Pos_X_Tool(4)   = 400.0000   'X position for tool 4
Pos_X_Tool(5)   = 500.0000   'X position for tool 5
Pos_X_Tool(6)   = 600.0000   'X position for tool 6
Pos_X_Tool(7)   = 700.0000   'X position for tool 7
Pos_X_Tool(8)   = 800.0000   'X position for tool 8

'variables for the Y Position
Pos_Y_before   = 200.0000   'Y position in front of TC
Pos_Y_in      = 100.0000   'Y position in TC

'variables for the Z Position
Pos_Z_save      = 300.0000   'Z position over all that we can move (X/Y) save to TC
Pos_Z_over      = 200.0000   'Z position over the placed tool (X move possible)
Pos_Z_in      = 100.0000   'Z position in TC

'variable for toolclamp output
TC_output       = Output1
 
' ---------------------------------------------------------------------------------


   'get the tool relvated numbers
   newtool = GetSelectedTool()   'get the new toolnumber
   acttool  = GetCurrentTool()   'get the actual toolnumber

   'do some basic check's

   ' no tool loaded nothing to unload
   If ((newtool = 0) and (acttool = 0)) Then
      message("no tool loaded nothing to unload !")
      Exit Sub
   End If   

   ' nothing to do newtool = acttool
   If newtool = acttool Then
      message("nothing to do newtool = acttool !")
      Exit Sub
   End If
 
   'check toolnumber in range
   If  (((newtool > 8) Or (newtool < 1)) and (newtool <> 0)) Then
      Message (" toolnumber " & newtool & " is not in range (1-8). abort toolchange  ! ")
      DoButton(3)
      Exit Sub
   End If

   'X-axis is not referenced
   If GetOEMLED(807) Then
      Message ("X-axis no reference -> abort !!")
      DoButton(3)
      Exit Sub
   End If
   
   'Y-axis is not referenced
   If GetOEMLED(808) Then
      Message ("Y-axis no reference -> abort !!")
      DoButton(3)
      Exit Sub
   End If

   'Z-axis is not referenced
   If GetOEMLED(809) Then
      Message ("Z-axis no reference -> abort !!")
      DoButton(3)
      Exit Sub
   End If
   
   Message "change tool: " +CStr(acttool) + " to: " + CStr(newtool)
   
   'get the current position and settings
   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
   CurrentXpos      = GetOemDRO(83)      'Get t X position where we came from
   CurrentYpos      = GetOemDRO(84)      'Get t Y position where we came from
   CurrentZpos      = GetOemDRO(85)      'Get t Z position where we came from

   'Get Axis Scale factors in use
   XScale = GetOEMDRO(59)
   YScale = GetOEMDRO(60)
   ZScale = GetOEMDRO(61)

   'Set All Axis Scales to 1
   SetOEMDRO(59,1)
   SetOEMDRO(60,1)
   SetOEMDRO(61,1)
   Sleep(250)   
   
   ' turn spindle off just in case
   Code "M5"
   
   ' go to save Z position
   Message "goto Z-save"
   Code "G53 G90 G01 Z"+CStr(Pos_Z_save)+"F"+CStr(F_fast)
   WaitForMove

   'only unload tool
   If newtool = 0 Then
      'go to X/Y position (Y-before)
      Message "go to X/Y position"
      Code "G53 G90 G01 X"+CStr(Pos_X_Tool(acttool))+"Y"+CStr(Pos_Y_before)
      WaitForMove
      'goto Z-in fast
      Message "goto Z-in fast"
      Code "G53 G90 G01 Z"+CStr(Pos_Z_in)
      WaitForMove
      'go to Y position in
      Message "go to Y position in"
      Code "G53 G90 G01 Y"+CStr(Pos_Y_in)+"F"+CStr(F_slow)
      WaitForMove
      'open toolclamp
      Message "open toolclamp"
      ActivateSignal(TC_output)
      Sleep(1000)
      'goto Z-over slow
      Message "goto Z-over slow"
      Code "G53 G90 G01 Z"+CStr(Pos_Z_over)
      WaitForMove
   End If   
   
   'only load tool
   If acttool = 0 Then
      'go to X/Y position
      Message "go to X/Y position"
      Code "G53 G90 G01 X"+CStr(Pos_X_Tool(newtool))+"Y"+CStr(Pos_Y_in)
      WaitForMove
      'goto Z-over fast
      Message "goto Z-over fast"
      Code "G53 G90 G01 Z"+CStr(Pos_Z_over)
      WaitForMove
      'open toolclamp
      Message "open toolclamp"
      ActivateSignal(TC_output)
      Sleep(1000)
      'goto Z-in slow
      Message "' goto Z-in slow"
      Code "G53 G90 G01 Z"+CStr(Pos_Z_in)+"F"+CStr(F_slow)
      WaitForMove
      'close toolclamp
      Message "close toolclamp"
      DeactivateSignal(TC_output)
      Sleep(1000)
      'go to Y position before
      Message "go to Y position before"
      Code "G53 G90 G01 Y"+CStr(Pos_Y_before)
      WaitForMove
   End If   

   'full tool change
   If ((acttool <> 0) and (newtool <> 0)) Then
      'unload tool
      'go to X/Y position (Y-before)
      Message "go to X/Y position"
      Code "G53 G90 G01 X"+CStr(Pos_X_Tool(acttool))+"Y"+CStr(Pos_Y_before)
      WaitForMove
      'goto Z-in fast
      Message "goto Z-in fast"
      Code "G53 G90 G01 Z"+CStr(Pos_Z_in)
      WaitForMove
      'go to Y position in
      Message "go to Y position in"
      Code "G53 G90 G01 Y"+CStr(Pos_Y_in)+"F"+CStr(F_slow)
      WaitForMove
      'open toolclamp
      Message "open toolclamp"
      ActivateSignal(TC_output)
      Sleep(1000)
      'goto Z-over slow
      Message "goto Z-over slow"
      Code "G53 G90 G01 Z"+CStr(Pos_Z_over)
      WaitForMove
   
      'load new tool
      'go to X/Y position
      Message "go to X/Y position"
      Code "G53 G90 G01 X"+CStr(Pos_X_Tool(newtool))+"Y"+CStr(Pos_Y_in)+"F"+CStr(F_fast)
      WaitForMove
      'goto Z-in slow
      Message "' goto Z-in slow"
      Code "G53 G90 G01 Z"+CStr(Pos_Z_in)+"F"+CStr(F_slow)
      WaitForMove
      'close toolclamp
      Message "close toolclamp"
      DeactivateSignal(TC_output)
      Sleep(1000)
      'go to Y position before
      Message "go to Y position before"
      Code "G53 G90 G01 Y"+CStr(Pos_Y_before)
      WaitForMove
      
   End If   
   
   
   ' go to save Z position
   Message "goto Z-save"
   Code "G53 G90 G01 Z"+CStr(Pos_Z_save)+"F"+CStr(F_fast)
   WaitForMove

   'restore the origin values
   Code "F" &CurrentFeed          'Returns to prior feed rate
   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   

   'Put previous Axis Scale factors back
   SetOEMDRO(59,XScale)
   SetOEMDRO(60,YScale)
   SetOEMDRO(61,ZScale)
   Sleep(250)

   'set new tool
    SetCurrentTool( newtool )
   
   ' go back to the position we came from
   Message "goto origin X/Y"
   Code "G53 G01 X"+CStr(CurrentXpos)+"Y"+CStr(CurrentYpos)
   WaitForMove
   Message "goto origin Z"
   Code "G53 G01 Z"+CStr(CurrentZpos)
   WaitForMove

   'set new tool
    SetCurrentTool( newtool )
   Message " "
   
End Sub


'global Sub's
Sub WaitForMove ()
   While IsMoving()
      Sleep(15)
   Wend
End Sub


Thanks Thomas you are a live saver,    ;) ;) ;) ;) ;) ;) ;)

2
Feature Requests / Re: Commission work, Macro needed please help!
« on: January 23, 2018, 03:57:56 PM »
Thank you for your reply
machine is
x 500mm
y700mm
z 115mm
 iso20 atc spindle 2 sensors for proximity and tool in/out

controller usb motion card 16 input IO, 8 output IO

I need a macro for 8 tool rack slide in/out along X axis.
Machine needs to home, than  set tool into sliding tool holder(activate 2 relays simultaneously) to active air and release tool, move up and to next tool while relays remain on, once in position of next tool deactivate relay 2 to lock tool in, 2 seconds deactivate relay 1, slide out.  I will be storing tool offsets in mach3
same process for the other 7 tools.   Please let me know if you will need more info.

Best regards
Anna :)  

3
Feature Requests / Commission work, Macro needed please help!
« on: January 23, 2018, 10:29:35 AM »
Hello all,  anyone interested in lending a hand or a commission to write a macro for me.   I  need a macro for atc on cnc router.   the tool rack lays along the X axis on home position.   ATC spindle has tool IN/OUT sensors.  and requires two relays to release and lock the tool in place.    If anyone care to help or point me in the right direction.

Best regards
Anna


I need something similar to this video
https://www.youtube.com/watch?v=xBg1Je-2lUo

4
great thank you very much.  I will post in a month or 2 once I am done with all the mechanical components.


5
 ;)

you are correct!!!!!!
 error corrected. 

 I am new to this ATC stuff and trying to learn.

which components would you recommend to achieve  my goal. 
may I ask if you can provide the service and parts or do you know a company that can?

Best regards
Anna

6
I am getting a syntax error can you perhaps help me with this ?  


'Macro M6Start
Message""

If GetOEMLed(807) And GetOemLED(80 And GetOemLed(809) And GetOemled(811) Then
MsgBox" 1 or more axis are NOT REFERENCED cancel program and REF XYZB axis"
End
End If



Dim OldTool As Single
Dim NewTool As Single
Dim X As Double
Dim Y As Double
Dim Z As Double
'********************************
OldTool = GetCurrentTool()
NewTool = GetSelectedTool()

If NewTool = OldTool Then
MsgBox" Same Tool, NO ACTION"
End
End If


If NewTool > 10 Or NewTool < 1 Then
MsgBox" Tool # 1-10 ONLY "
End
End If


Code "M09" 'Coolant Off



Code "M05" 'Stop Spindle
Message" Coolant And Spindle Turned Off"




'******************************

Code"G53 G0 X0,Y0,Z0"
While IsMoving()
Wend


ActivateSignal(Output1) 'Tool Turret In'




ActivateSignal(Output2) 'Release Tool'
Sleep 500

Code "G53 G1 Z40 F650 "

Call MovePos(NewTool) 'The ATC moves to the new tool.
While IsMoving()
Wend

Code "G53 G1 Z0 F650"
GetOEMDro (85)




DeactivateSignal (OutPut2) 'Clamp Tool'
Sleep 1000



DeactivateSignal (OutPut1) 'Tool Turret Away'
Sleep 1500


Do
DeactivateSignal(OutPut7)
Sleep 1000
Loop


GetCurrentTool

GetOEMDro (85,40)

Sub MovePos(ByVal ToolNumber As Integer)

Select Case ToolNumber 'Positions to each tool in B-axis


Case = 1
Code " G53 G0 A 360"
Case = 2
Code " G53 G0 A 36"
Case = 3
Code " G53 G0 A 72"
Case = 4
Code " G53 G0 A 108"
Case = 5
Code " G53 G0 A 144"
Case = 6
Code " G53 G0 A 180"
Case = 7
Code " G53 G0 A 216"
Case = 8
Code " G53 G0 A 252"
Case = 9
Code " G53 G0 A 288"
Case = 10
Code " G53 G0 A 324"
End Select

End Sub

7
 :D
thank you for your reply.   

I am trying to do something like what is on this video . 
https://www.youtube.com/watch?v=nev98v3PyXk

the carousel magazine would be actuated into position with a pneumatic piston (relay) , and the carousel tool tray would be revolved with a closed loop stepper.

where would you recommend the switches to be placed?   I have 2 parallel ports available just in case I need more inputs.

8
Hello all my name is Anna.  I would like someone with experience in VB to write a MACH 3 MACRO for me.   
I need my machine to perform the following  sequence on tool change.

step1 Z AXIS  HOME

step2 Z AXIS DOWN 100MM

step3 ACTIVATE OUTPUT 3(PNEUMATIC PISTON PUSHING TOOL CHANGER CAROUSEL)

step4 WAIT 1.5SECOND

step5 ACTIVATE OUTPUT 4(DRAW CLAMP RELEASE)

step6 Z AXIS HOME

step7 SELECT DIFFERENT TOOL (AXIS A) 8 TOOL CHANGER

step8 Z AXIS DOWN 100MM

step9 DEACTIVATE OUTPUT 4(LOCK CLAMP)

step10 DEACTIVATE OUTPUT 3(PNEUMATIC PISTON RELEAVED  CAROUSEL HOME)

END OF TOOL CHANGE.

if anyone is willing to help or charge for the service please contact me.

Best regards to all
Anna


Pages: 1