• Models
  • Contests
  • Slicer
  • Login
  • Start Here
    thingiverse-iconprintables-iconcults3d-iconmakerworld-iconmyminifactory-icon

    3D GO

    3D ModelsContestsCollectionsSaved ModelsOn a mobile device?

3D GO

Privacy Policy
Splines for OpenSCAD 3D Printer File Image 1
Splines for OpenSCAD 3D Printer File Image 2
Splines for OpenSCAD 3D Printer File Image 3
Splines for OpenSCAD 3D Printer File Image 4
Splines for OpenSCAD 3D Printer File Thumbnail 1
Splines for OpenSCAD 3D Printer File Thumbnail 2
Splines for OpenSCAD 3D Printer File Thumbnail 3
Splines for OpenSCAD 3D Printer File Thumbnail 4

Splines for OpenSCAD

teejaydub avatarteejaydub

April 6, 2016

thingiverse-icon
DescriptionCommentsTags

Description

I was working on a project in OpenSCAD that needed smooth curves. I was excited to find some Bezier curve libraries, but as I used them I remembered why awkward thing about Bezier curves: they're hard to design with if you want precise control. You move a control point, and it pulls the curve one way, but it also affects other areas of the curve, so you have to nudge adjacent control points the other way to compensate, and then repeat forever.

What I wanted was to tell OpenSCAD exactly where I wanted the curve to go, with a few points, and have it make a smooth curve passing between those points. That's a spline. I couldn't find any spline libraries for OpenSCAD. So I made this one.

The main module, spline.scad, is directly usable with no other dependencies. Grab the zip file instead if you want to look at the examples, as they're dependent on a couple of other modules.

Functionality included:

  • spline ribbons - a 2D splined line with a given width
  • spline walls - like a ribbon, but extruded to a given height
  • Several varieties of spline noodles - shapes extruded along a splined path, including ramen (circular cross-section), udon (square cross-section), and sausage (OK, that's not a noodle, but it's a ramen noodle with rounded ends), plus a hose which knocks out the center of a ramen noodle to a predefined width.
  • Both a regular lathed spline and a lathed pot, which is handy for making a thin-walled lathed object that must fit around something else (the initial motivation).
  • Open and closed versions of most things - for open-ended curvy lines or closed loops.
  • Several examples, pictured here.

Limitations

Sadly, the noodles look pretty great in the preview, much of the time, but the current OpenSCAD code chokes on them while rending with internal assertion failures, especially if you do Boolean operations with other shapes. The other shapes compile fine, though, and reasonably quickly.

Also, the approach to cross-section orientation I'm using in the lofting algorithm sometimes breaks at sharp transitions. Some of this could be fixable without changing the interface; some of it may require manually specifying normal vectors at each path point. I'll work more on that.

I welcome your input if you want to work on these problems. Feel free to fork the code from my GitHub.

Also: I developed this using OpenSCAD 2016.02.09 and it uses some recent features, so it won't be compatible with older versions. OpenSCAD has been backward-compatible in my experience; if anyone has a reason to prefer an older version, I'd like to hear about it.

License:

Creative Commons - Attribution

Related Models

Curved honeycomb vase preview image

Curved honeycomb vase

eggnot profile image

eggnot

47,020

Stencil Book: Organize Your Creativity with Ease preview image

Stencil Book: Organize Your Creativity with Ease

3D KIMBA profile image

3D KIMBA

1,892

DRIED Spool Edge Tag for Bambu Spools  preview image

DRIED Spool Edge Tag for Bambu Spools

Joey Lopez Design (AeonJoey) profile image

Joey Lopez Design (AeonJoey)

3

Parametric pulley - lots of tooth profiles preview image

Parametric pulley - lots of tooth profiles

droftarts profile image

droftarts

35,580

Kurven for a marble run preview image

Kurven for a marble run

MK_Design profile image

MK_Design

286

Customizable - Curved Text Generator with Stroke  preview image

Customizable - Curved Text Generator with Stroke

NSHOP studio profile image

NSHOP studio

12

Photographic Sweep Stand preview image

Photographic Sweep Stand

HPaul profile image

HPaul

30,294

Adjustable Curve Sketcher preview image

Adjustable Curve Sketcher

Rossero profile image

Rossero

1,314