From 696d968755814bce4b72a6fad7956568be8da905 Mon Sep 17 00:00:00 2001 From: Adrian Mariano Date: Sat, 24 Sep 2022 19:48:24 -0400 Subject: [PATCH] add double attachable() examples --- attachments.scad | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/attachments.scad b/attachments.scad index 1fbfa3f..4458f82 100644 --- a/attachments.scad +++ b/attachments.scad @@ -1765,6 +1765,39 @@ module corner_profile(corners=CORNERS_ALL, except=[], r, d, convexity=10) { // polygon(path); // children(); // } +// +// Example: An object can be designed to attach as negative space using {{diff()}}, but if you want an object to include both positive and negative space then you need to call attachable() twice, because tags inside the attachable() call don't work as expected. This example shows how you can call attachable twice to create an object with positive and negative space. Note, however, that children in the negative space are differenced away: the highlighted little cube does not survive into the final model. +// module thing(anchor,spin,orient) { +// tag("remove") attachable(size=[15,15,15],anchor=anchor,spin=spin,orient=orient){ +// cuboid([10,10,16]); +// union(){} // dummy children +// } +// attachable(size=[15,15,15], anchor=anchor, spin=spin, orient=orient){ +// cuboid([15,15,15]); +// children(); +// } +// } +// diff() +// cube([19,10,19]) +// attach([FRONT],overlap=-4) +// thing(anchor=TOP) +// # attach(TOP) cuboid(2,anchor=TOP); +// Example: Here is an example where the "keep" tag allows children to appear in the negative space. That tag is also needed for this module to produce the desired output. As above, the tag must be applied outside the attachable() call. +// module thing(anchor = CENTER, spin = 0, orient = UP) { +// tag("remove") attachable(anchor, spin, orient, d1=0,d2=95,h=33) { +// cylinder(h = 33.1, d1 = 0, d2 = 95, anchor=CENTER); +// union(){} // dummy children +// } +// tag("keep") attachable(anchor, spin, orient,d1=0,d2=95,h=33) { +// cylinder(h = 33, d = 10,anchor=CENTER); +// children(); +// } +// } +// diff() +// cube(100) +// attach([FRONT,TOP],overlap=-4) +// thing(anchor=TOP) +// tube(ir=12,h=10); module attachable( anchor, spin, orient, size, size2, shift,