Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: paul on May 13, 2006, 06:06:57 AM

Title: VB Script re G68 to edge find
Post by: paul on May 13, 2006, 06:06:57 AM
Hi please can anyone help. this is what i need to do, Use VB script attached to a button,
  probe touch on 2 places on one edge of work piece,
  use G68 to rotate program,
  set X axis to zero,
  also is G68 limited to only 1 decimal place.

             Many thanks Paul
                         From the uk
Title: Re: VB Script re G68 to edge find
Post by: Brian Barker on May 13, 2006, 08:55:07 AM
There is a wizard that I did in the files section of the Yahoo group. I never finished it but it is a good place to start... There is WAY more than the one decimal place, the display is set one there is about 32 decimal places in Mach3 :)

The point that I got to but didn't finish is the vector math that will put the 0,0 position in the intersection of the two points. I have stuff for that that I have done in C++ and I think if we ask nice Art will add it to Mach3 :) You will just have to pass the points to the function and you will get back the point in the X and Y where the corner of the part is.

Title: Re: VB Script re G68 to edge find
Post by: paul on May 13, 2006, 10:28:27 AM
Hi  Brian Thank you for your very fast response especially as its still breakfast time in the states. Unfortunately as a mechanical engineer new to CNC am finding VB scripting very hard to learn. I have downloaded your set Rotation. zip file from Yahoo site but don’t fully understand how to finish or implement it. Would be very grateful if someone could point me in right direction. Have spent many hours on line, reading up on this. Still long way to go. Changed  DRO 118 to display 4 dec places got that working ( that was easy bit ).

      Many Thanks Paul
Title: Re: VB Script re G68 to edge find
Post by: Brian Barker on May 13, 2006, 09:38:03 PM
If you would like to work with me.. After i get back from my trip to the workshop we could start making he code to do the fixture rotation! I don't have a probe set up on my mill at this point so I could use your help :) And I am a Mechanical Engineer so they can learn VB :) (There is light at the end of the tunnel)..
Title: Re: VB Script re G68 to edge find
Post by: paul on May 14, 2006, 07:54:59 AM
Hi  Brian that sounds great, let me know what I can do to help.

        Many Thanks Paul
Title: Re: VB Script re G68 to edge find
Post by: fer_mayrl on June 14, 2007, 12:03:07 PM
Hello Brian,
I was trying to make something like what you described on this thread, but instead probe 2 places on the x side, and 2 places on the y side.
The 2 places on the x side would help determine the angle of rotation for the G68, just by using trigonometry.

The 2 places on the y side will help determine the slope for a second curve, if you make the equation for the first curve equal to the equation of the second curve, you should be able to find an intersection of the two curves which should be the very corner of the stock.
My question is, how would you solve that equation in VB?

I think this would be a great addition to Mach!
Does G68 work in Quantum?
Regards
Fernando
Title: Re: VB Script re G68 to edge find
Post by: vmax549 on June 14, 2007, 10:19:54 PM
I have a set of Mcode macros that do CR with a probe. One of each direction X+,X-,Y+,Y- and Center of 2 holes if you are interested I can dig them out. I use them for different fixture setups, Very usefull critters for doing setups. Probes two points on the plane and calculates the angle then rotates from the first point.


