Merge pull request #301 from revarbat/revarbat_dev

Docs formatting and gear example image fixes.
This commit is contained in:
Revar Desmera 2020-10-19 23:54:38 -07:00 committed by GitHub
commit dcc7e9faaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 190 additions and 187 deletions

View File

@ -174,7 +174,7 @@ function _gear_q7(f,r,b,r2,t,s) = _gear_q6(b,s,t,(1-f)*max(b,r)+f*r2); //
// Example(2D): // Example(2D):
// gear_tooth_profile(pitch=5, teeth=20, pressure_angle=20, valleys=false); // gear_tooth_profile(pitch=5, teeth=20, pressure_angle=20, valleys=false);
// Example(2D): As a function // Example(2D): As a function
// stroke(gear_tooth_profile(pitch=5, teeth=20, pressure_angle=20, valleys=false)); // stroke(gear_tooth_profile(pitch=5, teeth=20, pressure_angle=20, valleys=false), width=0.1);
function gear_tooth_profile( function gear_tooth_profile(
pitch = 3, pitch = 3,
teeth = 11, teeth = 11,
@ -222,7 +222,7 @@ module gear_tooth_profile(
center = false center = false
) { ) {
r = root_radius(pitch, teeth, clearance, interior); r = root_radius(pitch, teeth, clearance, interior);
translate([0,-r,0]) fwd(r)
polygon( polygon(
points=gear_tooth_profile( points=gear_tooth_profile(
pitch = pitch, pitch = pitch,
@ -330,9 +330,9 @@ module gear2d(
// Function&Module: rack2d() // Function&Module: rack2d()
// Usage: As a Function // Usage: As a Function
// path = rack2d(pitch, teeth, base, <pressure_angle>, <backlash>); // path = rack2d(pitch, teeth, height, <pressure_angle>, <backlash>);
// Usage: As a Module // Usage: As a Module
// rack2d(pitch, teeth, base, <pressure_angle>, <backlash>); // rack2d(pitch, teeth, height, <pressure_angle>, <backlash>);
// Description: // Description:
// This is used to create a 2D rack, which is a linear bar with teeth that a gear can roll along. // This is used to create a 2D rack, which is a linear bar with teeth that a gear can roll along.
// A rack can mesh with any gear that has the same `pitch` and `pressure_angle`. // A rack can mesh with any gear that has the same `pitch` and `pressure_angle`.
@ -341,7 +341,7 @@ module gear2d(
// Arguments: // Arguments:
// pitch = The circular pitch, or distance between teeth around the pitch circle, in mm. // pitch = The circular pitch, or distance between teeth around the pitch circle, in mm.
// teeth = Total number of teeth along the rack // teeth = Total number of teeth along the rack
// base = Height of rack in mm, from tooth top to back of rack. // height = Height of rack in mm, from tooth top to back of rack.
// pressure_angle = Controls how straight or bulged the tooth sides are. In degrees. // pressure_angle = Controls how straight or bulged the tooth sides are. In degrees.
// backlash = Gap between two meshing teeth, in the direction along the circumference of the pitch circle // backlash = Gap between two meshing teeth, in the direction along the circumference of the pitch circle
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER`
@ -350,18 +350,18 @@ module gear2d(
// "adendum" = At the tips of the teeth, at the center of rack. // "adendum" = At the tips of the teeth, at the center of rack.
// "adendum-left" = At the tips of the teeth, at the left end of the rack. // "adendum-left" = At the tips of the teeth, at the left end of the rack.
// "adendum-right" = At the tips of the teeth, at the right end of the rack. // "adendum-right" = At the tips of the teeth, at the right end of the rack.
// "dedendum" = At the base of the teeth, at the center of rack. // "dedendum" = At the height of the teeth, at the center of rack.
// "dedendum-left" = At the base of the teeth, at the left end of the rack. // "dedendum-left" = At the height of the teeth, at the left end of the rack.
// "dedendum-right" = At the base of the teeth, at the right end of the rack. // "dedendum-right" = At the height of the teeth, at the right end of the rack.
// Example(2D): // Example(2D):
// rack2d(pitch=5, teeth=10, base=5, pressure_angle=20); // rack2d(pitch=5, teeth=10, height=10, pressure_angle=20);
// Example(2D): Called as a Function // Example(2D): Called as a Function
// path = rack2d(pitch=8, teeth=8, base=5, pressure_angle=28); // path = rack2d(pitch=8, teeth=8, height=10, pressure_angle=28);
// polygon(path); // polygon(path);
function rack2d( function rack2d(
pitch = 5, pitch = 5,
teeth = 20, teeth = 20,
base = 10, height = 10,
pressure_angle = 28, pressure_angle = 28,
backlash = 0.0, backlash = 0.0,
clearance = undef, clearance = undef,
@ -370,7 +370,10 @@ function rack2d(
) = ) =
let( let(
a = adendum(pitch), a = adendum(pitch),
d = dedendum(pitch, clearance), d = dedendum(pitch, clearance)
)
assert(a+d < height)
let(
xa = a * sin(pressure_angle), xa = a * sin(pressure_angle),
xd = d * sin(pressure_angle), xd = d * sin(pressure_angle),
l = teeth * pitch, l = teeth * pitch,
@ -383,7 +386,7 @@ function rack2d(
anchorpt("dedendum-right", [ l/2,-d,0], RIGHT), anchorpt("dedendum-right", [ l/2,-d,0], RIGHT),
], ],
path = [ path = [
[-(teeth-1)/2 * pitch + -1/2 * pitch, a-base], [-(teeth-1)/2 * pitch + -1/2 * pitch, a-height],
[-(teeth-1)/2 * pitch + -1/2 * pitch, -d], [-(teeth-1)/2 * pitch + -1/2 * pitch, -d],
for (i = [0:1:teeth-1]) let( for (i = [0:1:teeth-1]) let(
off = (i-(teeth-1)/2) * pitch off = (i-(teeth-1)/2) * pitch
@ -394,15 +397,15 @@ function rack2d(
[off + 1/4 * pitch - backlash + xd, -d], [off + 1/4 * pitch - backlash + xd, -d],
], ],
[ (teeth-1)/2 * pitch + 1/2 * pitch, -d], [ (teeth-1)/2 * pitch + 1/2 * pitch, -d],
[ (teeth-1)/2 * pitch + 1/2 * pitch, a-base], [ (teeth-1)/2 * pitch + 1/2 * pitch, a-height],
] ]
) reorient(anchor,spin, two_d=true, size=[l,2*abs(a-base)], anchors=anchors, p=path); ) reorient(anchor,spin, two_d=true, size=[l,2*abs(a-height)], anchors=anchors, p=path);
module rack2d( module rack2d(
pitch = 5, pitch = 5,
teeth = 20, teeth = 20,
base = 10, height = 10,
pressure_angle = 28, pressure_angle = 28,
backlash = 0.0, backlash = 0.0,
clearance = undef, clearance = undef,
@ -423,12 +426,12 @@ module rack2d(
path = rack2d( path = rack2d(
pitch = pitch, pitch = pitch,
teeth = teeth, teeth = teeth,
base = base, height = height,
pressure_angle = pressure_angle, pressure_angle = pressure_angle,
backlash = backlash, backlash = backlash,
clearance = clearance clearance = clearance
); );
attachable(anchor,spin, two_d=true, size=[l, 2*abs(a-base)], anchors=anchors) { attachable(anchor,spin, two_d=true, size=[l, 2*abs(a-height)], anchors=anchors) {
polygon(path); polygon(path);
children(); children();
} }
@ -503,7 +506,7 @@ module rack2d(
// translate([ d13, 0, 0]) rotate([0,0,-($t-n3/4+n1/4+1/2)*360/n3]) color([0.75,0.75,1.00]) gear(pitch,n3,thickness,hole); // translate([ d13, 0, 0]) rotate([0,0,-($t-n3/4+n1/4+1/2)*360/n3]) color([0.75,0.75,1.00]) gear(pitch,n3,thickness,hole);
// translate([ d13, 0, 0]) rotate([0,0,-($t-n3/4+n1/4+1/2)*360/n3]) color([0.75,0.75,1.00]) gear(pitch,n3,thickness,hole); // translate([ d13, 0, 0]) rotate([0,0,-($t-n3/4+n1/4+1/2)*360/n3]) color([0.75,0.75,1.00]) gear(pitch,n3,thickness,hole);
// translate([-d14, 0, 0]) rotate([0,0,-($t-n4/4-n1/4+1/2-floor(n4/4)-3)*360/n4]) color([1.00,0.75,0.50]) gear(pitch,n4,thickness,hole,hide=n4-3); // translate([-d14, 0, 0]) rotate([0,0,-($t-n4/4-n1/4+1/2-floor(n4/4)-3)*360/n4]) color([1.00,0.75,0.50]) gear(pitch,n4,thickness,hole,hide=n4-3);
// translate([(-floor(n5/2)-floor(n1/2)+$t+n1/2)*9, -d1+0.0, 0]) color([0.75,0.75,0.75]) rack(pitch=pitch,teeth=n5,thickness=thickness,base=rack_base,anchor=CENTER,orient=BACK); // translate([(-floor(n5/2)-floor(n1/2)+$t+n1/2)*9, -d1+0.0, 0]) color([0.75,0.75,0.75]) rack(pitch=pitch,teeth=n5,thickness=thickness,height=rack_base,anchor=CENTER,orient=BACK);
function gear( function gear(
pitch = 3, pitch = 3,
teeth = 11, teeth = 11,
@ -742,7 +745,7 @@ module bevel_gear(
teeth = 11, teeth = 11,
face_width = 10, face_width = 10,
pitch_angle = 45, pitch_angle = 45,
mate_teeth = undef, mate_teeth,
shaft_diam = 3, shaft_diam = 3,
hide = 0, hide = 0,
pressure_angle = 20, pressure_angle = 20,
@ -799,9 +802,9 @@ module bevel_gear(
// Function&Module: rack() // Function&Module: rack()
// Usage: As a Module // Usage: As a Module
// rack(pitch, teeth, thickness, base, <pressure_angle>, <backlash>); // rack(pitch, teeth, thickness, height, <pressure_angle>, <backlash>);
// Usage: As a Function // Usage: As a Function
// vnf = rack(pitch, teeth, thickness, base, <pressure_angle>, <backlash>); // vnf = rack(pitch, teeth, thickness, height, <pressure_angle>, <backlash>);
// Description: // Description:
// This is used to create a 3D rack, which is a linear bar with teeth that a gear can roll along. // This is used to create a 3D rack, which is a linear bar with teeth that a gear can roll along.
// A rack can mesh with any gear that has the same `pitch` and `pressure_angle`. // A rack can mesh with any gear that has the same `pitch` and `pressure_angle`.
@ -811,7 +814,7 @@ module bevel_gear(
// pitch = The circular pitch, or distance between teeth around the pitch circle, in mm. // pitch = The circular pitch, or distance between teeth around the pitch circle, in mm.
// teeth = Total number of teeth along the rack // teeth = Total number of teeth along the rack
// thickness = Thickness of rack in mm (affects each tooth) // thickness = Thickness of rack in mm (affects each tooth)
// base = Height of rack in mm, from tooth top to back of rack. // height = Height of rack in mm, from tooth top to back of rack.
// pressure_angle = Controls how straight or bulged the tooth sides are. In degrees. // pressure_angle = Controls how straight or bulged the tooth sides are. In degrees.
// backlash = Gap between two meshing teeth, in the direction along the circumference of the pitch circle // backlash = Gap between two meshing teeth, in the direction along the circumference of the pitch circle
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER`
@ -829,12 +832,12 @@ module bevel_gear(
// "dedendum-back" = At the base of the teeth, at the back of the rack. // "dedendum-back" = At the base of the teeth, at the back of the rack.
// "dedendum-front" = At the base of the teeth, at the front of the rack. // "dedendum-front" = At the base of the teeth, at the front of the rack.
// Example: // Example:
// rack(pitch=5, teeth=10, thickness=5, base=5, pressure_angle=20); // rack(pitch=5, teeth=10, thickness=5, height=5, pressure_angle=20);
module rack( module rack(
pitch = 5, pitch = 5,
teeth = 20, teeth = 20,
thickness = 5, thickness = 5,
base = 10, height = 10,
pressure_angle = 28, pressure_angle = 28,
backlash = 0.0, backlash = 0.0,
clearance = undef, clearance = undef,
@ -857,13 +860,13 @@ module rack(
anchorpt("dedendum-front", [0,-thickness/2,-d], DOWN), anchorpt("dedendum-front", [0,-thickness/2,-d], DOWN),
anchorpt("dedendum-back", [0, thickness/2,-d], UP), anchorpt("dedendum-back", [0, thickness/2,-d], UP),
]; ];
attachable(anchor,spin,orient, size=[l, thickness, 2*abs(a-base)], anchors=anchors) { attachable(anchor,spin,orient, size=[l, thickness, 2*abs(a-height)], anchors=anchors) {
xrot(90) { xrot(90) {
linear_extrude(height=thickness, center=true, convexity=teeth*2) { linear_extrude(height=thickness, center=true, convexity=teeth*2) {
rack2d( rack2d(
pitch = pitch, pitch = pitch,
teeth = teeth, teeth = teeth,
base = base, height = height,
pressure_angle = pressure_angle, pressure_angle = pressure_angle,
backlash = backlash, backlash = backlash,
clearance = clearance clearance = clearance
@ -879,7 +882,7 @@ function rack(
pitch = 5, pitch = 5,
teeth = 20, teeth = 20,
thickness = 5, thickness = 5,
base = 10, height = 10,
pressure_angle = 28, pressure_angle = 28,
backlash = 0.0, backlash = 0.0,
clearance = undef, clearance = undef,
@ -906,13 +909,13 @@ function rack(
path = rack2d( path = rack2d(
pitch = pitch, pitch = pitch,
teeth = teeth, teeth = teeth,
base = base, height = height,
pressure_angle = pressure_angle, pressure_angle = pressure_angle,
backlash = backlash, backlash = backlash,
clearance = clearance clearance = clearance
), ),
vnf = linear_sweep(path, height=thickness, anchor="origin", orient=FWD) vnf = linear_sweep(path, height=thickness, anchor="origin", orient=FWD)
) reorient(anchor,spin,orient, size=[l, thickness, 2*abs(a-base)], anchors=anchors, p=vnf); ) reorient(anchor,spin,orient, size=[l, thickness, 2*abs(a-height)], anchors=anchors, p=vnf);

View File

@ -294,11 +294,11 @@ def mkdn_esc(txt):
while txt: while txt:
m = quotpat.match(txt) m = quotpat.match(txt)
if m: if m:
out += m.group(1).replace(r'_', r'\_') out += m.group(1).replace(r'_', r'\_').replace(r'&',r'&amp;').replace(r'<', r'&lt;').replace(r'>',r'&gt;')
out += m.group(2) out += m.group(2)
txt = m.group(3) txt = m.group(3)
else: else:
out += txt.replace(r'_', r'\_') out += txt.replace(r'_', r'\_').replace(r'&',r'&amp;').replace(r'<', r'&lt;').replace(r'>',r'&gt;')
txt = "" txt = ""
return out return out

View File

@ -8,7 +8,7 @@
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
BOSL_VERSION = [2,0,453]; BOSL_VERSION = [2,0,454];
// Section: BOSL Library Version Functions // Section: BOSL Library Version Functions