View Full Version : NEW MEMBER: Just joined, hobby level

cncgcg

26-11-2011, 06:49 PM

Hi

My name is Gareth, I'm from the UK but have lived and worked for over 30 years in Germany, having arrived here with the British Army and never going back ( I joined the army to escape where I was, so going back wasn't an option).

I use a hobby level CNC machine, self built from a kit and write software to make it cut simple shapes.

Gareth

black5f

02-12-2011, 12:02 AM

Welcome! Mine runs on homebrew software too!

Tom

cncgcg

02-12-2011, 05:50 PM

Hi Tom,

Thanks for the reply,

Have you ever tried a bowl shape?. I have been thinking about the trig for this for a while now. I remember seeing a G code routine doing something similar and it used Tan, but the way I visualise it you only need to mill repeated circle pockets moving inward with Z increasing down as it moves inward, which is also calculated with Cos or Sin and not Tan. Doing it this way makes it easier for me to also generate a scaled curve rather than a pure circular one i.e much deeper or shallower as required. If you look at my program you will see what I mean about scaling the arc.

By scaling I mean ellipse, it's just my word for it since the program produces elliptical arcs depending on the X,Y scaling. Can you follow me?

Here is the program, take a look at Arc, click the Arc button, drag the mouse in the drawing area to make the shape appear and scale X,Y to say 100, 45 and a sweep angle of 180 degrees. yes it's mm's, I got metrified years ago sorry

http://cnc-gcode-software.com/wp27

Gareth

Jonathan

02-12-2011, 06:29 PM

At first it looks like just simple sin/cos ... but if I may there's one thing I think you might be missing out? When using a ballnose cutter, unless the cutter is kept perpendicular to the finish part's surface (impossible on a bowl without 5-axis) the cutter will cut more material off than intended. That's because the cutter is not a point, it has a finite diameter and the outer edge will cut more from the surface. It gets worse as the surface is steeper. This diagram will hopefully make it obvious:

4989

It's a fair bit more difficult to work out the co-ordinates for that...

cncgcg

02-12-2011, 07:07 PM

Hi Jonathan,

Thanks for the reply,

Very illuminating about it having to be kept perpendicular to the surface (impossible without 5 axis, as you said). I'm hobby level as I said, but it would have been fun trying to write it.

I think my idea, having looked at what you wrote, would result in a stepping effect, is that right?.

Is Tan necessary to roughly accomplish what I'd hoped for or can this all be done using Sin Cos alone?. I'm not into Tan...

Regards

Gareth

black5f

02-12-2011, 09:06 PM

Hi

A bowl. Ok, whats your maths like? Sorry as this might seem a little blunt! But, it's the way to do it. I did a quick picture like Jonathan to explain the problem with set steps in z:

4991

