Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: BJenkins on April 30, 2008, 10:32:35 PM

Title: New - First Question - X - Y - Z - Touch Off Plate - Screen and Script Request
Post by: BJenkins on April 30, 2008, 10:32:35 PM
Hello,

I am brand new. I have a CNC router that I purchased recently. I have a touch off plate set up and working correctly. Currently I am using the "Blue Screen" and have a script loaded into the Auto Tool Zero Button.

I probably have this all wrong but the way I see it, the Blue Screen Set allows you to make corrections to the touch plate thickness for Z via a input box on the screen but I do not see any input box for corrections for tool radius on this screen for X and Y. Edit: I just learned that you can add a line into the script for touch plate thickness but I still think I will need a window to input tool radius. (not sure) ???

Objective: I want to use my touch off plate to find X and Y and be able to input the tool radius into a correction window.
I do not know how to make screens or scripts and I would like to download a screen and script that does this. (all tricks and techniques are appreciated)

Note the Blue screen has a neat setup for a center finder device but I do not need this. I just want to use the touch off plate for X - Y and Z.

Thank You,
Bill J.
Title: Re: New - First Question - X - Y - Z - Touch Off Plate - Screen and Script Request
Post by: jimpinder on May 01, 2008, 04:21:40 AM
Yes - the touch off plate has everybody fired up - and is a great thing  but if we are not careful it will lead to lazy machining.

All tool offsets can be entered in the tool table, and if you are approaching CNC in a professional way, all your tools are entered in here first.

I can appreciate that, unless you have some locking mechanism on your tool changer, then tool depth will vary, but diameter is constant and should be in the tool table. You can then use one of the many offset calls to put your tool in the right place.

It would only be a small addition to the script to then pull the diameter from the tool table, zero the DRO and add the diameter on each touch.

I will have a look at it and see if I can come up with anything - including your DROs for the diameter.
Title: Re: New - First Question - X - Y - Z - Touch Off Plate - Screen and Script Request
Post by: Chaoticone on May 01, 2008, 05:38:46 AM
There was a nice thread on the yahoo group or CNC zone about this a while back. May want to do a search there for it. May have been posted here as well. Can't remember.

http://www.machsupport.com/artsoft/cnczone.htm

Brett
Title: Re: New - First Question - X - Y - Z - Touch Off Plate - Screen and Script Request
Post by: jimpinder on May 01, 2008, 06:47:12 AM
Here is a VB script you can try. I used the script from the other forum as a basis.

It takes information from the tool table, so your tool must be entered there, and selected as the current tool.

It basically touches a plate on the left of the tool, a plate in front of the tool and then touches the top of the work piece (or plate)
It sets the DRO's to zero + the tool diameter then moves the tool away a short distance.

