Hello Guest it is March 28, 2024, 07:22:41 PM

Author Topic: macro for 4 slot tool change hep  (Read 7400 times)

0 Members and 1 Guest are viewing this topic.

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: macro for 4 slot tool change hep
« Reply #10 on: April 16, 2019, 01:46:51 PM »
ok, not good,
give me pls some more Information about your complete System.

Thomas
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: macro for 4 slot tool change hep
« Reply #11 on: April 16, 2019, 05:21:24 PM »
ok, not good,
give me pls some more Information about your complete System.

Thomas


hello
it is a Avon 5500 cnc Rebild
with a cismo ip- controller running mach 3 lates version.


i just downloadet march to a different pc. copied the macro in to vb skript same result, vb crashes.   

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: macro for 4 slot tool change hep
« Reply #12 on: April 17, 2019, 01:36:07 AM »
strange.

i have tested the code here on a
Version R3.043.066 and
Version R3.043.022

both with a CSMIO -IP S
and no Problem.

try to copy line by line to the VB scripter window
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: macro for 4 slot tool change hep
« Reply #13 on: April 24, 2019, 08:46:51 AM »

Hello again. I am sorry for the late reply.
I have caused the system to not break down.


when I run the code with T0101m6 I only get activated (output 9).

  I've tried to change

(If Not IsActive (Input22) Then
       NewTool = 1)

to

(If IsActive (Input22) Then
       NewTool = 1)

It should be right in my case.

But nothing happens spindel just keep rotating :(

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: macro for 4 slot tool change hep
« Reply #14 on: April 24, 2019, 12:18:14 PM »
try this code, now you should see in Status line witch TC place is detected by the Inputs

Code: [Select]
OldTool = GetCurrentTool()
Tool = GetSelectedTool()
MaxToolNum = 4      'Max number of tools for the changer

Message "OldTool: " & OldTool & " NewTool: " & Tool
Sleep(200)

If OldTool = Tool Then
Message ("Selected Tool already loaded")
Exit Sub
End If

While Tool > MaxToolNum
Tool = Question ("Enter New Tool Number up to " & MaxToolNum)
Wend

Call StartTool

While NewTool <> Tool
   Call CheckPins
   While IsMoving()
   Wend
Wend

Call StopTool

SetCurrentTool(NewTool)

'//// Subroutines /////////

Sub StartTool
   ActivateSignal(Output8)
   'Code "G4 P4.0"    'Wait for the tool to rotate past the sensor
      While IsMoving()
      Wend
End Sub

Sub CheckPins
   If IsActive(Input22) Then
      NewTool = 1
      End If
   If IsActive(Input21) Then
      NewTool = 2
      End If
   If IsActive(Input20) Then
      NewTool = 3
      End If
   If IsActive(Input19) Then
      NewTool = 4
      End If
  Message "NewTool= " & NewTool
  Sleep(200)
End Sub

Sub Stoptool
   DeActivateSignal(Output8)
      While IsMoving()
      Wend
   ActivateSignal(Output9) 
      Code "G4 P1.0"    'Wait for the tool to rotate onto ratchet stop
      While IsMoving()
      Wend
   DeActivateSignal(Output9)
      While IsMoving()
      Wend
End Sub 
« Last Edit: April 24, 2019, 12:20:11 PM by TPS »
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: macro for 4 slot tool change hep
« Reply #15 on: April 24, 2019, 03:40:20 PM »
hi
i dont think the macro can detect the input.
i set input 22 to input 4 in my system witch is always aktive. an the macro cant detect that ether.

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: macro for 4 slot tool change hep
« Reply #16 on: April 25, 2019, 02:40:16 AM »
added some more debug info in this code. pls run this code and (assume you use Mach3 Standard
turn screenset) go to Diags. an use the History Button.
post the Textfile after running the macro.

Code: [Select]
OldTool = GetCurrentTool()
Tool = GetSelectedTool()
MaxToolNum = 4      'Max number of tools for the changer
debug = true

If debug = true Then
Message "OldTool: " & OldTool & " NewTool: " & Tool
Sleep(200)
End If

If OldTool = Tool Then
Message ("Selected Tool already loaded")
Exit Sub
End If

While Tool > MaxToolNum
Tool = Question ("Enter New Tool Number up to " & MaxToolNum)
Wend

Call StartTool

While NewTool <> Tool
   Call CheckPins
   While IsMoving()
   Wend
Wend

Call StopTool

SetCurrentTool(NewTool)

'//// Subroutines /////////

Sub StartTool
   ActivateSignal(Output8)
   If debug = true Then
Message "Output8 On"
Sleep(200)
   End If
   'Code "G4 P4.0"    'Wait for the tool to rotate past the sensor
      While IsMoving()
      Wend
End Sub

Sub CheckPins
   If IsActive(Input22) Then
      NewTool = 1
      End If
   If IsActive(Input21) Then
      NewTool = 2
      End If
   If IsActive(Input20) Then
      NewTool = 3
      End If
   If IsActive(Input19) Then
      NewTool = 4
      End If
  If debug = true Then
Message "NewTool= " & NewTool
Sleep(200)
  End If
End Sub

Sub Stoptool
   DeActivateSignal(Output8)
   If debug = true Then
Message "Output8 Off"
Sleep(200)
   End If
      While IsMoving()
      Wend
   ActivateSignal(Output9) 
   If debug = true Then
Message "Output9 On"
Sleep(200)
   End If
      Code "G4 P1.0"    'Wait for the tool to rotate onto ratchet stop
      While IsMoving()
      Wend
   DeActivateSignal(Output9)
   If debug = true Then
Message "Output9 Off"
Sleep(200)
   End If
      While IsMoving()
      Wend
End Sub 
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: macro for 4 slot tool change hep
« Reply #17 on: April 25, 2019, 02:45:56 AM »
  I want to make sure my imput is working properly.
I want to try with a simple macro.


ActivateSignal(Output8) when (input 22) is on then DeActivateSignal(Output8)

is this correkt ?

ActivateSignal(Output8)
If IsActive(Input22) Then
DeActivateSignal(Output8)

End if

Re: macro for 4 slot tool change hep
« Reply #18 on: April 25, 2019, 02:48:36 AM »
ok i will go out and Try it now

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: macro for 4 slot tool change hep
« Reply #19 on: April 25, 2019, 02:54:40 AM »
Code: [Select]
ActivateSignal(Output8)
While NOT IsActive(Input22)
Sleep(50)
Wend
DeActivateSignal(Output8)

would be the code for a simple test
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.