Hello Guest it is April 19, 2024, 02:25:57 PM

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 - Sargon

Pages: « 1 2 3 4 5 6 7 8 9 10 »
81
VB and the development of wizards / Re: Oxy Fuel Safety timer
« on: July 04, 2011, 06:28:37 PM »
Sinkyster:

1) See code below. Much easier to decipher when it has comments!

2) Also see code below!

3) In machscreen click the button and change it's function from Cycle Start to the Execute VBScript function. Paste in the code and change it to fit your needs. The code is now embedded into the CycleStart button.

Enjoy!

**********CODE**********
Option Explicit            'Require variables to be defined by DIM before using. Reduces typing mistakes and headaches dramatically.

Const CR = 13            'Carriage Return
Const LF = 10            'Line Feed

'message box constants
Const msgboxBtnOK = 0
Const msgboxBtnOkCancel = 1
Const msgboxBtnAbortRetryIgnore = 2
Const msgboxBtnYesNoCancel = 3
Const msgboxBtnYesNo = 4
Const msgboxBtnRetryCancel = 5

Const msgboxIconStop = 16
Const msgboxIconQuestion = 32
Const msgboxIconExclamation = 48
Const msgboxIconInformation = 64

Const msgboxDefaultbtnFirst = 0
Const msgboxDefaultbtnSecond = 256
Const msgboxDefaultbtnThird = 512
Const msgboxDefaultbtnFourth = 768

Const msgboxApplicationModal = 0
Const msgboxSystemModal = 4096

'mach3 OEM button constants
Const btnCycleStart = 1000
Const btnFeedHold = 1001
Const btnRewind = 1002
Const btnStop = 1003

'user defined interfaces
Const ConfirmedLED = 1001        'change to your LED number
Const CountdownDRO = 1056


Sub Main
   Dim TimerStart, TimerNow As Long
   Dim Confirmed As Boolean
   Dim NewLine, Message, Title As String   'variables for msgbox
   Dim Answer As Integer
   Dim TimeElapsed, TimeRemaining, Timeout As Integer

   NewLine = Chr(CR) & Chr(LF)      '<CR><LF>
   Timeout = 25               'set confirmation timout time in seconds

   SetUserLED(ConfirmedLED, 0)      'reset LED to off state
   DoOEMButton(btnCycleStart)      'initiate cycle start
   TimerStart = Timer         'set starting timer. Timer is elapsed seconds since midnight.

   'loop through this block until we get confirmation or timeout
   Do
      Confirmed = CBool(GetUserLED(ConfirmedLED))   'Retrieve LED status and convert to boolean
      Sleep(250)            'check about 4 times per second to reduce CPU load
      TimerNow = Timer         'set current timer value
      TimeElapsed = TimerNow - TimerStart   'calculations have been broken down into small steps to
      TimeRemaining = Timeout - TimeElapsed   'make it easy to follow
      SetUserDRO(CountdownDRO, TimeRemaining)   'display countdown
   Loop While Not Confirmed And TimeRemaining > 0

   'If we didn't get confirmation in time then do the following
   If Not Confirmed Then
      'set variables for message box
      Message = "Operator failed to confirm ignition." & NewLine & NewLine & "Operation Aborted!"
      Title = "Error"
      'display message box. Answer will be the position of the button that was clicked (ie 1 for first button, 2 for second.)
      Answer = MsgBox(Message, msgboxBtnOK + msgboxIconStop, Title)

      'perform shutdown operations.
      DoOEMButton(btnFeedhold)   'Feedhold to stop machine nicely
      Sleep(500)         'Wait for half second to ensure we came to a smooth stop. Reduce if it's too much.
      DoOEMButton(btnStop)      'Full Stop.
      DoOEMButton(btnRewind)      'Rewind code ready to retry
      'Add anything else you need to do (like maybe torch off, LP off, etc)
      
      Exit Sub         'Exit script
   End If
   
   'add anything you want to do if we do get confirmation before timeout
   
End Sub
**********CODE**********

82
VB and the development of wizards / Re: Oxy Fuel Safety timer
« on: July 03, 2011, 06:21:01 PM »
I didn't put in the countdown, but you can output TimerNow - TimerStart to a DRO or UserLabel.