Suffice to say, from above they won't be evenly spaced circles either. You need to use vector geometry. A bowl is quite a simple surface, but this applies to all surfaces (ignoring the tool hitting other things!). You know the point on the surface you need to goto, x,y,z. You need to calculate the tangent to this surface, in 2D its a line, in 3D its a planar surface. Differentiate the equation (easier than it sounds) of the surface to get the equation of the tangent, because it's a bowl there are simpler equations that give the tangent at a point, again, a line in 2D, a plane in 3D. You need to calculate the normal vector to the tangent at the point the tangent and surface intersect, ie x,y,z. This is a line perpendicular to the tangent, normally, you would normalise it, ie, make the length = 1. To define it, in plain terms, you need to goto the point you want to cut to, them move away in the direction of the normal. The normal should point to the outside! This is represented by an equation. The actual tool offset is along this vector for a distance of the raduis of the tool (this is the centre of the tool, other trig will give the tool tip). You should end up with a vector equation, (x",y",z") = (x,y,z) + a(x',y',y') where, the modulus (length (pythagoras)) of (ax',by',cy') (multipied out now) is the tool radius and (x',y',y') is normal the vector from (x,y,z). 2D is a little simpler but you still need to work out the tangent to the semi circle at the point you want to cut.

Yes I know how to do this, and thats sad!

The good news is that it's a bowl, so the normal vector is actually the line from the point you want to cut to the bowl 3D centre. So....

If the centre of the bowl is (i,j,k), then the normal vector is always (x,y,z) - (i,j,k), lets call that (q,r,p) = (x-i,y-j,z-k). normalise .. t=sqrt(q2+r2+p2) so

normal vector is now (q,r,p) = (q/t,r/t,p/t). This is the normal from (x,y,z) though! Say the raduis of the tool is 3mm. If I want the tool edge to be at (x,y,z), the tool centre (of radius) must be at (x",y",z") = (x,y,z)+ 3(q,r,p). ie ((x+3q),(y ... etc This assumes the vector points inwards!

So for a hemispherical bowl only ... work out the series of points that form each circle at even z depths (spreadsheet will do this), probaly easier to work out the radius of the circle first. Know where your bowl is in 3D space! Use the vector equation to calculate the tool position (add it to the point on teh circle, if programming the tip just add (0,0,-3) to the answer.

Generally speaking you will get a good fininsh if z steps (and x,y moves on the circle are about 10% of tool diameter). Not trying to be clever or show off or anything, this is the way to do it, 25 years ago I wrote some surface modelling software for making lasts (shoemaking), csplines, bicubic patches etc etc.

Tom

black5f

02-12-2011, 09:21 PM

I should add that to read a vector equation primer or two will help.

http://www.gamedev.net/page/resources/_/technical/math-and-physics/vectors-and-matrices-a-primer-r1832

You'll be programming vector transformations using matrices in no time at all!

But.... strictly work to rule No 1!

Rule 1. Have fun!

Rule 2. See rule 1.

Tom

black5f

02-12-2011, 11:35 PM

Hi

A bit bored tonight. Looked at your site, Good stuff mate! Had a few whiskys so may be errors! If you need to do other regular shapes just replace the circle equation with your own but it assumes a hemisphere and cheats by using the centre to tool contact as the normal, for elipses etc may be different but for regular shapes you can use the focus. Anything planar is easy. If you let me know the equation of the surface I will tell you the eq of the normal. These are just the finish cuts of course, you will have to cut the other material out with concentric circles keeping z constant. Other surfaces are the same, just need to know the normal vector. Actually you could incorporate a tool deflection number as well relatively easily. This is all to the centre of radius of the tool, just adjust the z path by the radius if you need to work to the tooltip.

Something to play with ...

http://homepage.ntlworld.com/tombayes/public/Book1.xls

Change the numbers in red.

Jonathan

03-12-2011, 12:05 AM

You beat me to it, nice explanation! I used the same method with vectors in my wind turbine blade profile and tool-path calculation program. Using the equation for a NACCA airfoil, which doesn't simplify as nicely.

black5f

03-12-2011, 12:16 AM

BTW tan is just sin/cos.

black5f

03-12-2011, 01:12 AM

You beat me to it, nice explanation! I used the same method with vectors in my wind turbine blade profile and tool-path calculation program. Using the equation for a NACCA airfoil, which doesn't simplify as nicely.

Cheers! Sounds lke a nice project, hope you differentiated the eq to get the tangents ;-) Somewhere I still have the source I wrote for a surface model with 310 bicubic patches. That a patch bounded by four cubic splines (48 coeficcients) (just in case!), all continuous with each other. I had algorithms to calculate the normals at any point (for shading), integrals for area, routines that solved the intersections of them with planes for crossections. And, believe it or not, it ran on a BBC model B because the IBM pc hadn't been invented yet! I remember rewriting it in pascal for the pc.

Tom

cncgcg

03-12-2011, 01:07 PM

Hi Tom,

Thanks for all the work you put into the reply, it will keep me going for ages. The last time I had anything to do with matrixes was rotating wire frame graphics, also on a BBC B 32k which I bought Christmas 1983, for a months wages I think, from the NAAFI in Bielefeld where I was posted. Prior to that, in school, where we did them endlessly it seemed, and never knowing why.

Gareth

black5f

03-12-2011, 01:32 PM

Hi Tom,

Thanks for all the work you put into the reply, it will keep me going for ages. The last time I had anything to do with matrixes was rotating wire frame graphics, also on a BBC B 32k which I bought Christmas 1983, for a months wages I think, from the NAAFI in Bielefeld where I was posted. Prior to that, in school, where we did them endlessly it seemed, and never knowing why.

Gareth

It's bizar really, probably I'm getting old. I learnt all the maths at Uni but never really saw the point. We had a computer but you had to puch holes in bits of card! When I started looking into CAD/CAM possibilities in my industry I started off, then there was a day when suddenly I started to recognise stuff, got out my old notes and there it was!

I've bene interviewing Maths grads recently and none of them have ever coded anything? If I ran a maths course, I'd start with one frame from star wars, zoom in on a bit 100 by 100 pixels and start explaining the maths behind it. A lot more engaging!

There's a really good book I used in the 80's, I see now it's on the 8th addition of something. There should be loads of these 2nd hand as they are the bible. It assumes very little, work through it from the start and it gently introduces stuff, with examples. I have a selection but they are all at work, I'll write a list later!

http://www.amazon.co.uk/Engineering-Mathematics-K-Stroud/dp/1403942463/ref=sr_1_2?ie=UTF8&qid=1322918706&sr=8-2

There are others but they assume a lot!

Tom

Powered by vBulletin® Version 4.2.3 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.