Drawing a curve in a sketch using an equation - is it possible?

Someone I'm doing some work with on a project swears you can plot a line in solidworks using an equation. (He's more of a ProE guy than a solidworks guy - please don't throw stones my way...)

I have been doing some conic sections recently by actually sectioning a cone, using "offset entities" to create a sketch of the conic section, then chopping away the sectioned cone, leaving me with my sketch of a hyperbola, parabola, etc.

Is there a way to type in equations for curves?

for example: y = x^2

or: y = sin(x)

or: y = mx + b

(in my 8 years of SW experience, I've never seen it).

I know you should never say never, but I just don't think it's possible.

Please help prove me wrong! I want to type in equations for a line/curve!

Reply to
james
Loading thread data ...

There's nothing built in to SW to do that, but I have a macro that will draw a spline for you based on an equation and some other input.

formatting link
Go to the macro library link, it's called eqcurve. Requires excel.

Matt

Reply to
matt

Almost that simple.

If you want something like a spline on a sketch plane then record a macro. The macro will contain the creation of the sketch and the spline.

Delete the sketch used to create the macro and edit the macro. The basic idea is to create a FOR - NEXT loop that defines the spline. The one thing you have to watch out for is that the number of spline points used has to count down to 1. You create a parametric equation for x like:

x = A* sin(2*pi()*i/N)

where A and N are the amplitude and number of points to be plotted. Then A = 1 N = 20 FOR i = N to 1 step -1 x=2*pi()*i/N y=sin(x) code for creating a spline point with parameters i, x, y, 0 NEXT i

You will have to use your own analytic geometry skills to adjust the origin for the curve as well as how many cycles, etc.

However, now is a good time to ask that SW really get on the parametric bandwagon so that such an equation can be driven by distance along another curve like Pro/E.

Reply to
TOP

...and Thank You Matt for the link to the macro! I used this a month or so ago and it worked great for the parabolic mirror I was working on.

Thank you again,

sjm1.pitt

Reply to
sjm1.pitt

I examined your macro, Matt. Overall, very nice. One more reason that I am a fan of your work.

SW sketches support parabolas. For this purpose (a parabolic mirror), a parabola in a sketch is going to be more accurate, especially if you need the optical properties. Interpolating a spline (like the macro does) is going to introduce slight errors due to the fact that SW splines are 2nd degree in X and Y. I have done some comparisons in the past laying splines over parabolas to see how close they are. The spline always has some error, no matter how well defined.

A true parabola can be fully defined by 3 points. From the parabola equation, it is possible to determine three points to fully define and sketch a parabola. In the case f a parabolic mirror, you probably want to control the focus and apex (which actually define w/ 2 points).

Reply to
That70sTick

Paul.

Very good point.

It doesn't fit their "dumb everything down to the lowest common denominator" philosophy though. Don't hold your breath.

Mark

Reply to
MM

Thanks Tick, that is intresting. The mirror was for a flashlight prototype that was to be SLA'ed then a mirror plating applied.

I'll model the same mirror with the parabola sketch command and pop both models into GeoMagic Qualify and compare.

sjm1.pitt

Reply to
sjm1.pitt

interesting (duh)

Reply to
sjm1.pitt

interesting (duh)

Reply to
sjm1.pitt

Thanks for the info everyone.

For a "perfect" hyperbola, it looks like I'm still stuck with doing actual conic sections, then chopping away that's used to create it.

Thanks though! I'm sure I'll find some other uses for the spline macro. That's very cool!!!

Reply to
james

Hi Tick,

I drew the mirror in SW using the parabola sketch tool. Then using GeoMagic Qualify 6, I compared the two models. There was a small difference between the two I examined your macro, Matt. Overall, very nice. One more reason that

Reply to
sjm1.pitt

I suppose I wouldn't sweat it too much over a flashlight. Wasn't trying to bee too nit-picky. Mostly I'm just a bit of a math geek, so I tend to dig deeper into how CAD programs process geometry.

Reply to
That70sTick

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.