3D part design with OpenSCAD #120: Transparency trick

1 min read
By Bob
3D part design with OpenSCAD #120: Transparency trick

Sometimes it's helpful to "see into" your design to align objects or make sure they overlap properly, and while you can set the transparency with color, if the items overlap they block out sections of one another. Here is a way to temporarily make them transparent, and while you can't fully render the design while it's transparent, it will still help to visualize what's going on inside.

Here is the example code:

//

transparent=true;

if(transparent)
%color("lightblue",.3)
%render()
difference(){
cylinder(50,50,50,$fn=100);
rotate([90,0,0])
color("green")
import("/home/none4/Desktop/Svg Layers3.stl");
}

else{
render()
difference(){
cylinder(50,50,50,$fn=100);
rotate([90,0,0])
import("/home/none4/Desktop/Svg Layers3.stl");
}}

rotate([90,0,90])
color("yellow",.4)
import("/home/none4/Desktop/Svg Layers3.stl");

And here are some different results: