[OpenSCAD] FIlling gaps between complex hollow objects
troberg.anders at gmail.com
Tue Jan 2 03:37:44 EST 2018
> I often find there is a difference between cad programming and software
programming in that there is less returned value in the effort to find very
general solutions to a loose set of problems.
I don't agree, I find it extremely useful to have a good library of useful
generic code, both for convenience and for readability.
Unlike most here, I use OpenSCAD for making plans for builds, not for 3D
printing. So, I have a library with all the parts I use, screws, eyebolts,
threaded bars, nuts, washers, wooden parts, chains, hinges and so on. I also
have some useful math functions. There is also a bunch of useful operations,
such as modules to put a radius on a corner, drilling holes, making
transition curves and so on.
How does this help me?
* I don't have to re-do each part.
* If I make a better, more detailed model, it'll be replaced in every
design. Fix once, apply everywhere.
* Sure, I could just to a difference with a cylinder to make a hole, but if
I make a difference with a hole object, it will clearly say "hole" in the
code. Likewise, a threaded bar is simply a cylinder if a certain diameter in
a certain color, but it makes for clearer code if it says threadedbar().
* Since each object has it's own call, I get a part list. I know exactly how
many screws I need, how many meters of each type of wood I need and so on. I
get it with prices, where to buy it, product number, sometimes even which
shelf in the store, and even the weight of the parts.
* Since each object and operation have it's own call, I also get an
"operations list". So, I know that I will have to measure and drill 300
holes, and that'll take approximataley so many minutes. I know that I'll
have to cut this many planks, and it'll take this long. If I want, I can
also add extra operations that aren't parts-based, or just because I know
that "rigging this up squarely will take some extra time...".
* It helps me remember what resources I have. Often, I sit and think "how
will I solve this problem?", looking at the parts and suddenly "Hmm, if I
take a hinge and lock it with a slide bolt...".
* It helps me keep a certain selection of standard parts. Nothing wrong with
having more different parts, but if there is no good reason for it, stick
with a part you have.
* You can adapt the modules so that it's more handy to use. For example, my
screws and bits that goes on screws (nuts, washers, wingnuts...) all have a
z-offset and a parameter to flip them (where applicable). So, I create the
screw, then simply stack everything that goes on it using only the z-offset,
then move it in place. Example:
This creates a bolt with a wingnut on the other end, and two square washers.
This can then be translated and rotated to wherever it's supposed to be.
Very simple and clear code.
Sent from: http://forum.openscad.org/
More information about the Discuss