change attachable_part to part_geometry

This commit is contained in:
Adrian Mariano
2025-06-16 18:46:38 -04:00
parent bb1eb0a111
commit 5565839296
2 changed files with 8 additions and 8 deletions

View File

@@ -3160,7 +3160,7 @@ module _show_ghost()
// Module: attach_part() // Module: attach_part()
// Synopsis: Select a named attachable part for subsequent attachment operations // Synopsis: Select a named attachable part for subsequent attachment operations
// Topics: Attachment // Topics: Attachment
// See Also: attach(), align(), attachable(), attachable_part() // See Also: attach(), align(), attachable(), part_geometry()
// Usage: // Usage:
// PARENT() attach_part(name) CHILDREN; // PARENT() attach_part(name) CHILDREN;
// Description: // Description:
@@ -3581,12 +3581,12 @@ function attach_geom(
: ["point", cp, offset, anchors]; : ["point", cp, offset, anchors];
// Function: attachable_part() // Function: part_geometry()
// Synopsis: Creates an attachable part data structure. // Synopsis: Creates an attachable part data structure.
// Topics: Attachments // Topics: Attachments
// See Also: attachable() // See Also: attachable()
// Usage: // Usage:
// part = attachable_part(name, geom, [inside=], [T=]); // part = part_geometry(name, geom, [inside=], [T=]);
// Description: // Description:
// Create a named attachable part that can be passed in the `parts` parameter of {{attachable()}} // Create a named attachable part that can be passed in the `parts` parameter of {{attachable()}}
// and then selected using {{attach_part()}}. // and then selected using {{attach_part()}}.
@@ -3594,8 +3594,8 @@ function attach_geom(
// module twocyl(d, sep, h, ang=20) // module twocyl(d, sep, h, ang=20)
// { // {
// parts = [ // parts = [
// attachable_part("left", attach_geom(r=d/2,h=h), T=left(sep/2)*yrot(-ang)), // part_geometry("left", attach_geom(r=d/2,h=h), T=left(sep/2)*yrot(-ang)),
// attachable_part("right", attach_geom(r=d/2,h=h), T=right(sep/2)*yrot(ang)), // part_geometry("right", attach_geom(r=d/2,h=h), T=right(sep/2)*yrot(ang)),
// ]; // ];
// attachable(size=[sep+d,d,h], parts=parts){ // attachable(size=[sep+d,d,h], parts=parts){
// union(){ // union(){
@@ -3611,7 +3611,7 @@ function attach_geom(
// color("green")attach_part("right")attach(TOP,BOT) cuboid(3); // color("green")attach_part("right")attach(TOP,BOT) cuboid(3);
// } // }
function attachable_part(name, geom, inside=false, T=IDENT) = function part_geometry(name, geom, inside=false, T=IDENT) =
assert(is_string(name), "name must be a string") assert(is_string(name), "name must be a string")
assert(_is_geometry(geom), "geometry appears invalid") assert(_is_geometry(geom), "geometry appears invalid")
assert(is_bool(inside), "inside must be boolean") assert(is_bool(inside), "inside must be boolean")

View File

@@ -1689,7 +1689,7 @@ module rect_tube(
ichamfer2 = _rect_tube_rounding(1/sqrt(2),ichamfer2_temp, chamfer2, irounding2_temp, size2, isize2); ichamfer2 = _rect_tube_rounding(1/sqrt(2),ichamfer2_temp, chamfer2, irounding2_temp, size2, isize2);
anchor = get_anchor(anchor, center, BOT, BOT); anchor = get_anchor(anchor, center, BOT, BOT);
parts = [ parts = [
attachable_part("inside", attach_geom(size=[each isize1, h], size2=isize2, shift=shift), inside=true) part_geometry("inside", attach_geom(size=[each isize1, h], size2=isize2, shift=shift), inside=true)
]; ];
attachable(anchor,spin,orient, size=[each size1, h], size2=size2, shift=shift, parts=parts) { attachable(anchor,spin,orient, size=[each size1, h], size2=size2, shift=shift, parts=parts) {
down(h/2) { down(h/2) {
@@ -2971,7 +2971,7 @@ module tube(
[0,h/2+1] [0,h/2+1]
]; ];
parts = [ parts = [
attachable_part("inside", attach_geom(r1=ir1, r2=ir2, l=h), inside=true) part_geometry("inside", attach_geom(r1=ir1, r2=ir2, l=h), inside=true)
]; ];
attachable(anchor,spin,orient, r1=r1, r2=r2, l=h, parts=parts) { attachable(anchor,spin,orient, r1=r1, r2=r2, l=h, parts=parts) {
down(h/2) skew(sxz=shift.x/h, syz=shift.y/h) up(h/2) down(h/2) skew(sxz=shift.x/h, syz=shift.y/h) up(h/2)