If you take the plate(s) off, and type G0 X0Y0Z0 it should put the tool on the bottom left hand corner of the work, at the work level as a basis for starting work (although I am not necessarily saying that is where you should start from.

Be careful - I have not tested it

Download it then rename it with a macro number in the macro file of Mach3 e.g. M201

I have only given it 1 inch movement in any direction, therefore you should jog to with 1 inch of your touchplates before using it. Type in M201 and away you go.

Title: Re: New - First Question - X - Y - Z - Touch Off Plate - Screen and Script Request
Post by: BJenkins on May 01, 2008, 01:57:12 PM
Thanks a bunch!

I will review the link, load my tools into Mach and download the script. I do understand that caution is required to prevent driving a tool bit into the table or work piece.

I will report back with my results.

Thank You,
Bill J.
Title: Re: New - First Question - X - Y - Z - Touch Off Plate - Screen and Script Request
Post by: BJenkins on May 02, 2008, 04:31:18 PM
Update:

Now that I have played with the “Auto Tool Zero” button, I would prefer to check one axis at a time. It’s a neat button and I may add a all in one script to it later on. 

The following refers to buttons that are found on the modified Blue Screen Set. There are four arrows, X+, X-, Y+ and Y-. There is also a Z arrow that I already have a good script for. To see this specific screen you can click on the link. Scroll half way down the page. I do not have any preference on the screen set but it does have the arrow buttons that I want to use. http://www.cnczone.com/forums/showthread.php?p=436270#post436270

After experimenting, I became confident that I could touch off of X, Y and Z using the XYZ arrow buttons. I zeroed each axis after touching and after completing the touch routine for XYZ, I selected "Go To Z" and then selected "Regen" and finally “Cycle Start”. I’m not sure if this is the technique or sequence that most use or not but it seems to work.

There is a script associated with each of these XYZ arrow buttons. Now I need to determine if the individual scripts for the X and Y arrow buttons accomplish the following.   (I have a good Z script already)

(1)   I need the scripts associated with the X+ and Y+ arrow buttons to make the compensation for my touch plate thickness for X+ and Y+ only.  (not for X- and Y-) My touch plate is 0.0635 inches thick.

(2)   I need all the X and Y arrow button scripts to reference the tool selected in the tool information window and make the radius correction. It is important that this radius correction only be applied for the touch off script. My drawings already have compensated for the tool offset. My tools are in the Mach Tool Table as recommended.

A friend walked me through the Z script last night and I now have some understanding of what the script says but not enough to write the script from scratch. Below are the current X+, X- scripts. If changes need to be made, I should be able to edit Y+ and Y- the same way.

Thanks in advance for taking a look at them.

From what I see in these scripts, it does not make the corrections described above. But I really am clueless about the script language and codes.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This is the current script for the X+ arrow button:

Rem   VBScript for probing in the x direction
If GetOemLed (825) <> 0 Then       'Check to see if the probe is already grounded or faulty
   Code "(Probe plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
Else
   Code "G4 P1"         'Pause 1 second to give time to position probe plate
   CurrentFeed = GetOemDRO(818)    'Get the current feedrate to return to later
   Code "F4"
Rem   Probe left
   XNew = GetDro(0) + 3      'probe to current position + 3 inches
   Code "G31 X" &XNew
   While IsMoving()      'wait for prob move to complete
   Wend
   XNew = GetVar(2000)      'read the touch point
Rem   move back to the hit point incase there was an overshoot
   Code "G0 X" &XNew
   While IsMoving ()
   Wend
   Code "F" &CurrentFeed       'restore original feed rate
End If
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This is the current script for the X- arrow button:

Rem   VBScript for probing in the x direction
If GetOemLed (825) <> 0 Then       'Check to see if the probe is already grounded or faulty
   Code "(Probe plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
Else
   Code "G4 P1"         'Pause 1 second to give time to position probe plate
   CurrentFeed = GetOemDRO(818)    'Get the current feedrate to return to later
   Code "F4"
Rem   Probe left
   XNew = GetDro(0) - 3      'probe to current position - 3 inches
   Code "G31 X" &XNew
   While IsMoving()      'wait for prob move to complete
   Wend
   XNew = GetVar(2000)      'read the touch point
Rem   move back to the hit point incase there was an overshoot
   Code "G0 X" &XNew
   While IsMoving ()
   Wend
   Code "F" &CurrentFeed       'restore original feed rate
End If
Title: Re: New - First Question - X - Y - Z - Touch Off Plate - Screen and Script Request
Post by: jimpinder on May 03, 2008, 05:03:14 AM
It might be just as easy to add three appropriately reference buttons on the screen - marked set x, set y and set z or similar.

I have to go now - to run our miniature railway - but will have another look tonight. I will include a sketch of how I see your co-ordinate system working - it might be different to the ideas that you have - but we need to get the ideas correct before we write the script.

The main problem is agreeing on where X0Y0 is in relation to your diagrams.

To advance a little - and give you something else to think about -  what you are doing is setting home switches - all be-it moveable ones.
The correct way to do this is set permanent home switches - for which the routines are already in Mach3, and then do an offset move (G54 - G59) to move you to the appropriate position for your workpiece and program.
Title: Re: New - First Question - X - Y - Z - Touch Off Plate - Screen and Script Request
Post by: BJenkins on May 03, 2008, 03:30:34 PM
Thanks very much Jim,

I have a friend in my area (Knoxville, TN) that went out of his way this morning to explain some things to me via a Skype Voice Chat. (2 hours)

Now, I do understand things much better regarding the touch off system or locating a part home. I would like to explain his method which is probably the standard techniques but I feel that I would use the wrong term or in some way confuse the issue.
I would like to overview my understanding just to see if you think I have a handle on it and if you think I should or should not edit the scripts.

The following is a new guy rambling about what he thinks he has learned.

In general, I now understand that I can use the offset page to correct for tool radius for X and Y for touch plate operation and at the same time, not affect the offsets that I already have made in my drawings.

Also, I believe I understand that I could add a script line for the X+ and Y+ arrows that would take care of the touch plate thickness or I can add this additional offset to the tool radius and type it into the offset window. Or I can touch via X- and Y- and not have to make a touch plate thickness correction.

All of my G-Code drawings (tool path) already has the proper offsets for each tool diameter. So I now believe that I do not select a tool in the tool window. I understand that I leave the tool window at tool #0 to prevent offsets from being applied in my drawing.

Please let me know if this is different than your method or if you have any points that you think I'm simply wrong on.

At first, I just wanted to push the X+ or Y+ arrow and (somehow)(via magic script) have the tool radius compensated for along with touch plate thickness. Since I already have offsets in my drawings and therefore I should not select a tool in the tool window, I think that I should make the tool radius offsets for touching off on the offset page.

I still would like to add a line to the script that would take care of touch plate thickness for the X+ and Y+ arrows. If you think this is the way to go, I can post the X+ and Y+ scripts.

Thanks, I hope I didn't cause frustration or confusion with any of this.  Any ideas are appreciated.

Bill J.

Title: Re: New - First Question - X - Y - Z - Touch Off Plate - Screen and Script Request
Post by: BJenkins on May 04, 2008, 10:08:48 PM
Hello,

I did get an answer to the script modification I was looking for on the following link. I do appreciate the help here and will continue to check back to see if other tips and techniques are posted.

A lot of detailed work has been put into this CNCZone thread by a man named Ernie.
http://www.cnczone.com/forums/showthread.php?t=56079&page=6

Thanks,
Bill J.
Title: Re: New - First Question - X - Y - Z - Touch Off Plate - Screen and Script Request
Post by: BJenkins on May 05, 2008, 01:36:49 AM
Hello again,

Are there some examples of the touch off sequence somewhere on this site? It would help me a lot to see the basic sequence that is normally used. It sure seems like there should be.

I have the scripts and plate working perfectly but I still have a lack of understanding regarding tool radius correction.
Questions like when do you make the tool radius compensation - before or after touching, where you do it, and so on.

A friend did explain this but I must be doing something wrong.

Thanks,
Bill J.
Title: Re: New - First Question - X - Y - Z - Touch Off Plate - Screen and Script Request
Post by: jimpinder on May 05, 2008, 03:32:35 AM
You must not learn by numbers - take a step back.

What the machine MUST know is - Where Am I ???

Once it knows that, it is happy - and a happy machine works well.

What you are trying to do, therefore, is tell the machine where it is.

I don't know what you are doing with the touch plates, but I assume you are putting them somewhere near the workpiece and trying to say to the machine - That is where you are !! - AND - That point is here in my program - Now do the program.

The point can be anywhere. In my machine I have home switches fitted. It is a lathe and millng machine combined - so it is not likely I can have one set of switches that will suit both functions. What happens, therefore is  -
1. I home the machine. This sets the MACHINE co-ordinates to 0,0.
2. I then move to program co-ordinates and apply an offset (G54 - G59). This changes the DRO's to show a start position that is suitable for machining - in relation to the homing position (which is not).
3. I move the machine to its new position 0,0.
4. If my offset is correct - then the new 0,0 the machine is at should co-incide with the 0,0 of the program.

I your case - you must decide where you are putting your touch plates - i.e. what is that position in relation to your program. We will assume all you are doing is drilling a 1/2 inch hole in the middle of a 2 ins square of material. You program is fairly simple. It can start anywhere providing it goes to
G0 X1Y1
G1 Z-0.5
G0 Z1
G0 X0Y0.
There might be some other code - for tool changes, Z height and other minor things - but the meat of the program is in those four lines.
Move to 1,1, drill the hole, lift the tool to a safe height and go back to 0,0. You will see from the program that we are assuming (when writing the program) that 0,0 is at the bottom left hand corner of the workpiece.

Your problem is telling the machine where it is (not necessarily telling it where 0,0 is).

If you put your touch plate on the left hand side of the workpiece (the 2" plate) - then that position is X0 - so if you now touch it, coming from the left and set the DRO at 0 you have done X. This would be correct if the touch tool was 0 inches diameter The touch tool - whatever it might be - has a diameter - therefore  the centre of your chuck didn't get to X0 - it only got to X0 plus the radius of the tool. Therefore you must add the tool radius to your Xposition DRO. The machine now knows where the X axis is - and , providing you do not touch the DROs again, or miss steps, or make some other foul up, it will keep that information.

The argument is exactly the same for the Y axis - if you place the touchplate at the side nearest you  - that is Y0. Touch the plate coming towards you and the argument is exactly the same.

You therefore tell the machine that it is at (say with a 1/4 inch diameter tool in) X0.125 Y0.125. in relation to the program. You might not have been to that position with both axis simultaneously - but that is what you have done. The machine is  happy at that and, when required, will move to where it thinks X1 Y1 is and drill your hole. In the meantime, you can jog around, change the tool, have a cup of tea etc. then press the start button and the machine will oblige.

You need not use the X0 Y0 edges of the work piece - in this example you could use the edges furthest away from you. - but, given the same tool, the chuck centre would only be at 1.875 1.875 - not at 2,2 - and this must be reflected in the DRO.s

As far as the Z axis is concerned - it is normal when writing GCode to consider the top of the workpiece at Z0. Therefore all you need do is bring the tool down to touch the top of the work - and this is Z0. Again - if you are drilling wood or plastic, and you have used a touchplate, then the thickness of the plate must be added to the Z DRO.

For a milling machine you can change the tool - and the X and Y positions (once set) will not be altered - the Z position must be altered to reflect the different lengths of tool. This is where your tool table comes in becasue different diameters alter the offsets for cutting etc - but they have no part in setting the position of the machine other than whatever tool you use as a probe the radius must be taken into account. Many machinists use a piece of ground bar - accurately ground to a specific diameter - as their touch tool. Other professional touch tools have a specific diameter of ball at the end to take into account.

I have the page done for the touch tool - running from macros - but I cannot find how to link this to push buttons on the Mach3 screens.
Everything else is fine. ( See my post asking for some help - with the new version of Screen4)






 













Title: Re: New - First Question - X - Y - Z - Touch Off Plate - Screen and Script Request
Post by: BJenkins on May 05, 2008, 09:56:33 AM
Thanks,

I will take a look at the post. If you have a newer version of Mach3 you will find a very neat tool that will add the script to your button.

Go to the "Operator" tab then select "Edit Button Script" the the cursor changes to a hand then Left click on the desired button and a edit script window will open where you can add or edit a script.

I will work with touching off some more today and let you know if I get my issues cleared up.

By the way, if you go to "operator" and do not find the "Edit Button Script" which is a very nice option, you need to downlad the newest version of Mach. I am using Ver. 2.63.

Thank You for your efforts on my behalf.
Bill Jenkins
Title: Re: New - First Question - X - Y - Z - Touch Off Plate - Screen and Script Request
Post by: BJenkins on May 05, 2008, 01:58:34 PM
Progress!

I now can select "Go To Z" after doing the touch off routine and the tool bit moves to exactly where it should be. (cool)hA!

The method I used was. (Not very automated but it works)
1. Touch the plate.
2. Make the corrections for tool radius and plate thickness in the DRO window.
3. Do this for both X and Y
4. Touch off Z
5. Then select "Go To Z"

Mach Glitch: If you need to select a negative number in the DRO window it initally reads + instead of -. When you select enter, the number then changes to -.   (Version 2.63)

Now it would be very nice to automate this touch off routine by adding a window that would allow you to input the diameter or radius of the tool and some how have the individual X+, Y+, X-, Y- arrow buttons make the correction for tool radius automatically.

It would also be neat to have a separate window for the input of touch plate thickness for X and Y. On my Blue Screen modification, there is a window for touch plate thickness for Z.

Can this be done? I know I would really like that but the more manual way does work.

Thanks,
Bill
Title: Re: New - First Question - X - Y - Z - Touch Off Plate - Screen and Script Request
Post by: jimpinder on May 05, 2008, 02:32:04 PM
Yes I have it - I am just putting the finishing touches to it. It is an extra page on the Mach Mill. You can fill in the thickness of plate on the X Y and Z axis, you can select the current tool, which brings up the tool diameter from the tool table, and then press a button to touch X left or right, Y forward or back, and Z downward.

The macro then sets the DRO automatically to the correct value. A couple of days should see it done - unfortunately I work each weekend - my wife and I run a miniature railway - and today is a Bank Holiday in UK - so we have been busy.

Thanks for the tip about "Edit Button Script" someone else told me about that as well - it is working, and I have one axis done. The rest should be relatively easy.
Title: Re: New - First Question - X - Y - Z - Touch Off Plate - Screen and Script Request
Post by: BJenkins on May 05, 2008, 03:13:02 PM
Wow!

That sounds really nice. A friend who helped me said that he thought a separate page would allow users to keep all the other options available and that is what you decided on. COOL!

I do feel confident with the touch off system now and another friend explained a minor difference in his techinque but it is basically the same.

There is one area that you mentioned that does bring up a question in my mind. I do like the thought of using the Tool Window to input a specific tool from the tool table but what worries me is the following. Again, please correct me because I am probably wrong on this but it is my understanding that if a tool is selected from the tool table, offsets will be applied.
Are offsets applied when selecting a tool from the tool table? The reason I ask is because my tool path drawings already have the correct offsets compensated for. I do not want Mach to make any offsets to my drawings. If offsets are applied, I can see that after completing the touch off routine, that it might be possible to go back and change the tool number to 0. (not sure)

Thanks!
Bill J.

Title: Re: New - First Question - X - Y - Z - Touch Off Plate - Screen and Script Request
Post by: jimpinder on May 05, 2008, 04:08:21 PM
Tool Offsets only apply if you ask them to with the appropriate GCode.

I have finished the screen set and you can try it. I think it will work - I have tested it on my office computer - but as I said earlier - my lathe/mill if getting fitted with a homing laser, so I can't mess about with it at the moment.

I based the thing on the Mach Blue screen set - although the man who did the blue set is an artist, with all the whirls and round edges etc. I couldn't compete with that. I have used the AutoTool Zero button to access a new screen - but before selecting the new screen - make sure the rest button is not flashing, or the axis will not move.

Access the new screen - it has down the left DRO's for you gauge plate thickness, down the centre are the tool and offsets. Down the right are the positional DRO's which are repeats of the others on the main pages.

You must decide what you are doing - as I said in my last post - where are you putting your gauge plate and what is it meant to represent. If you are touching to zero (on any axis) then put 0.0 in the Touch Location. You must then choose what offsets will come into play. The tool diameter will - and you can either enter the Tool Number - which will automatically display the diameter, or you can just enter the diameter in the Tool Diameter. If when doing the Z axis, the tool length comes into it then you can enter that as well.

You must then decide where you are putting your plates and if the thickness comes into play. If the plate is on the "outside" of your workpiece and the thickness does not matter, then MAKE SURE that 0 is entered in the plate thickness.

The same rules apply to both axis.

So - if your are going to touch left, on a plate of the outside of the workpiece at position 0, then the plate thickness should be 0 (it does not affect the position of the touch) and Touch Location should be 0. Enter the Tool Diameter (or Tool number). Jogg your touch tool to within 1 inch of the plate and then press "Touch X - Left". The tool will slowly move left and touch the plate. The DRO position will change to zero + offsets, and then the tool will move away to it's new 1 inch away from target position.

Similarly for Touching towards you with the Y axis.

If you are touching right, or away from you, you have to decide what the touching position will be - it depends, I suppose, on the size of your table/workpiece etc. but whatever it is enter the position you are expecting to touch in the Touch Position DRO. Enter plate thickness (if it is relevant). Tool Diameter - jog to within an inch of the plate and press "Touch X - right". The tool will move slowly right, touch the plate set the DRO to it's new position minus offsets, and the tool will then retire 1 inch from the plate. Similarly with "Touch Y - away"

Z is simpler - it is always down. If you are merely touching the top of the workpiece, then the Tool length is 0, plate thickness is 0 and the touch location is 0. Press "Z - down" and the tool will go down and touch the work, set the DRO to 0, and then move back up 1 inch. If you have to put a touchplate on the work, then the thickness should go in plate thickness. If for some reason you are setting a height other than zero, then put it in the Touch Location. I can't think why you should need the Tool Length - but I put it in anyway (it was simpler than taking it out)

If you have your machine all set up, then please try it, and let me know if anything is wrong with it - I might have added when I should have subtracted - it might even be all the wrong way round - but it shouldn't be too bad.

Attached below. I assume the relevant scripts are with it.

I have just thought of something else - unfortunately you may not be able to jog whilst you are on the new page (I have not put any jog on/off buttons), If this is the case, let me know and I will put some on. (You can just go to the front page, jog, and then return to the new page )




Title: Re: New - First Question - X - Y - Z - Touch Off Plate - Screen and Script Request
Post by: BJenkins on May 05, 2008, 04:35:25 PM
Hello Jim,

I have tried out the system and unfortunately there are a lot of issues at the moment.

When I select any of your buttons, the machine does move but the stepper motors sound weird.

If I select Touch Z,  I get a Y- movement.
If I touch X right I get a Y- movement.
If I touch Y away, I get a Y- movement.
If I touch Y Toward, I get a Y- movement.
If I touch X Left, I get a Y- movement followed by an abrupt reverse movement that causes a reset situation.

Also, On the Front Page or Run Program page, there is now an extra window beside the plate thickness window and the plate thickness window is out of position to the left by about 1/4 inch.

I think that you will probably need to check this on your machine to understand all of the above. I understand it is not available at the moment but I think you will need to check these issues when your machine modification is complete.

I'm too new, maybe a more experienced type will try. I'm afraid I would just cause confusion. I will continue to check back to see if others are successful with their test.

Thanks!
Bill
Title: Re: New - First Question - X - Y - Z - Touch Off Plate - Screen and Script Request
Post by: jimpinder on May 06, 2008, 06:22:18 AM
I have had a look at the scripts associated with the buttons - and they seem OK.
Don't forget, this is a new screen set - which has been used elsewhere.

Mach 3 can be set up in different ways - I have two different screen sets running, one when using my machine as a lathe and another using my machine as a mill. Two completely different programs, both accessing the same motors and switches - but on different configurations - e.g. on a lathe the axis letters are different.

All you need to do to make sense of it is, open the BlueScreenTouch set on your machine, but then check Config/Ports and Pins and make sure the pins are allocated AS THEY ARE ON YOUR MACHINE, and also check Config/Motor Tuning to see if the motors are correctly set up for Steps per Unit, and the speed and acceleration figure. You will probably find that, at the moment, they are set up as for someone elses machine (probably the chap who wrote the bluescreen set.

It doesn't matter on my office computer, because I am not fastened to a machine.

You will only need to set it up once - it is not a long job - copy the Port and Pins etc. from a screen set that you know is correct and working. Once you save it, thats it.