On 10/31/2017 at 6:54 AM, rmi said:Right now I'm using '*' or '!' in OpenSCAD to control which parts of a design are rendered
So I use openSCAD for certain projects and I've learned a few tricks by looking at other people's code. One is that at the top I have a bunch of "booleans" (variables that are 0 or 1) that turn on and off meshes. So for example I had a flashlight with a screw on top and I could "hide" the flashlight to export the top or "hide" the top to export the body of the flashlight. The booleans are used in an "if" statement that encloses an entire mesh.
I also have booleans to do cutaway views - I'll have a huge cube() that slices something open to see the inside. This is helpful when tweaking the design on internal structures.
I also have lots of variables to set things like hole sizes, part width, height, diameters, etc all at the top so it's easy to find something I want to tweak slightly (e.g. make all the screw holes 0.1mm larger).
This way of embedding cura settings in comments is pretty cool.
Whenever I slice anything with cura and print it (anything!) I save the project file (file/save as project...). When I reprint the same thing but a newer version or even just the same thing, I have the project file that includes all the settings for that item.
Something like this incomplete code snippet. Hmm. Tabs got messed up.
// visibility
show_outer=1;
show_inner=1;
cutaway_outer=0;
cutaway_outer2=1;
if (show_outer)
{
difference()
{
union()
{
// stuff here...
}
union()
{
if (cutaway_outer)
{
translate([-outer_diameter,0,-u])
cube([outer_diameter*2, outer_diameter*2, outer_part_height+uu]);
}
if (cutaway_outer2)
{
translate([-outer_diameter,-outer_diameter,-outer_part_height/2])
cube([outer_diameter*2, outer_diameter*2, outer_part_height]);
}
}
}
Recommended Posts
ehubin 0
Sounds interesting!
Are you planning to release something ?
If not could you share your code?
Link to post
Share on other sites