PDA

View Full Version : Curve formulas applied to z value in sbp files?



scottcox
05-09-2008, 12:07 PM
I guess I've forgotten my calculus. I'm trying to cut shapes out of a profile and vary my z height according to where I am on the profile, all so I can use a short bit.

I can write the x,y cutout file into sbp format and then modify the z values with MS Excel or a databse program, if I only remebered how to write the formula.

Here's a side view of the profile. I will be cutting x,y ovals from this z profile and wish to vary my z height based on the y value. Follow?


5092

Here are the z offsets that I need to use based on known y values, but my toolpath files (from V-Carve Pro) will inevetibly have random y values between my known y values.


5093

Can someone help me write the formula I need to calculate the z heights for those random y values?

dvanr
05-09-2008, 07:36 PM
Hi Scott

There is a useful tool in excel.

Create a line graph using the charting tool in excel. I think you only need to use half your data as the line can be mirrored. In the chart, right click on the line and box will open up "format trendline" click it and a box appears with three tabs, pattern, type, and options.

Select type, either power or polynomial may do for your purpose. Then select the options tab and click "display equation on chart"

Do some testing of the generated equation, I have found that the generated small numbers in some equations can be a inaccurate in some circumstances. (Another MS feature!)

mrdovey
05-09-2008, 09:18 PM
Scott...

Are the two curves circular arcs?

...Morris

dana_swift
05-10-2008, 08:45 AM
You have a list of methods to choose from!

Probably the simplest method is to use the standard Cartesian equation for a circle:

r^2 = (x0-x)^2 + (y0-y)^2

or the alternative polar form:

x = x0 + r * sin(theta)
y = y0 + r * cos(theta)

and adapt that to defining the cut for the Z axis. I do that all the time (using C#) to get equation defined Z profiles.

In excel to convert the spread sheet to a SBP file create four columns, the first should have M3 in it, then the next three columns should have X, Y, and Z. Select the range of cells that have the move commands you want in order, Then save the selection to a file as "comma separated values". Set the extension to "sbp".

Hows that for simple?

However if you just want to use your calculus you can create a second order integral equation of motion and solve for the appropriate scale factors. I wont bother with the details, but if you like I will solve them and post it here.

Algebra is really all that is needed.

FYI I use Maple to solve equations like that for me using either the above approaches. When I enter a formula in either Cartesian or polar form Maple figures out the simplest form of the the result and can change it for me automatically. As far as I am concerned Maple is like having a "PartWorks" for mathematics. Or CNC for Math! (Same learning curve of course!)

If you do use Excel for generating toolpaths I highly recommend you BOTH preview and do an air-cut to be sure you got what you want before making mistakes faster than sawdust.

Excel has no concept of sequence from one line to another although it can be programed to add your headers and footers to the SBP file.

In a recent post I uploaded a short C# program you might use as an example for cutting a circle in X and Y with a user chosen error from the piece-wise approximation of the circle.

Hope that is of some help-

D

dana_swift
05-10-2008, 10:25 AM
Specifically to create a circular Z cut centered at X=0, you can use the following equations.

d = the depth of the circular depression to be cut
w = half the width of the depression

So: the depth of the cut is 0 at -w and +w, and "-d" in the middle.

First find the center of the circle (0, c) which is above the surface of the part to be cut:

c = (w^2 - d^2) / 2d

Now find z for any x between -w and +w:

z = c - sqrt((c-d)^2 - x^2)

There you have it for any circular z cut.

Unfortunately the SB3 software does not support FOR loops or this could all be put into one nice tidy SBP file! Excel can solve that easily!

Hope that helps-

D

Brady Watson
05-10-2008, 10:34 AM
Scott,
FYI - this can be done easily & consistently in ArtCAM on both 'linear' curves & complex ungulating shapes...in case you give up with the math route.

-B

mrdovey
05-10-2008, 11:13 AM
I've resurrected a couple of old web pages dealing with circular arcs and coves/domes (as well as some geekish stuff on how-to-cut extruded arcs) that might be handy. There's an index page here (http://www.iedu.com/DeSoto/Projects/CNC/).

dana_swift
05-10-2008, 12:08 PM
Again I have to agree with Brady, if you have spent the $7500 on artcam it may be able to do the radius pocket cut for you and probably in less time and effort. Then if you have Excel or an equivalent tool you can do it for yourself for about $7000 less.

Morris- I like your page and your derivation (I left that detail out), its the same math with the zero at the bottom of the arc.

A tool like Artcam is wonderful for one-off things that are within its capabilities. My personal experience is I seem to keep wanting "one more feature" than whatever commercial software I have on hand. So I find myself doing the math and getting the results I want. The shopbot is so much more capable than the CAD software driving the design process. By doing the math, I can get all the shopbot and my imagination are capable of.

Math is just another tool, no less than CAD or the shopbot itself. Use the best tool for the job from what is available.

D

scottcox
05-11-2008, 02:42 PM
You guys are great!

Thanks very much for your help!