Hello Guest it is March 28, 2024, 05:07:54 PM

Author Topic: Open/Close Spindle Collet....Best Way  (Read 10859 times)

0 Members and 1 Guest are viewing this topic.

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Open/Close Spindle Collet....Best Way
« Reply #10 on: February 15, 2008, 11:22:06 PM »
perhaps I should restate that then.

  If two macros are BOTH running at the same time doing things at the same time then it wont work.
In Mach there is only room for One macro to run at a time, (NOTE: macro pump is compiled).
If you have a macro within a macro and when the second macro executes within the 1st but the 1st isnt really doing anyting else at that time, then It would work. But if both Macros are trying to do different things to the same object the only the last one processed in the pipe will win.

Read Art's "Mach Mysteries" explained and he goes into this in more detail.

Scott
fun times
Re: Open/Close Spindle Collet....Best Way
« Reply #11 on: July 23, 2008, 11:51:01 PM »
Had this working well in sim.
IN4 with a hotkey.....shows in diag.
Enabled Out 5.
Now it stops at the M801 and goes no further.
Doesn't move to Z4  X4
Can you see why ?
Thanks,
rc
« Last Edit: July 23, 2008, 11:58:03 PM by Overloaded »

Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: Open/Close Spindle Collet....Best Way
« Reply #12 on: July 24, 2008, 06:10:42 AM »
Replacing "Code M5" with the VB command DoSpinStop() is better.

Graham.
Without engineers the world stops

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Open/Close Spindle Collet....Best Way
« Reply #13 on: July 24, 2008, 06:37:23 AM »
Hey Overloaded here is the corrected file, you had an "floating IF in there"

here is the code line with the if that was in your code just sitting there. (I put stars around it so you can see it).

**If** deActivateSignal(OUTPUT5)   'Close collet
Code "G4 p1"         '1 second pause gives collet time to clamp
While IsMoving()      'Give more or less seconds depending on closure time.
Wend

Here is the corrected code, and I change the M5 to dospinstop():

Sub Main()


'M800.m1s Bar Stock Feeder


'OUTPUT5 is open collet, OUTPUT6 is close collet, INPUT4 Barstop signal



Dim StopPositionX, StopPositionZ



StopPositionX= 4      'Stop location in X axis in machine coordinates

StopPositionZ= 4      'Stop location in Z axis in machine coordinates

DoSpinStop()          'Stop Spindle


Code "G0 G53 X" & StopPositionX & " Z" & StopPositionZ

While IsMoving()

Wend



ActivateSignal(OUTPUT5)   'Open collet

Code "G4 p2"         '2 second pause give stock time to move forward

While IsMoving()      'Give more or less seconds depending feed forward time

Wend                  'I didnt use a wait for or a while statement so not to tie you your processor.



If Not(IsActive(INPUT4)) Then

Message("Out of Stock")

Exit Sub

End If

DeActivateSignal(OUTPUT5)   'Close collet

Code "G4 p1"         '1 second pause gives collet time to clamp

While IsMoving()      'Give more or less seconds depending on closure time.

Wend

End Sub

'scott



fun times
Re: Open/Close Spindle Collet....Best Way
« Reply #14 on: July 24, 2008, 08:18:53 AM »
Thanks to you both.
Scott, not saying the floating "If" is not in the original...but I cannot see it in the editor here.
No doubt it's there but it seems to be hidden.
Is that possible ?
Here are two screenshots. The first one (801) is the original with the "If" and doesn't run, the second one (802) runs fine.
Can you show a screenshot of what you see when you open the original with the "Floater"?
Thanks,
RC