Fix belt positioning bug.

Belt gap position is now relative to the pitch line.
Added belt_pitch_to_back().
This commit is contained in:
Chris Palmer 2020-08-22 09:45:13 +01:00
parent b6147e5684
commit 4cdab218d9
3 changed files with 13 additions and 8 deletions

View File

@ -223,6 +223,7 @@ Individual teeth are not drawn, instead they are represented by a lighter colour
| Function | Description |
|:--- |:--- |
| ```belt_pitch(type)``` | Pitch in mm |
| ```belt_pitch_height(type)``` | Offset of the pitch radius from the tips of the teeth |
| ```belt_thickness(type)``` | Total thickness including teeth |
| ```belt_tooth_height(type)``` | Tooth height |
| ```belt_width(type)``` | Width in mm |
@ -231,7 +232,7 @@ Individual teeth are not drawn, instead they are represented by a lighter colour
| Function | Description |
|:--- |:--- |
| ```belt_length(points, gap = 0)``` | Compute belt length given path and optional gap |
| ```belt_pitch_height(type)``` | Offset of the pitch radius from the tips of the teeth |
| ```belt_pitch_to_back(type)``` | Offset of the back from the pitch radius |
### Modules
| Module | Description |
@ -244,7 +245,7 @@ Individual teeth are not drawn, instead they are represented by a lighter colour
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | ```belt(GT2x6, [ ... ])``` | Belt GT2 x 6mm x 128mm |
| 1 | ```belt(GT2x6, [ ... ], 80, [0, 0.81])``` | Belt GT2 x 6mm x 694mm |
| 1 | ```belt(GT2x6, [ ... ], 80, [0, 0.314])``` | Belt GT2 x 6mm x 696mm |
| 1 | ```belt(T2p5x6, [ ... ])``` | Belt T2.5 x 6mm x 130mm |
| 1 | ```belt(T5x10, [ ... ])``` | Belt T5 x 10mm x 130mm |
| 1 | ```belt(T5x6, [ ... ])``` | Belt T5 x 6mm x 130mm |

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 104 KiB

View File

@ -34,7 +34,9 @@ function belt_pitch(type) = type[1]; //! Pitch in mm
function belt_width(type) = type[2]; //! Width in mm
function belt_thickness(type) = type[3]; //! Total thickness including teeth
function belt_tooth_height(type) = type[4]; //! Tooth height
function belt_pitch_height(type) = belt_tooth_height(type) + type[4]; //! Offset of the pitch radius from the tips of the teeth
function belt_pitch_height(type) = type[5] + belt_tooth_height(type); //! Offset of the pitch radius from the tips of the teeth
function belt_pitch_to_back(type) = belt_thickness(type) - belt_pitch_height(type); //! Offset of the back from the pitch radius
function no_point(str) = chr([for(c = str) if(c == ".") ord("p") else ord(c)]);
//
@ -56,24 +58,26 @@ module belt(type, points, gap = 0, gap_pt = undef, belt_colour = grey(20), tooth
module shape() rounded_polygon(points, tangents);
ph = belt_pitch_height(type);
th = belt_tooth_height(type);
module gap()
if(gap)
translate(gap_pt)
translate(gap_pt + [0, -ph + thickness / 2])
square([gap, thickness + eps], center = true);
color(belt_colour)
linear_extrude(width, center = true)
difference() {
offset(thickness - belt_pitch_height(type)) shape();
offset(-belt_pitch_height(type) + belt_tooth_height(type)) shape();
offset(-ph + thickness ) shape();
offset(-ph + th) shape();
gap();
}
color(tooth_colour)
linear_extrude(width, center = true)
difference() {
offset(-belt_pitch_height(type) + belt_tooth_height(type)) shape();
offset(-belt_pitch_height(type)) shape();
offset(-ph + th) shape();
offset(-ph) shape();
gap();
}
}