3D part design with OpenSCAD #103: grabbing an outline from an stl file with offset()

2 min read
By Bob
3D part design with OpenSCAD #103: grabbing an outline from an stl file with offset()

After making the last post I was experimenting with a way to grab an outline from any area of an stl file to use for a fillet or chamfer, it's pretty easy to do this using the offset command and making a frame around a design so you can fill in the open area with epoxy or molten metal will come in handy for things like making jewelry or signage.

here is the code:

//
 
/*[Offset]*/
Path_to_STL_File="";
height=4;//[0:.01:100]
Offset_out=1;//[0:.1:200]
Offset_in=1;//[0:.1:200]
Angle=1;//[0:.01:1]
move_z=0;//[-100:.01:100]

module Offset(){
linear_extrude(height,scale=Angle){
difference(){
offset(delta=Offset_out/2)
projection(cut=true)
translate([0,0,move_z])
import(Path_to_STL_File);
offset(delta=-Offset_in/2)
projection(cut=true)
translate([0,0,move_z])
import(Path_to_STL_File);
}}}

Offset();
translate([0,0,move_z])
color("green",.3)
%import(Path_to_STL_File);

here are some examples:

By adjusting the variables you change the angle, height, offset out, offset in etc, and can make some interesting new designs from your existing files.