Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

leeminardi
en respuesta a: Anonymous

If you are procedurally creating the ellipse data in Matlab then you could also create the polyline vertex data too.

 

I was curious as to how well a 3rd Order BSpline with uniform knots (the AutoCAD default) and 4 control vertices (CVs) would fit an ellipse (this is equivalent to a 3rd degree Bezier spline).  Although a segment of a BSpline is a polynomial which cannot exactly duplicate an ellipse I thought I'd give it a try to see how close I could get.

 

The attached macro-enable Excel file compares the two curves.  It uses a custom Excel function I wrote to create BSplines given a value for the independent variable t and the CVs.  Since the ellipse has a slope of zero at x = 0 and is vertical at x = 2.5 in my example, the second CV should have the same y coordinate as the first and the third CV should have the same x coordinate as the last CV. Adjusting the second  CV (using AutoCAD) in x and the third in Y provided the CVs noted below.  A comparison of the two curves indicates a maximum variance of about 0.3%. Once you have a spline in AutoCAD you can convert it to a polyline with splinedit.

image.png

image.png

White = ellipse, green = splines

image.png

This was an interesting exercise but I think the best approach is to go directly from Matlab to AutoCAD polylines.

 

    

lee.minardi