Also at the end of the If Not Confirmed block you should add a command to stop or feedhold or other applicable actions if you don't get confirmation.

If you need more information or you want some clarification on the code let me know. I didn't have much time when I did it so it's not commented very well.

Chris

83
Sorry to bump an old thread, but for others reading this I feel I should clarify what happened here.

In actual fact Mach3 wasn't doing what the GCode told it to do. There was a glitch somewhere in the OS. The toolpath window would show a toolpath that did not follow the provided GCode. X would suddenly flip negative for no reason whatsoever- not a single negative X value in the file...

The solution for him was to format the hard drive, reload windows and the Mach3 software. Nothing short of this seemed to help.

Thanks,

Chris

84
VB and the development of wizards / Re: Oxy Fuel Safety timer
« on: July 01, 2011, 11:46:04 AM »
Heres the script to replace the cycle start button!

Note that cycle start can also be run from other screens, so you might want to direct them to this script as well.

********** CODE **********
Const CR = 13
Const LF = 10

Const msgboxBtnOK = 0
Const msgboxBtnOkCancel = 1
Const msgboxBtnAbortRetryIgnore = 2
Const msgboxBtnYesNoCancel = 3
Const msgboxBtnYesNo = 4
Const msgboxBtnRetryCancel = 5
Const msgboxIconStop = 16
Const msgboxIconQuestion = 32
Const msgboxIconExclamation = 48
Const msgboxIconInformation = 64
Const msgboxDefaultbtnFirst = 0
Const msgboxDefaultbtnSecond = 256
Const msgboxDefaultbtnThird = 512
Const msgboxDefaultbtnFourth = 768
Const msgboxApplicationModal = 0
Const msgboxSystemModal = 4096

Const btnCycleStart = 1000

Const ConfirmedLED = 1001   'change to your LED number

Sub Main
   Dim TimerStart, TimerNow As Long
   Dim Confirmed As Boolean
   Dim NewLine, Message, Title As String
   Dim Answer As Integer
   Dim Timeout As Integer

   NewLine = Chr(13) & Chr(10)
   Timeout = 25      'set timout time in seconds

   SetUserLED(ConfirmedLED, 0)
   DoOEMButton(btnCycleStart)
   TimerStart = Timer

   Do
      Confirmed = CBool(GetUserLED(ConfirmedLED))
      Sleep(250)   'check about 4 times per second to reduce CPU load
      TimerNow = Timer
   Loop While Not Confirmed And TimerNow - TimerStart < Timeout

   If Not Confirmed Then
      Message = "Operator failed to confirm ignition." & NewLine & NewLine & "Operation Aborted!"
      Title = "Error"
                Answer = MsgBox(Message, msgboxBtnOK + msgboxIconStop, Title)

   End If

End Sub
********** CODE **********

85
VB and the development of wizards / Re: Oxy Fuel Safety timer
« on: June 30, 2011, 09:12:22 AM »
We need a little bit more information. When does the ignition need to be confirmed: at the beginning of a cycle, and/or periodically throughout the cycle?
Would a messagebox asking for confirmation be appropriate in your situation? How should the confirmation be initiated, do you want it executed from a macro called from the GCode (ie M1001)? Or would it be safer/more desirable to have it run every time you click cycle start so it is executed every time no matter what?
Any other considerations.

Once this info has been provided a suitable solution for your circumstances can be given!
I could just throw out a few possible answers/scripts, but it sounds like you've had enough pain on this one! Let's just get it right the first time.

A dialog must be used to give you control while the box is displayed so you can close the box when the countdown reaches 0 and decrement the counter every second. We'll get something put together for you pretty quickly I think.


Thanks,
Chris

86
I'm not familiar with the Arduino, but Mach3 can control many things while running, and is only limited to 6 axis and 1 spindle as far as I know. What will limit you is the available outputs from your parallel port interface card in the machines controller box. If you have 4 free outputs, you can potentially control 4 external devices. If you need to extend the inputs/outputs further you must make use of a ModIO bus, but it is definitely possible. You should be fine, providing you have the outputs available.

As far as I know M codes would be the only way to control it directly from your part program.

87
General Mach Discussion / Re: homing and limit switches
« on: December 01, 2010, 06:30:00 PM »
First things first. You will set the limit switches to active high or active low based on how it is connected to the circuit board in your machine controller and will differ from one machine to the next. For example, one of my 3-axis machines uses one active high and two active low switches. Basically, you will use whichever one works for each axis. In your case you will choose active low, meaning that the switch is providing a ground signal to the PC with the switch has been activated, and the rest of the time it is at +5V.

Now, to your homing problem. The "REF ALL HOME" button is a VB-Script. Here is how to modify it to do your dirty work!

Go to "Operator" > "Edit Button Script"
All of the button with VB-Script attached to it will begin to flash. Click the "REF ALL HOME" button to edit it.

Now that you're in the editor you should see something like this without the comments:

DoButton( 23 )      ' Ref (home) Y Axis
DoButton( 22 )      ' Ref X Axis
DoButton( 24 )      ' Ref Z Axis

DoOEMButton(133)   ' Zero X Encoder
DoOEMButton(134)   ' Zero X Encoder
DoOEMButton(135)   ' Zero X Encoder



Simply change this to read:

DoButton( 23 )      ' Ref (home) Y Axis
DoButton( 22 )      ' Ref X Axis

DoOEMButton(133)   ' Zero X Encoder
DoOEMButton(134)   ' Zero X Encoder
DoOEMButton(135)   ' Zero X Encoder

It will now home Y, then X, then zero X, Y and Z.

Also to note, this script is slightly dated as DoButton() is a deprecated function. To bring it up to date with the times use this script:

DoOEMButton( 1023 )   ' Ref (home) Y Axis
DoOEMButton( 1022 )   ' Ref X Axis

DoOEMButton(133)   ' Zero X Encoder
DoOEMButton(134)   ' Zero X Encoder
DoOEMButton(135)   ' Zero X Encoder


88
General Mach Discussion / Re: Bug in formulas
« on: December 01, 2010, 06:02:41 PM »
Yes, the formulas are only applied to MDI and G-Code commands. I think this may have been intentional, I'm not sure, but it should probably be an option. The only spare time I have is when I'm at home so I will delve into plugin programming and see if I can get it all working without bugs that way.

Anyone who has any suggestions as to the best way to modify the trajectory I would appreciate it very much as I assume that this will be somewhat difficult to accomplish and this is my first plugin attempt (I like a good challenge! :) ). Assuming I am able to make it work well I will release it free of charge for anyone who wants to use it for parallel machines, error corrections, rotations without mixing up the DROS, etc...

89
General Mach Discussion / Re: Bug in formulas
« on: November 30, 2010, 05:52:31 PM »
Lol... I'm going to write a plugin to do it if it gives me enough control... the table will be dealt with next year. The workaround I now have in place works, I just can't use feedhold and continue... I have to rewind, then everything stays lined up perfectly.

Thanks for the input and for confirming that this is likely a bug in Mach3.

Cheers!

90
General Mach Discussion / Re: Bug in formulas
« on: November 30, 2010, 01:56:59 PM »
I'm about 10 steps ahead of you, and the fact that mechanical solution is best is very, very obvious (to anyone who knows ANYTHING about machinery). I am well aware of the physics that this machine is working against. However, time right now does not permit me to rip the table apart as someone has already done that twice. The next time it comes apart it IS going to get dual drives (it just makes sense, doesn't it?), but that will not happen for a while. Also note I am only cutting plastic sheet and it puts virtually no load on the spindle or drives.

To be perfectly honest, a feature that does not work has no place in distribution software. I thank all who have worked to make this program as great as it is (I believe it is among the best because of it's flexibility), but this broken feature is out of place among the rest of the software that, for the most part, works flawlessly. I would say it needs to be fixed or removed. Just my honest, unbridled opinion. Of course, if it were to be removed it would eliminate native support for parallel machines. It is probably better to fix the feature because it is useful for a variety of applications (not just for correcting table error!) and makes the software much more versatile. The fact that there aren't many users making use of formulas does not negate it's usefulness to the users that would like/need to use it.

Thank you for your opinion, and I agree in principle, but in the practical world there are limitations, one being time, the other money, and I don't have much of either.

Pages: « 1 2 3 4 5 6 7 8 9 10 »