Hello Guest it is October 17, 2019, 09:30:53 AM

Author Topic: Tool measure macro  (Read 26260 times)

0 Members and 1 Guest are viewing this topic.

Offline faby

*
  •  74 74
    • View Profile
Tool measure macro
« on: July 29, 2006, 11:39:42 AM »
Hi there,
I'm new in mach3 world, I need a toolchanger macro, but i don't know how to write it.
I made a video that shows how my actual software do that, there's anyone who can make a thinks like that?

You can see the video at this address:

www.fxmodel.it/tool.mp4
or
www.fxmodel.it/tool.mov

In the video you can see the machine stop in the "tool change position", when i ask to change the tool, it goes over the probe and go down slowly, when it press the microswith stops and go back until it release.
Now it come back to the "tool change position" and wait until i change the tool, then it measure the new tool.

I'll be grateful to anyone can help me.

Ehm... sorry for my english, I'm italian :P

Bye Fabiano

Re: Tool measure macro
« Reply #1 on: July 29, 2006, 08:07:01 PM »
This is no problem..

This is how I would do it:
Xpos = GetDRO(0) 'Get the X and Y position
Ypos = GetDRO(1)
Code "G53 G00 Z-.1" 'Move the tool all the way up
Code "G53 G00 X3.5 Y6.00" 'Move to the probe position
While IsMoving()
Wend
Zpos = GetDRO(2)'Get the Zpos
Code "G31 Z" & Zpos - 5 & " F30" 'Probe down 5 Units
While IsMoving()
Wend
Zpos = GetVar(2002) 'Get the Position that the Porbe hit at
Code "G00 Z" & Zpos' Move to the point where the probe hit
While Ismoving()
Wend
Call SetDRO(2,0.000) 'Set the Z to 0.00
Code"G53 G00 Z-.1" 'Pick the tool up to the home switch
Code"G00 X" & Xpos & "Y" & Ypos 'Move to the point where the tool change started
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com

Offline faby

*
  •  74 74
    • View Profile
Re: Tool measure macro
« Reply #2 on: July 31, 2006, 08:50:18 AM »
Well, I try it but... is not exactly what I'm looking for.

I write thins one... ::)


ChX = GetUserDRO( 1200 )
ChY = GetUserDRO( 1201 )
ChZ = GetUserDRO( 1202 )

Code "G53 G00 Z-0.1" 'Move the tool all the way up
Code "G53 G00 X" & ChX & "Y" & ChY 'Move to the probe position
While IsMoving()
Wend

Code "G31 Z-230 F450" 'Z move down until hit
While IsMoving()
Wend
ZposOld = GetVar(2002) 'Get the Position that the Probe hit at
Code "G53 G00 Z-0.1"'Z move all way up
Code "G53 G00 X65 Y-200" 'Move to change tool position
While IsMoving()
Wend

MsgBox ("Insert the new tool")

Code "G53 G00 Z-0.1" 'Move the tool all the way up
Code "G53 G00 X" & ChX & "Y" & ChY 'Move to the probe position
While IsMoving()
Wend

Code "G31 Z-230 F450" 'Z move down until hit
While IsMoving()
Wend
ZposNew = GetVar(2002) 'Get the Position that the Probe hit at
Offs = ZposOld - ZopsNew 'Make the difference with the old and new tool

Code "G53 G00 Z0.1"

Now i have the length difference between the old tool and new tool.
Is it possible to set the Z zero position as "machine coords"?

So i can get the old z pos as machine coords and correct it with the new one, without go on zpos with the machine...

 :-\  I don't know if you understand... :P

There's a DRO or system var (getvar(2002) ex) list?

Fabiano

Re: Tool measure macro
« Reply #3 on: July 31, 2006, 08:55:52 AM »
I set the axis to zero with this
Call SetDRO(2,0.00) ' This will set the Z axis to zero

Do you need it to do more then that?
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com

Offline faby

*
  •  74 74
    • View Profile
Re: Tool measure macro
« Reply #4 on: July 31, 2006, 09:14:51 AM »
sorry i don't understand,

maybe because i'm a beginner.

Zpos = GetVar(2002) 'Get the Position that the Porbe hit at
it's ok, but after this it stay there on the probe