I also have one to probe for the center of a circle and returns the diameter.(+-.0005") These Mcodes are self contained and can be run from the Gcode or MDI

One to probe the xaxis and returns to center and gives the distance between 2 points
one for yaxis"""""
ONe to probe the zaxis at 90deg to spindle for center and distance.

I am working on a CMM screen have most of it working just need to iron out the bugs.

Anyone good at building screens????


If someone could build a good looking CR screen you could assign them to buttons. I have a screen but it is ugly. It works but ugly (;-) TP

(;-) TP
Title: Re: VB Script re G68 to edge find
Post by: fer_mayrl on June 14, 2007, 10:31:07 PM
Hey TP,
Does your set of mcodes work out the 0,0 point at the corner of a tilted part by probing two locations on x edge and 2 on y edge?
Regards
Fernando
Title: Re: VB Script re G68 to edge find
Post by: poppabear on June 14, 2007, 10:38:30 PM
Look under the "conversational" Screen set I wrote, under Mach Screens.

On the second or 3rd page, there is a Section for figuring out the G68, no matter what quadrant you are in, just touch off the two corners of your vice or fixture.

If you need to just copy the DRO's, Buttons, and script that are in that section and paste them onto your screen and you could always access them.

Scott
Title: Re: VB Script re G68 to edge find
Post by: vmax549 on June 14, 2007, 11:02:39 PM
Fernando, it does not, but would not be that hard to add to it. Poppabears wizards work, Brians stuff is good. Maybe we just need to colaberate on this and get a good CR screen to add to mach. THen we can work on the CMM screen.

We just need someone to build us a killer screen so we can add our own objects and code, I have seen the code done several different ways but they all seem to work ok. I chose to work with Mcodes so I can call them from a gcode program or the MDI line.The problem with Mcodes is that you cannot stop in the middle of a macro to jog over to somewhere else to pick up another point. THat is where the screen would work better you could do what you wanted in segments and then push a button to complete the task.

NOTE: With the way MACH does the G31 motion, you have to account for the "lever travel" to trip distance to have an accurate measurement. With my probe and the 2"stylus it is .0075" plus the radius of the tip. If you change the length of the stylus you have to reapply the different lever ratio allowance to the code. It would be nice if we could get ART to change the G31 motion to trip,reverse,record the trip point on reset. It would also allow you to reverse the G31 direction without having to G1 off the trip point before you preceed. (can't g31 or jog off of a trip point) It makes using mach to do CMM work a real pain. If the motion were changed CMM would be a snap.

WARNING: WHen you rotate with G68. the jogging does not follow the rotated coordinate base it follows the Machine coordinate base. This can be very strange to jog around. THings do not move in relation to the fixtured part. I wiped out a very expensive probe the first time I rotated 45deg and went to jog away, hitting the fixture clamp. It may just be ME but be very carefull.

(;-) TP
Title: Re: VB Script re G68 to edge find
Post by: Brian Barker on June 14, 2007, 11:09:41 PM
I was taling to an OEM and I think it is time to add this to a plugin... It is just more then I think I would like to do in VB! It will require more math then anyone would think ;)

Thanks
and it should be soon...

Brian
Title: Re: VB Script re G68 to edge find
Post by: fer_mayrl on June 14, 2007, 11:12:07 PM
Im going over the math required and I just noticed i am VERY VERY rusty, this is high school stuff and i am having trouble figuring it out!

Ill give it a shot though, Brian, let me know if I can Help.
Regards
Fernando
Title: Re: VB Script re G68 to edge find
Post by: Brian Barker on June 14, 2007, 11:15:19 PM
The math for me is very simple... I will do it all with vector math, I have done all the math needed to solve the problem but the code is in Lcam :( I will just pull the code from Lcam and put it in the plugin... That should do it ;)
Title: Re: VB Script re G68 to edge find
Post by: fer_mayrl on June 14, 2007, 11:26:19 PM
Great!
I just figured the math out... took a little bit to get the gears on my head going. But you are right, it is very simple

A couple of Y=mX+b, then just find the intersection of both curves by making one equal to the other, and that point becomes 0,0. now basic trigonometry on one of the curves to get the angle of rotation and thats it.

Brian, can the plugin be made so that you can add a compensation if you are using a touchplate on the side of the piece?

Again let me know if i can help.
Regards
Fernando
Title: Re: VB Script re G68 to edge find
Post by: Brian Barker on June 14, 2007, 11:32:05 PM
it is not that simple :( You are better to get the vetor of the line ... after you have the vector you need to offset the points to the side that you get the 3rd point from. At this point I could add code to offset the dist of the plate and so on... I will be able to offset the Dia of the ball at the end of the probe.... I don't see a problem with all this!
Brian (I just need to get a better probe)
Title: Re: VB Script re G68 to edge find
Post by: vmax549 on June 15, 2007, 12:35:39 AM
Brian do not forget the distance to trip allowance in the probe or your true 0,0 point will be off by that amount in x,y. With a $3k probe it may be in the millimicron amount but in a low end probe it is in the .005-7" range. (:-) I have been working on that very same problem with low end probe accuracy. Think I have it figured out now. repeats to .0002-5 accurate to .0005 with the proper TDA compensated for. Each probe can be different. I calibrated this one to calculate the allowance, if I change the stylus to a longer or shorter one the TDA changes.

Also take note that you need to do what ever you need to do with the g31 cycle before you rotate as it does not work once you have rotated with G68

(;-) TP