Hello Guest it is August 04, 2020, 11:05:58 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 - kthomson

Pages: « 1 2 3 »
General Mach Discussion / Macro Code
« on: May 01, 2008, 08:17:42 PM »
Ok, I think I finally figured out what is going on. The following code is what I wrote for a Z axis zeroing routine. Thanks to everyone for your help with this. If any previous post implied that I have not gotten support here, it was just poor wording (I was complaining about my previous hardware/software vendor , not Mach3 or CandCNC), everyone here has been nothing but helpful.  I've gotten several suggestions that got this program to work in the first place and, hopefully, a few more will let me make this a usable macro.

If GetOEMLed(800)<>0 Then    (Check to see if the reset led is on or off, if on send reset)
End If
While GetOEMLed(824)=0         (If the Z Home led is not on)
  DoOEMButton(312)Wend        (Activate Z- jog button)
q=0                                        (I could never get the 'Sleep' function to work. I got a syntax error every time I tried to use it.)
While q < 1000                        (These 4 lines are just a time delay)
While GetOEMLed(800)<>0       (Since the touchplate acts as a limit, this sends a reset code)
q=0                                        (Another time delay.)
While q < 1000
Code "G91 G0 Z0.252"              (my touchplate is .498 thick so it raises the Z axis .252" to get it to .750)
q=0                                        (Another time delay. If it parses the 'While IsMoving() line before the axis starts moving it gets stuck in an unrecoverable loop)
While q < 1000
While ismoving()                       (Wait for the Z axis to stop moving before setting the Z axis DRO)
SetDro(2,.750)                        (Reset the Z axis DRO to .750 (my .498 plate + .252 travel)

This code runs perfectly in the VBScript editor window, but it chokes if I enter M1001 (the name of the macro) in in the MDI window, or try to call it as a button routine. It runs until the tool hits the touchplate, then aborts. I think that what is happening is that in the VB window, it is running under the control of VB. While it does trip a limit, the program continues and is allowed to pass a reset code to Mach3, and the program completes. When I attach it to a button in Mach3, when it hits the limit, Mach3 aborts the program so it never gets to the 'Reset' command.

It appears that what I want to do isn't possible from inside the program because any home or limit activation aborts all program code, and won't allow you to do anything else until clicking on the reset button. I have 'Auto Limit Override' turned on, but it makes no difference. What I've been able to find in documentation indicates that this setting should allow one move in the opposite direction after a 'Reset' flag is set, but so far I haven't found a way to make it work.

Does anyone have any idea if it is possible to override the 'Reset'?

General Mach Discussion / Re: Reset - I was wrong
« on: May 01, 2008, 06:56:23 AM »
Sorry about the 'rant'. I was just getting frustrated trying to get this to work.

One of the things I have had problems with is that the documentation seems to be spread out all over the place, and I don't guess I've found everything. Jimpinders suggestion will probably solve the problem, I've just never found the syntax to do that. At one time I did save the program as a 'M' file in the macros directory, but haven't seen a syntax example to call it from a button. I'm sure most of this is just a matter of me learning the languages involved and learning how to link them.

Thanks to everyone for their help and suggestions. I'll keep playing with it, I thing I'm getting close and I'll post the code when I get it working.

General Mach Discussion / Re: Reset - I was wrong
« on: April 30, 2008, 10:25:53 PM »
I have tried everything, including rebooting (which happens about every 2 min anyway). I have probably had to reboot my computer by pulling the plug at least 200 times in the past two days. If it gets caught in a 'While IsMoving(), Wend' loop (which happens frequently) I could only kill it by pulling the plug. The VB 'Stop' button doesn't work, you can't even do a 'Control/Alt/Delete' to kill the program, once it is stuck it is stuck. From what I can tell, Mach3 simply doesn't handle VB scrips worth a damn.

I used WinCNC for over 3 years on this machine, and it does have it's problems (no tech support, expensive, and no forums for problems), but when I wrote a macro, IT WORKED. I switched to CandCNC controllers and Mach3 because I was convinced by users on the CNCZone forum. They all said the same, 'Change to Mach3 and CandCNC', the support is great. I agree, the support is great, but that doesn't help if the software doesn't work. So far, I have spent over $500.00 on this conversion between hardware and software, and I'm getting less enthused by the day. I have spent countless hours over 3 days trying to do two simple macros, only to find that the software chokes on, what I know, is good code. I'll give this about 2 more days and I'll decide which program/controller to dump on ebay.

General Mach Discussion / Re: Reset - I was wrong
« on: April 30, 2008, 09:38:53 PM »
I have tried both the current 'lockdown' version (I'm on a different computer from the one running Mach3 so I'm not sure of the version), and the newest beta release. The problem is the same on both. It doesn't seem to be so much a problem in how it saves it as how it runs it. I've done two different macros that run perfectly if i run them from the vbeditor screen, and they both crash if I run them from a button, even though the code is EXACTlY the same  on both screens. That defiinatly indicates that the problem is in Mach3 and not in the code. This could be a severe problem for me. I tend to customize my machines for what I'm doing with them, and this would indicate that I can't do it because it can't handle simple scripts. I switched to Mach3 because I was told how good it was, but this is a MAJOR deficiency.

I agree with sschneider. That was one of the nicest things about setting up this unit (Using WinCNC I had to measure the move and guess how much to increment/decrement the setting). Go to the 'Setting's page, click on 'Set Steps per Unit' in the lower left corner, and let it do the math. I used a 6" dial caliper. I opened it to 5" and placed the tail against the moving axis, then told it to move 1" toward the calipers (later I did it at 4" to fine tune it).  It will ask you how far it actually moved. Read the caliper, then enter the actual movement. When you enter that number it will calculate the steps required. Save the results and the next move is very close. The longer move you can make, the closer it will be.

General Mach Discussion / Re: Reset - I was wrong
« on: April 30, 2008, 07:39:54 PM »
Sorry, my internet has been down for a while. As it turns out, there is nothing wrong with my code, and the limits aren't an issue. If I create a macro, and save it as a vbscript file, I can run it as many times as I want with no problem, but if I try to enter the script into the vbscript box on a button, it saves it ok, but when I try to run it from within Mach3 by clicking on the button I get a 'Compile Error' 'Invalid Syntax' or something like that.

I created a macro that will lower the Z axis until it touches my touchplate, then it retracts .252" (my plate is .498 thick), and sets the Z axis DRO to .750. It works EVERY time if I run it from the vbscript editing screen. I can copy the code and paste it into the vbscript box in Mach3Screen and save it, and when I look at the code in Mach3 it is identical. If I try to run it from the button I get a 'Compile Error' and it does nothing (except sometimes crash my computer).

I was initially using Screen4, but in that I haven't found any way to either change the code it is executing. Your choices are only to select what type of command, but for a vb script you can't tell it anything except to use a script edited in Mach3, and when you edit it there it won't save the new code. Every time you restart the code has reverted to what it has stored (sometimes, it will save it, I don't know why, but usually it doesn't)

I have also found that the While IsRunning(), Wend statement will lock my computer up completely (the only out is to pull the plug and restart) if it parses that line before the head starts moving. I had to put in a dummy argument to delay that line until the head had time to start moving.

Any ideas why it will run one way and not the other.

General Mach Discussion / Reset - I was wrong
« on: April 29, 2008, 11:00:22 PM »
Ok, is there a way to stop the Reset lockout or not? I thought I had found a way around it by sending a reset code in a macro, but the way the code is parsed, even that seems to be impossible. What i am trying to do in this case is not important, the fact is that every time I try to write a macro that references a 'home' signal, regardless of axis, it locks up the machine until clicking on the 'Reset' button.

When it hits a 'X- or X+ limit/home' I want the machine to stop moving in that direction, when it hits a 'Y- or Y+ limit/home' I want it to stop moving in that direction, the same with 'Z'. I DO NOT want it to lock up the entire machine until I manually clcik on a 'Reset' button. There should be a way to stop the axis(s) from setting a lockout when hitting a limit/home switch.

Also, is there a source for syntax examples for the program commands? I have looked at every link available from this site, but it is like trying to look for 1000 needles in a  haystack. I can find a needle or two here or there, but there doesn't seem to be a list anywhere of available commands. I have taught myself three different programming languages, but with no documentation I can't teach myself this one.


General Mach Discussion / Re: Reset
« on: April 29, 2008, 02:04:33 PM »
Yeah, we may be confusing terminology. My machine has three limit switches which function both as 'Home' sensors, and travel limits. I guess I've been using the terms interchangeably, and they are really not. Anyway, I've found what I was looking for. After reading through all of the available codes I found that I can send a reset command from within the macro, so it's not a problem. I can send a reset when it hits the switch, then continue the code.

I'm using this on a 5' X 9' router.

Thanks for the input guys ...

General Mach Discussion / Re: Reset
« on: April 29, 2008, 08:42:43 AM »
We seem to be getting confused. I agree, if you are running a program, yes, a limit should stop the program, stop the machine from moving, and do nothing else until the fault is corrected. My complaint is that, while jogging, when you hit a limit, or a home switch, you are not allowed to jog off the limit without hitting a reset. If you are jogging in the X- direction, and you hit either a home, or direction limit, the machine should not allow you to move that axis any further in that direction, but I don't see any reason it should stop you from jogging that axis in the other direction, or to jog any other axis in any direction until you hit a reset button. Again, I used Mach3 for the first time 2 days ago, so I'm sure there are a LOT of things I don't know about it yet. Again, I'm trying to recreate 2 macros that I have been using in another program that worked very well.

I guess what I'm asking is, is there a way to tell the machine that hitting the limit was not a fault. I want to move the X axis until it hits the limit, then move off the limit a programmed amount, then move to the limit again at a slower speed and repeat this on the Y axis, all without having to hit the Reset button.

General Mach Discussion / Re: Reset
« on: April 29, 2008, 07:48:26 AM »
What I'm wanting to do is:

Click on 'Ref XY'
Approach the X axis limit at a fairly slow feedrate (e.g. F20)
When it hits the limit, move off the limit to say .5"
Approach the limit again at a slower feedrate (e.g. F 5)
Reset the readout to 0
Repeat these steps on the Y axis

The reason I want to do this is that the current 'Ref XY' button moves the heads too fast, and the stop is not consistent. I know that you can change the jog speed, but the only setting I have found to do that slows the jog rate all the time. I know that you can override that by holding the shift key (not crazy about having to do that either), but it is already slower than I would prefer the rest of the time. There may be other ways to change that speed, I only started working with Mach3 a couple of days ago, so I'm still learning how to use it.

I have been using WinCNC, and just changed my machine to CandCNC controllers and Mach3. For the most part I like Mach3, but WinCNC had two macros built in that I really liked and I'm trying to duplicate them for Mach3. The first is the function just mentioned. It worked beautifully, and was exceptionally accurate for it's repeatability.  The second, is a 'Z' axis 'Touch Top' function. When you click on this button, the Z axis lowers until it touches a touchpad, then raises to a known height and resets the reading. I have that one working, and will attach it to another message (someone else was looking for that function in another message), I'm not on that computer right now.

Pages: « 1 2 3 »