__ __ __ __ /\ \ /\ \__/\ \__ __/\ \__ \ `\`\\/'/\_\ \ ,_\ ___ ____/\_\ \ ,_\ __ `\ `\ /'\/\ \ \ \/ /',__ /',__\/\ \ \ \/ /'__`\ `\ \ \ \ \ \ \ \_/\__, ` /\__, `\ \ \ \ \_/\ __/ \ \_\ \ \_\ \__\/\____/ \/\____/\ \_\ \__\ \____\ \/_/ \/_/\/__/\/___/ \/___/ \/_/\/__/\/____/

## Openscad Parametric Twist Containers

I printed one of the twist containers that Devin Montes made, and it turned out great. I had to make some of my own, so I could have any number of sides that I wanted. The idea is that there are two twisted prisms, where one is just slightly bigger than the other. If you get the tolerance right they will just barely slide past one another, which makes it hard for the air to get out. I designed them using the program openscad.

Since there is an inside and an outside the model should be saved as two stl files. I accomplished this with a shell script and an if statement with the input from the command. Here is the shell script:

#!/bin/shopenscad-DPART='"inside"' -o inside.stl twist.scadopenscad-DPART='"outside"' -o outside.stl twist.scad

And then for openscad there needs to be an if statement to use this input.
If the part is equal to *"inside"* then render the inside.
Otherwise, if it equals *"outside"*, render the outside.
And if it is neither of those, display both for preview purposes.
Here is the import part of the openscad code:

if(PART =="inside") { inside(); }else if(PART =="outside") { outside(); }else{ inside(); translate([size*2,0,0]) outside(); }

If the arguments say inside, it renders the inside. If they say outside, it renders the outside. Otherwise, it will preview both. Here is the full openscad code:

$fn=256;//resolution of shape, turn higher for more trisheight=100;//The height of the containertolerance=1;//The distance between the outer and the inner vasessize=70;//Approximately the diameter of the containerroundness=20;//The radius of the cornerstwist=-90;//Amount it twists by, negative to get a right handed containerchamfer_thickness=1;//How tall the chamfer ischamfer_width=1;//How far in the chamfer goessides=3;//Number of sides on the containerbase_thickness=3;//How tall the grip on the base isbase_width=2;//How for out the grip on the base isbase_slope=base_width/base_thickness;//How steep the grip ismodulebase() {//Make a circle for every side, and evenly space themhull() { for (i=[1:sides]) rotate(360/sides*i)translate([size/2-roundness,0,0])circle(roundness); } }modulehandle() {//Make two tapered prisms, and put them togethertranslate([0,0,-base_thickness]) linear_extrude(base_thickness/2,scale=(size+base_slope*base_thickness)/size)base(); scale([1,1,-1]) linear_extrude(base_thickness/2,scale=(size+base_slope*base_thickness)/size)base(); }modulechamfer() {//Make a taped prism for the top chamferrotate([0,0,-twist])translate([0,0,height-chamfer_thickness]) linear_extrude(chamfer_thickness,scale=(size-chamfer_width)/size) base(); }//The inside is the combination of a twisted prism, the base, and the chamfermoduleinside() { union() { handle(); linear_extrude(height-chamfer_thickness,slices=$fn,twist=twist)base(); chamfer(); } }//The outside is just a twisted prism, just slightly bigger than the insidemoduleoutside() { linear_extrude(height,slices=$fn,twist=twist) offset(tolerance)base(); }//Get part information from the command line, so that both the inside and the outside can be rendered automaticallyPART=undef;if(PART =="inside") { inside(); }else if(PART =="outside") { outside(); }else{ inside(); translate([size*2,0,0]) outside(); }