Bezier Library for OpenScad
by ckirby, published
Updated 5/10/13--fixed triangle winding in centered BezWall; use polyhedron for variable-height BezArc.
I wanted a bezier library that could handle an arbitrary number of control points. When working on thingiverse.com/thing:77586, I also wanted to rotate extrude a "wall" defined by a bezier path and a width.
BezWall is the workhorse function. The "ctlPts" parameter accepts between 1-8 bezier control points.
The parameters "width" and "height" accept static values (e.g., 5) specifying the width and height of the wall. If height is 0, it will generate a 2d object you can extrude yourself.
The alternate parameters "widthCtls" and "heightCtls" accept an array of values that will be bezier-interpolated along the length of the wall.
If the "centered" parameter is "true", the wall is centered on the path defined by "ctlPts". Otherwise, one edge of the wall is defined by "ctlPts".
At the moment, there is no documentation! But there is a test file that runs through most of the available features.
Recent Commentsview all
awesome. Thanks. Sorry I couldn't sort it out from the examples you gave. Got a paypal account? I'd like to buy you a coffee.
Hi, I think you're looking for the BezArc function, which creates a solid around a focal point. You can also vary the height of the solid vary according to a bezier curve by passing in an array of "heightCtls", (e.g., heightCtls = [1,2,10,2,1]) instead of a static "height" value.
], focalPoint = [0, 0], steps = 16, height = 10);
This is great; offers a lot more control than other similar functions I've found. I'm using it to create a mold for a carbon fiber guitar.
I'm trying to figure out how I could take one of the simple BezWall functions and have it filled in. Rather than a wall with a bezier curve, I'm looking for a slab with a bezier curve edge (like this, but this function doesn't have enough control points): http://www.thingiverse.com/thi...
This is my first dive into CAD, so there might be a way to do this that I'm not seeing.
Liked Byview all
Give a Shout Out
The BezLine function is simpler than BezWall and offers a subset of the BezWall functionality.
BezLine takes an array of 1-8 control points and an array of 1-8 width values, which will be bezier interpolated as widths for the resulting line.
BezLine doesn't accept a "steps" parameter. Rather, it takes a "resolution" parameter of between 2-6. The resulting line will have (2**resolution) segments.
BezArc returns a shape similar to that generated by WilliamAAdams' BezQuadCurve function.
You must be logged in to post a comment.