I always place holes and fasteners relative to their object. If the object
is positioned in a complex way I simply make a module to position any child
there. Then I can use that to place the object and its fasteners and holes.
It doesn't really matter how complex the positioning is, it can be made by
composing several relative positioning modules. The example above places
fasteners relative to the PCB and places the PCB into the base assembly.
The base assembly is translated and rotated into its place in the box by
the main assembly. It doesn't matter how complex the positioning is, I only
express each part of it once in a reusable module.
I also make boxes from CNC routed DiBond and acrylic with printed parts to
join six sheets and a hinged door, which can't be too different from your
uses. In that case I have an assembly module for each sheet laying flat
with the parts and fasteners on them. Then the box assembly module
translates and rotates those sheets assemblies into place and all the parts
and fasteners come with them. So their final positions are quite complex
but I never need to express that directly. To make a view of the box
unfolded or exploded or simply with the door open is trivial because each
sub assembly is placed relative to its parent. A complex final position is
always made from the composition of simpler positioning modules. The finale
position of a screw might be a very complex expression indeed but if I
needed to position say an arrow to point it out it would just be a matter
of composing a few already existing positing modules to get there.
I never feel the need for negative objects and I never have to repeat
complex expressions. How would a screw object make it own hole? The screw
is added to an assembly. The hole is subtracted from a printed part or a
sheet. I don't see how that can be one operation but its position can be
one module that is reused to place fasteners and drill holes.
The screws in this tilted display assembly have a very complicated position
in the final assembly because the RPI is stacked on the back of a LCD
display. For aesthetic reasons the display is in the centre of the tilted
box. Its PCB is offset from the display. It has mounting pillars with
positions specified relative to the PCB, one of which goes through the RPI
which is upside down.
So I have code like this to line them up by mating one pair of screw holes:
pcb_offset = [display_pcb_offset(display).x, display_pcb_offset(display).y];
mating_hole = 2;
rpi_hole = pcb_coord(rpi, pcb_holes(rpi)[1]);
lcd_hole = pcb_coord(pcb, pcb_holes(pcb)[mating_hole]) + pcb_offset;
rpi_offset = [lcd_hole.x - rpi_hole.x,
lcd_hole.y + rpi_hole.y];
But no matter how ugly it is I only ever need to write it once.
Post by TrobergPost by nop headThe way I handle that is to make a module that places its children where
the holes are, relative to the PCB. I use that to make the holes in the PCB,
the mounting pillars in my case and the fasteners by calling it with the
appropriate children. I never repeat complex calculations. I always put them
in a module or a function or a variable.
Yeah, that's pretty much what I try to do, but when the parts are complex,
made out of several sub-parts and rotated at strange angles, and then needs
to match up with a similar complex part, it can be hard to re-use the same
calculation.
For example, in many cases, I "drill" the holes at an early stage of the
creation of the complex part, before rotations and translations. Then, I
need to match that with a bolt in another part, that, for practical reasons,
also is put into an early stage of that part. That's where things get messy.
Now, I do admit that my constructions, with moving/rotating/folding parts
are a bit more complex than the average. I also don't design for 3D
printing, I design for building out of metal, wood, plastic and other
materials, so, where possible, I try to match the building process to make
it easier to get step by step stages. So, my needs may be a bit special.
--
Sent from: http://forum.openscad.org/
_______________________________________________
OpenSCAD mailing list
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org