3D part design with OpenSCAD #70: coiled tube module.

A simple example of how to make a coiled tube with OpenScad that can be 3d printed.

1 min read
By Bob
3D part design with OpenSCAD #70: coiled tube module.

I recycled some of the code from the thread module to make a parametric coiled tube module that is customizable.

Here is the code:

/*[Coil Tube]*/
Show_Tube=true;
Coil_turns=1;//[.1:.001:16]
Coil_diameter=12;//[0:.001:100]
Coil_height=2;//[0:.001:100]
Tube_outside_shape=4;//[3:1:100]
Tube_inside_shape=100;//[3:1:100]
Tube_outside_size=1.5;//[.1:.001:12]
Tube_wall_thickness=.3;//[.1:.001:12]
Move_Tube_X=0;//[0:.01:400]
Move_Tube_Y=0;//[0:.01:400]
Move_Tube_Z=0;//[-400:.01:400]
Rotate_Tube_X=0;//[0:.01:360]
Rotate_Tube_Y= 0;//[0:.01:360]
Rotate_Tube_Z=0;//[0:.01:360]


Tn=100*Coil_turns;
Pitch_angle=360*Coil_turns;

module Spiral_tube(){
  if(Show_Tube)
  rotate([Rotate_Tube_X,Rotate_Tube_Y,Rotate_Tube_Z])
  translate([Move_Tube_X,Move_Tube_Y,Move_Tube_Z])
for (i =[0:.1:Tn]){
  translate([Coil_diameter/2*cos(i*Pitch_angle/Tn),Coil_diameter/2*sin(i*Pitch_angle/Tn),Coil_height*(i/Tn)])
  rotate(a=180+(i*(Pitch_angle/Tn)),v=[0,0,.1])
  rotate(a=90,v=[.1,0,0])
  linear_extrude(.68)
  difference(){
  circle(Tube_outside_size/2,$fn=Tube_outside_shape);
  circle(Tube_outside_size/2-Tube_wall_thickness,$fn=Tube_inside_shape);
}}}

Spiral_tube();

Here are some different examples of what can be changed by adjusting the variables: