@@ -999,7 +999,7 @@ module snap_pin_socket(size, r, radius, l,length, d,diameter,nub_depth, snap, fi
999999// Topics: Joiners, Parts
10001000// See Also: snap_pin(), joiner(), dovetail(), snap_pin(), rabbit_clip()
10011001// Usage:
1002- // rabbit_clip(type, length, width, snap, thickness, depth, [compression=], [clearance=], [lock=], [lock_clearance=], [splineteps=], [anchor=], [orient=], [spin=]) [ATTACHMENTS];
1002+ // rabbit_clip(type, length, width, snap, thickness, depth, [compression=], [clearance=], [lock=], [half_lock=], [double_single_lock=], [double_flip_half_lock=], [ lock_clearance=], [splineteps=], [anchor=], [orient=], [spin=]) [ATTACHMENTS];
10031003// Description:
10041004// Creates a clip with two flexible ears to lock into a mating socket, or create a mask to produce the appropriate
10051005// mating socket. The clip can be made to insert and release easily, or to hold much better, or it can be
@@ -1024,8 +1024,9 @@ module snap_pin_socket(size, r, radius, l,length, d,diameter,nub_depth, snap, fi
10241024// .
10251025// The first figure shows the dimensions of the rabbit clip. The second figure shows the clip in red overlayed on
10261026// its socket in yellow. The left clip has a nonzero clearance, so its socket is bigger than the clip all around.
1027- // The right hand locking clip has no clearance, but it has a lock clearance, which provides some space behind
1027+ // The center locking clip has no clearance, but it has a lock clearance, which provides some space behind
10281028// the lock to allow the clip to fit. (Note that depending on your printer, this can be set to zero.)
1029+ // The right clip is half-locking that uses the same clearances as the center clip.
10291030// Figure(2DMed,NoAxes):
10301031// snap=1.5;
10311032// comp=0.75;
@@ -1057,6 +1058,13 @@ module snap_pin_socket(size, r, radius, l,length, d,diameter,nub_depth, snap, fi
10571058// Figure(2DMed,NoAxes):
10581059// snap=1.5;
10591060// comp=0;
1061+ // translate([49,3]){
1062+ // back_half()
1063+ // rabbit_clip("socket", width=12, length=18, depth=1, thickness = 1, compression=comp, snap=snap, orient=BACK,half_lock=true);
1064+ // color("red")back_half()
1065+ // rabbit_clip("pin",width=12, length=18, depth=1, thickness = 1, compression=comp, snap=snap,
1066+ // orient=BACK,half_lock=true,lock_clearance=1);
1067+ // }
10601068// translate([29,3]){
10611069// back_half()
10621070// rabbit_clip("socket", width=12, length=18, depth=1, thickness = 1, compression=comp, snap=snap, orient=BACK,lock=true);
@@ -1083,6 +1091,9 @@ module snap_pin_socket(size, r, radius, l,length, d,diameter,nub_depth, snap, fi
10831091// compression = excess width at the "ears" to lock more tightly. Default: 0.1
10841092// clearance = extra space in the socket for easier insertion. Default: 0.1
10851093// lock = set to true to make a locking clip that may be irreversible. Default: false
1094+ // half_lock = set to true to make a clip where only the RIGHT side locks. Default: false
1095+ // double_single_lock = for "double" type, set to true to enable lock or half_lock for one pin. Default: false
1096+ // double_flip_half_lock = for "double", set to true to make TOP_RIGHT and BOTTOM_LEFT sides lock. Default: false
10861097// lock_clearance = give clearance for the lock. Default: 0
10871098// splinesteps = number of samples in the curves of the clip. Default: 8
10881099// anchor = anchor point for clip
@@ -1131,10 +1142,10 @@ module snap_pin_socket(size, r, radius, l,length, d,diameter,nub_depth, snap, fi
11311142// tag("remove")zcyl(l=20,r=13.5, $fn=64);
11321143// }
11331144
1134- function rabbit_clip(type, length, width, snap, thickness, depth, compression= 0.1 , clearance= .1 , lock= false , lock_clearance= 0 ,
1145+ function rabbit_clip(type, length, width, snap, thickness, depth, compression= 0.1 , clearance= .1 , lock= false , half_lock = false , double_single_lock = false , double_flip_half_lock = false , lock_clearance= 0 ,
11351146 splinesteps= 8 , anchor, orient, spin= 0 ) = no_function("rabbit_clip" );
11361147
1137- module rabbit_clip(type, length, width, snap, thickness, depth, compression=0.1, clearance=.1, lock=false, lock_clearance=0,
1148+ module rabbit_clip(type, length, width, snap, thickness, depth, compression=0.1, clearance=.1, lock=false, half_lock=false, double_single_lock=false, double_flip_half_lock=false, lock_clearance=0,
11381149 splinesteps= 8 , anchor, orient, spin= 0 )
11391150{
11401151 legal_types = ["pin" ,"socket" ,"male" ,"female" ,"double" ];
@@ -1146,15 +1157,38 @@ module rabbit_clip(type, length, width, snap, thickness, depth, compression=0.1
11461157 assert(is_num(depth) && depth> 0 , "Depth must be a positive value" )
11471158 assert(is_num(compression) && compression >= 0 , "Compression must be a nonnegative value" )
11481159 assert(is_bool(lock))
1160+ assert(is_bool(half_lock))
1161+ assert(! (lock && half_lock), "Only one of lock and half_lock can be set" )
1162+ assert(is_bool(double_single_lock))
1163+ assert(is_bool(double_flip_half_lock))
1164+ assert(! (double_single_lock && double_flip_half_lock), "Only one of double_single_lock and double_flip_half_lock can be set" )
1165+ assert(! (lock && double_flip_half_lock), "double_flip_half_lock can not be used with lock" )
11491166 assert(is_num(lock_clearance))
11501167 assert(in_list(type,legal_types),str ("type must be one of " ,legal_types));
1168+ assert(! double_single_lock || type == "double" , "double_single_lock can only be used with double" );
1169+ assert(! double_flip_half_lock || type == "double" , "double_single_lock can only be used with double" );
1170+ module double_lock() {
1171+ if ( half_lock )
1172+ children();
1173+ else
1174+ xflip_copy()
1175+ children();
1176+ }
1177+ module double_pin() {
1178+ if ( half_lock && ! double_flip_half_lock )
1179+ zrot(180 )
1180+ children();
1181+ else
1182+ children();
1183+ }
11511184 if (type== "double" ) {
11521185 attachable(size= [width+ 2 * compression, depth, 2 * length], anchor= default(anchor,BACK), spin= spin, orient= default(orient,BACK)){
11531186 union (){
11541187 rabbit_clip("pin" , length= length, width= width, snap= snap, thickness= thickness, depth= depth, compression= compression,
1155- lock= lock, anchor= BOTTOM, orient= UP);
1188+ lock= lock || double_single_lock, half_lock= half_lock || double_flip_half_lock, lock_clearance= lock_clearance, anchor= BOTTOM, orient= UP);
1189+ double_pin()
11561190 rabbit_clip("pin" , length= length, width= width, snap= snap, thickness= thickness, depth= depth, compression= compression,
1157- lock= lock, anchor= BOTTOM, orient= DOWN);
1191+ lock= lock && ! double_single_lock, half_lock = half_lock || double_flip_half_lock, lock_clearance = lock_clearance , anchor= BOTTOM, orient= DOWN);
11581192 cuboid([width- thickness, depth, thickness]);
11591193 }
11601194 children();
@@ -1223,8 +1257,8 @@ module rabbit_clip(type, length, width, snap, thickness, depth, compression=0.1
12231257 xrot(90 )
12241258 translate ([0 ,- (bounds[1 ].y- bounds[0 ].y)/2 + default_overlap,- depth/2 ])
12251259 linear_extrude(height= depth, convexity= 10 ) {
1226- if (lock)
1227- xflip_copy ()
1260+ if (lock || half_lock )
1261+ double_lock ()
12281262 right(clearance)
12291263 polygon([sidepath[1 ]+ [- thickness/10 ,lock_clearance],
12301264 sidepath[2 ]- [thickness* .75 ,0 ],
0 commit comments