3D part design with Inkscape and OpenSCAD #105: A handy use for minkowski()

2 min read
By Bob
3D part design with Inkscape and OpenSCAD #105: A handy use for minkowski()

I was experimenting with a way to turn a flat 2D line into a round 3D line and minkowski works great for this, here is the basic code:

Path_to_SVG_File ="";
Sphere_size=2;//[.1:.01:20]
width=.001;//[.001:.01:20]
Rotate_x=0;//[0:.01:360]
Rotate_y=0;//[0:.01:360]
Rotate_z=0;//[0:.01:360]

rotate([Rotate_x,Rotate_y,Rotate_z])
minkowski(){
linear_extrude(width,center=false)
import(Path_to_SVG_File,layer="layer1",$fn=100);
//sphere(Sphere_size,$fn=60);
rotate([0,90,0])
cylinder(.1,.1,.1,$fn=8);
}

Uncomment the sphere line and comment out the rotate and cylinder lines to try it with a sphere.

I drew a line in Inkscape and rounded the corners like I did in the last post:

Then I made a simple OpenSCAD program to use minkowski to merge a sphere with it.

It works best if the stroke size is smaller than the sphere size, unless you want a flat line with rounded edges.

I added a width adjustment to make handles:

Here is an example using a cylinder instead of a sphere, using a cylinder with minkowski is pretty fast compared to using a sphere:

open image in new tab for larger picture

I will be pretty easy to make a hollow pipe, a feature I will be adding in a future post.