Hi, firstly love the library and appreciate the work,
The issue I've found occurred when i printed off a 40mm wide "squared holder" and found that its dimensions were out
The distance between the hooks actually measured ~44.6mm (model show in image 1 below) instead of the input 40mm
My suggested update to the code is at the end but also included my best attempt to explain what and why, sorry if its unclear in parts
Investigation:
My look into the code I've found its to do with the translation function used to place the holder's hooks/arms
right hook position: translate( [(w+2pw)/2, 0, 0] )
left hook position: translate( [(w+2pw)/-2, 0, 0] )
when requested w = 40 and pw is default = 4.8 the the hooks are placed at x = 24.8 and -24.8 and at a distance of 49.6 apart.
The hooks are placed by their centers (shown in image 2).
The actual distance between hooks is then (placement distance) minus (half width of each hook))
49.6 - (2x (4.8/2)) = 44.8 (close to my printed result ~44.6mm)
To remove this width error the hook position should be:
translate( [(w+pw)/2, 0, 0] )
and
translate( [(w+pw)/-2, 0, 0] )
The horizontal bar width ( w+2*pw ) includes the hook width but becomes fractionally longer than the new hook position so i trimmed its width to (w+pw) and let the hook fill out the remainder
Example 1: 40mm width holder wider than the dimensions in OpenSCAD
Example 2: with hooks translated by 10mm in the Y direction to show their overlap with the horizontal support
My full updated function as follows where input 2. "w" does accurately define the separation between hooks:
/* A Squared holder takes up to five parameters:
* 1. l (numerical) - the length of the straight hook
* 2. w (numerical) - the separation between hooks
* 3. all_pegs (boolean)
* 4. fullfill (boolean)
* 5. retainer (boolean)
*/
module skadis_squared_holder(l = 60, w = 20, all_pegs = all_pegs, fullfill = fullfill, retainer = retainer) {
union() {
//horizontal support bar
translate([0, -(2*pw)/2, pw/2]) {
cube(size = [w+pw, 2*pw, pw], center = true);
}
//right arm
translate([(w+pw)/2, 0, 0]) {
union() {
translate([-pt/2, -(l+2*pw), 0]) {
cube(size = [pt, l+2*pw, pw]);
}
translate([-pt/2, -(l+1.5*pw), pw]) {
rotate([0, 90, 0]) {
cylinder(h = pt, d = pw, center = false);
}
}
}
}
//left arm
translate([(w+pw)/-2, 0, 0]) {
union() {
translate([-pt/2, -(l+2*pw), 0]) {
cube(size = [pt, l+2*pw, pw]);
}
translate([-pt/2, -(l+1.5*pw), pw]) {
rotate([0, 90, 0]) {
cylinder(h = pt, d = pw, center = false);
}
}
}
}
//pegs
skadis_pegs_position(length = w+2*pw, all_pegs = all_pegs) skadis_peg(fullfill = fullfill, retainer = retainer);
}
}
Hi, firstly love the library and appreciate the work,
The issue I've found occurred when i printed off a 40mm wide "squared holder" and found that its dimensions were out The distance between the hooks actually measured ~44.6mm (model show in image 1 below) instead of the input 40mm
My suggested update to the code is at the end but also included my best attempt to explain what and why, sorry if its unclear in parts
Investigation: My look into the code I've found its to do with the translation function used to place the holder's hooks/arms right hook position: translate( [(w+2pw)/2, 0, 0] ) left hook position: translate( [(w+2pw)/-2, 0, 0] )
when requested w = 40 and pw is default = 4.8 the the hooks are placed at x = 24.8 and -24.8 and at a distance of 49.6 apart. The hooks are placed by their centers (shown in image 2).
The actual distance between hooks is then (placement distance) minus (half width of each hook)) 49.6 - (2x (4.8/2)) = 44.8 (close to my printed result ~44.6mm)
To remove this width error the hook position should be: translate( [(w+pw)/2, 0, 0] ) and translate( [(w+pw)/-2, 0, 0] )
The horizontal bar width ( w+2*pw ) includes the hook width but becomes fractionally longer than the new hook position so i trimmed its width to (w+pw) and let the hook fill out the remainder
Example 1: 40mm width holder wider than the dimensions in OpenSCAD
Example 2: with hooks translated by 10mm in the Y direction to show their overlap with the horizontal support
My full updated function as follows where input 2. "w" does accurately define the separation between hooks: