Hello Guest it is January 16, 2021, 12:17:48 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 - TPS

1561
ok made some changes in your code:

Code: [Select]

Sub Main()
'Global variables declaration

Dim CCWPos as Integer
Dim CWPos as Integer


NewTool = GetSelectedTool()
OldTool = GetCurrentTool()

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

If NewTool = OldTool Then'Compare between actual tool and requested tool
   Else
   End If
If NewTool > 8 Then'requested tool higher then tool numbers
   Else
   End If
If NewTool < 1 Then'tool number to low
   Else
   End If

code("m05")
   Call ZatcPosition
   Call AtcIn'Activate air cylinder valve to put old tool back to carrousel
   Call Unclamp'Spindle: Tool Unclamp
   Call AtcDown'lowers atc
   Call LeastTravel'determine the least travel to move and Turns CW or CCW
   Call AtcUp'raises atc
   Call Clamp'Spindle: Tool Clamp
   Call AtcOut'retracts atc
   Call SetUserDRO (1200,NewTool)'Store new tool as actual tool value
SetCurrentTool( NewTool )

End Sub

Function ZatcPosition()'Move to Z tool position and wait until position reached
   code("G53")'Move in Absolute Machine coordinates
   code("G00 Z-1") 'Z value as to be checked for exact match with carrousel height
   While(IsMoving())
      Sleep(100)'temporisation entre while++
   Wend
End Function

Function AtcIn()'Put old tool back to carrousel
      ActivateSignal(OUTPUT4)'Move carrousel air cylinder to the tool change position adjust output# to match atc slide
      code("g04 p01")
End Function

Function Unclamp()'Spindle: Tool Unclamp
       ActivateSignal(OUTPUT6)'Release the tool, adjust output number for drawbar output
code("g04 p01")'pause
End Function

Function AtcDown()'lowers atc to rotate
   ActivateSignal(OUTPUT5)'solonoid to lower atc
   code("G04 p01")'pause
End Function

'Sequence to determine the least travel to move for TC, CW or CCW
Function LeastTravel()
   NewTool = GetSelectedTool()
   OldTool = GetCurrentTool()
   NTool = 8 ' Number of tools changer holds
   CWPos = GetSelectedTool() - GetCurrentTool() ' Assume a CW move
   If CWPos < 0 Then ' CWPos < 0 ==> rtp < atp
      CWPos = CWPos + NTools
   End If
   CCWPos = NTools - CWPos
   If CWPos < CCWPos Then
      Call CW()
   Else
      Call CCW()
   End If
End Function

Function CW()'Rotation CW
   Dim x As Integer
   Dim CTPos As Integer 'Carrousel Tool Position Relative to OldTool Position
   CTPos=0
   ActivateSignal(OUTPUT7)'Turns the AC Motor On
   Deactivatesignal(output8)'atc motor revirsing relay
   
   code"g04 p05"
   Do Until IsActive(input1)
sleep(10)
   Loop
      For x=0 To CWPos
         If IsActive(input1) Then
            x=x+1
            While IsActive(input1)'Wait for OEMTrig to de-assert
            Wend
         End If
      Next x
      CTPos=x
   DeactivateSignal(OUTPUT7)
End Function

Function CCW()'Rotation CCW
   Dim y As Integer
   Dim CTPos As Integer 'Carrousel Tool Position Relative to OldTool Position
   CTPos=0
   Activatesignal(output8)'atc motor revirsing relay
   ActivateSignal(OUTPUT7)'Turns the AC Motor On

   code"g04 p05"
   Do Until IsActive(input1)
sleep(10)
   Loop
   For y=0 To CCWPos
      If IsActive(input1) Then
      y=y+1
         While IsActive(input1)'Wait for OEMTrig to de-assert
         Wend   
      End If           
   Next y
   CTPos=y
   DeactivateSignal(OUTPUT7)
   Deactivatesignal(output8)
End Function

Function AtcUp()'lifts atc
   DeActivateSignal(OUTPUT5)'relay for solonoid to lower/lift atc
   code("G04 p01")'pause
End Function

Function Clamp()'power drawbar unactivated
   DeactivateSignal(OUTPUT6)'unactivating drawbar relay
End Function

Function AtcOut()'retracts atc
      deActivateSignal(OUTPUT4)'atc retract cylinder relay
      code("g04 p01")
End Function



please try in vbeditor step in mode and Report Errors, sorry have no Chance to test.
Thomas

1562
no i have no code to replace,
tryed to make you think about your code.

1563
ok lets try to read your code:

############################################################################################
   Dim x As Integer
   Dim CTPos As Integer 'Carrousel Tool Position Relative to OldTool Position
   CTPos=0

--> some declarations


   ActivateSignal(OUTPUT7)'Turns the AC Motor On

--> Switch Output 7 on

   code"g04 p05"

--> wait a Little bit

   Do Until IsActive(input1)
   ActivateSignal(OUTPUT7)'Turns the AC Motor On
   deactivatesignal(output7)
   sleep(0)
   Loop

--> Switch Output 7 on and off until input1 is on makes no sence
--> sleep(0) also senseless

      For x=0 To CWPos
         If IsActive(input1) Then
            x=x+1
            While IsActive(input1)'Wait for OEMTrig to de-assert
            Wend
         End If
      Next x

--> CWPos is no global variable and no Inputparameter of the function so nothing will happen

      CTPos=x

--> will be Zero, see Problem of CWPos

   DeactivateSignal(OUTPUT7)

--> Switch Output7 off , so it only will be on for G04 P5 nothing else

Regards Thomas

1564
if you are talking about length Offset

G43 HXX

is your friend.

1565
hi,
i am not sure, but you can try also:

DoButton(1)

should be the same, but let's try.

Thomas

1566
to use a macro function instead G31 will allways be to slow-

1567
VB and the development of wizards / Re: imagebox
« on: January 29, 2016, 03:24:15 AM »
Hi,

that is how i did it two years ago.

script from the file open button:

Code: [Select]
Dim objDialog
Dim filesys
set filesys=CreateObject("Scripting.FileSystemObject")



' Create a dialog object
Set objDialog = CreateObject( "UserAccounts.CommonDialog" )
objDialog.InitialDir = "C:\Programme\Platemaster\Projekte"
objDialog.Filter = "Programm|*.tap"
' Open the dialog and return the selected file name
If objDialog.ShowOpen Then


If filesys.FileExists(Left(objDialog.FileName, Len(Trim(objDialog.FileName)) - 4) + ".bmp") Then
filesys.CopyFile Left(objDialog.FileName, Len(Trim(objDialog.FileName)) - 4) + ".bmp", "C:\Mach3\Bitmaps\Platemaster\Anzeige.BMP"
    End If
LoadStandardLayout()
Sleep(3000)
LoadFile(objDialog.FileName)

Else
GetFileName = ""
End If


Thomas

1568
VB and the development of wizards / Re: Edge detection on input
« on: January 13, 2016, 05:51:45 PM »
can you see Input1 changing signal in diagnostic Screen ?

While is moving
Wend

is useless because no 'real' axis is moving.

TPS

1569
CS-Lab / Re: CSMIO/IP-S vs Panasonic Minas A5
« on: December 12, 2015, 05:02:54 AM »
TPS, does the above make sense to you and back up your suggested parameters?

not realy.

1570
CS-Lab / Re: CSMIO/IP-S vs Panasonic Minas A5
« on: December 10, 2015, 05:21:13 PM »
Hi Ziad,

only had time for a quick look.

i think

Pr0.06 --> 1
Pr0.07 --> 3

or

Pr0.06 --> 0
Pr0.07 --> 3

should be ok.

TPS