![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| G-Code Programing Discuss G-code programing and problems here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
Don't know if anyone can help with this one, but working to the notion that the only dumb question is the one that is never asked... I'm writing a G code interpreter for an 8 bit micro. I have an algorythm that will give me next step on an arc but it needs the centre point and RČ. Easy if the arc is defined with I and J because that defines the centre and RČ = IČ + JČ Unfortunately I and J are not guaranteed, I may only get a radius, the direction of rotation and a promise that the arc is not greater than 180 degrees. Is there an easy way to find the centre if that is all you've got to work with? So far I have got away without sines, cosines, tangents, roots and binary fractions. I could use a pre-processor on the host computer and replace R with I and J but that is an added complication. I could simply throw an Error and demand I and J, but is it fair to assume g-gode generating software can be switched? Also, I'm working in signed 24 bit numbers and my maximum useable distance is 34 feet. Plenty for x, y and z co-ordinates, but is it fair to throw a 'number too big' error if the arc radius exceeds 34 feet? There has to be a limit somewhere. |
|
#2
| |||
| |||
|
__________________ Software For Metalworking http://closetolerancesoftware.com |
|
#3
| |||
| |||
| not sure what you're asking here. if you know the i,j values you can easily determine the radius as the i & j are are your adjacent & tangent values. therefore the hypotenus is your 'R' value. if you know the start point of the arc, simply add or subtract you i, j values to find the centre. hope this clarifies. |
|
#4
| ||||
| ||||
| I think he wants the center of a G2/G3 arc using R and not I and J.
__________________ Gerry Mach3 2010 Screenset http://home.comcast.net/~cncwoodworker/2010.html (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management) |
|
#5
| |||
| |||
| The problem is when there are no I and J values, example N35 G03 X180.000 Y123.000 R1.500 F72.000 Very easy to draw. You simply set your compass to R and then draw intersecting arcs centred on the start and end points. I can't believe it is a difficult, the early g-code interpreters were kinda basic, (unless the R only option came later). I think I may be missing a trick which is making something simple, complicated |
| Sponsored Links |
|
#6
| ||||
| ||||
| Don't know the math off hand, but if you draw two circles with the R radius and their centers at the start and end points of the arc, they'll intersect at the center. Basic geometry.
__________________ Gerry Mach3 2010 Screenset http://home.comcast.net/~cncwoodworker/2010.html (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management) |
|
#7
| ||||
| ||||
| http://local.wasp.uwa.edu.au/~pbourke/geometry/2circle/ http://mathworld.wolfram.com/Circle-...ersection.html
__________________ Gerry Mach3 2010 Screenset http://home.comcast.net/~cncwoodworker/2010.html (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management) |
|
#8
| |||
| |||
| 080322-1014 EST USA Robin: From your first post there is insufficient information to define the arc center. I will assume you know the starting point of the arc, and you said the radius was known. Thus, the center of the arc is some place on the locus of a point at a distance of R from the start point. In your second post you imply knowledge of the end point. From a knowledge of the start and end points you can create a straight line, AB, between the two points. A line drawn perpendicular to the line AB and thru its midpoint contains the arc's center. You can determine the equation for this line, the length of AB, and the length of the line from AB center to the arc center. The length of AB is ( (X1-X2)^2 + (Y1-Y2)^2 )^(1/2), and the center point of AB is at X2 + (X1-X2)/2 = Xcp and Y2 + (Y1-Y2)/2 = Ycp . Let the perpendicular line be CD, then the length of CD is ( (R)^2 - (AB/2)^2 )^(1/2). Whether you use this technique or trig functions your processor must be able to perform the operations. . |
|
#10
| ||||
| ||||
We have written a few applications that do this ... our Trig Kalculator is one. I believe you are trying to do this from a G code program. I hope I got that right ... if so, you need to know the START POINT and the END POINT ... you should know the start point from the last coordinate point in the G code program ... using that start point and the end point ( called out in the G2/G3 line) and other sine, cosine functions, you can find the arc center. But it takes a couple of calculations to get there. Real World Machine Shop Software at www.KentechInc.com |
| Sponsored Links |
|
#11
| |||
| |||
| Robin: I do not understand your comment. The Pythagorean theorem does not require a relationship to a coordinate system. From the The American Heritageź Dictionary of the English Language, Fourth Edition "The theorem that the sum of the squares of the lengths of the sides of a right triangle is equal to the square of the length of the hypotenuse." Line CD and 1/2 of AB as I proposed forms a right triangle. What I suggested was a way to find the center of the arc from a geometric construction knowing the arc's end points. This involved straight lines and right triangles. and calculatable values. . |
|
#12
| |||
| |||
| That's how I did it when I had the benefit of a C compiler, it is a vector. But now I'm re-writing it in machine code. Everything is lightning fast and extremely compact. I want to keep it that way and I'm going to try and solve this for a while longer before I give up ![]() sep = hypot(x-xx,y-yy); // separation start to end in XY ang = getangle(xx,yy,x,y); // angle of line start to end vect = racos((sep/2)/r); // vector to center if(dir==CW) vect = ang-vect; // CW = turn left else vect = ang+vect; // CCW = turn right while(vect>=r360) vect-=r360; while(vect<0.0) vect+=r360; cx=xx+(cos(vect)*r); // locate arc center cy=yy+(sin(vect)*r); |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| hub centre steering | spoiledbrat | Moldmaking | 2 | 09-07-2009 05:30 AM |
| Another Aussie Adventure in Optical Edge/Centre Finding | Greolt | Mach Software (ArtSoft software) | 8 | 04-01-2008 03:48 PM |
| Threading on a CNC turning centre | cnc-it | Fanuc | 4 | 10-24-2007 01:32 PM |
| Off centre turning | Integrex | General Metalwork Discussion | 0 | 04-10-2007 10:35 PM |
| Kitamura My Centre 2c | scappini | Mechanical Calculations/Engineering Design | 0 | 07-10-2006 07:34 PM |