Code "G00 Z" & Zpos' Move to the point where the probe hit
if Zops=-5 (for exaple) it result that g00 z-5 then the machine stay there...


Call SetDRO(2,0.000) 'Set the Z to 0.00
so I set the zero point on the probe and not where it was before tool change...

there's a way to indicate the z zero position as machine cood? if it's possible I solved the problem

Re: Tool measure macro
« Reply #5 on: July 31, 2006, 10:55:00 AM »
nope, I got the point where the probe hit THEN moved back to that point THEN call that Zero:

Zpos = GetVar(2002) 'Get the Position that the Porbe hit at
Code "G00 Z" & Zpos' Move to the point where the probe hit
While Ismoving()
Wend
Call SetDRO(2,0.000) 'Set the Z to 0.00

Hope this helps :)
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com

Offline faby

*
  •  74 74
    • View Profile
Re: Tool measure macro
« Reply #6 on: July 31, 2006, 03:15:06 PM »
I tryed it.... uhm sorry but it do exactly what I said.

the purpose of this macro is to change the tool and measure it for keep the zero point in the same plase as bofore the change...
I haven't a mobile probe to put on material

Pleeeeease, be patient with me, I don't do intentionally  ;D

I tryed this one, is the same as the old one except for the last 4 lines

ChX = GetUserDRO( 1200 )
ChY = GetUserDRO( 1201 )
ChZ = GetUserDRO( 1202 )

Code "G53 G00 Z-0.1" 'Move the tool all the way up
Code "G53 G00 X" & ChX & "Y" & ChY 'Move to the probe position
While IsMoving()
Wend

Code "G31 Z-230 F450" 'Z move down untill hit
While IsMoving()
Wend
ZposOld = GetVar(2002) 'Get the Position that the Porbe hit at
Code "G53 G00 Z-0.1"'Z move all way up
Code "G53 G00 X65 Y-200" 'Move to change tool position
While IsMoving()
Wend

MsgBox ("Insert the new tool")

Code "G53 G00 Z-0.1" 'Move the tool all the way up
Code "G53 G00 X" & ChX & "Y" & ChY 'Move to the probe position
While IsMoving()
Wend

Code "G31 Z-230 F450" 'Z move down untill hit
While IsMoving()
Wend
ZposNew = GetVar(2002) 'Get the Position that the Porbe hit at
Offs = ZposOld - ZposNew

ZNew = 0
ZNew = ZNew - Offs

Code "G53 G00 Z0.1"

Code "G00 x0 y0"

Code "g00 z" & ZNew
Call setdro (2,0.000)

This one work fine, but...
I don't like the fact that It has to go physically to the new zero to set it.

what do you think of my macro?
There a list of all DRO and system variables?

Offline nicad

*
  •  40 40
    • View Profile
Re: Tool measure macro
« Reply #7 on: August 01, 2006, 05:04:43 AM »
Hi. I have not done any scripting in Mach, but it looks much like VB code, which I am familiar with.

Brian- can you set a DRO to a value that is in a variable?

Instead of this:
Code: [Select]
Offs = ZposOld - ZposNew

ZNew = 0
ZNew = ZNew - Offs

Code "G53 G00 Z0.1"

Code "G00 x0 y0"

Code "g00 z" & ZNew
Call setdro (2,0.000)

Can you do this?
Code: [Select]
Offs = ZposOld - ZposNew
Call setdro (2,&Offs)   'Set the value of the DRO to the value that is in "Offs"
Code "G53 G00 Z0.1"   'or hoever high you want to go to get up safely off the probe
Code "G00 x0 y0"

This would get around having to goto the zero to set it, correct?
Re: Tool measure macro
« Reply #8 on: August 02, 2006, 11:32:45 AM »
That will work GREAT! and is just what I was going to tell him  ;D

the macro looks nice and if it works for you it is GREAT!!

Looking good
Brian
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com

Offline faby

*
  •  74 74
    • View Profile
Re: Tool measure macro
« Reply #9 on: August 02, 2006, 12:53:59 PM »
Yeeeesss it works!!!  ;D

It's exactly what I want... I'll post it asap.

There's a list of all DRO? where I can find it?

Thanks Fabiano