Parameterised belt colors.

This commit is contained in:
Martin Budden 2020-01-13 08:53:11 +00:00
parent 8ac06b53e7
commit c55b8b6d1c
2 changed files with 2 additions and 4 deletions

View File

@ -67,7 +67,7 @@ module belt_test() {
translate([-25, 0]) translate([-25, 0])
layout([for(b = belts) belt_width(b)], 10) layout([for(b = belts) belt_width(b)], 10)
rotate([0, 90, 0]) rotate([0, 90, 0])
belt(belts[$i], [[0, 0, 20], [0, 1, 20]]); belt(belts[$i], [[0, 0, 20], [0, 1, 20]], belt_colour = $i%2==0 ? grey90 : grey20, tooth_colour = $i%2==0 ? grey70 : grey50);
} }
if($preview) if($preview)

View File

@ -41,9 +41,7 @@ function no_point(str) = chr([for(c = str) if(c == ".") ord("p") else ord(c)]);
// We model the belt path at the pitch radius of the pulleys and the pitch line of the belt to get an accurate length. // We model the belt path at the pitch radius of the pulleys and the pitch line of the belt to get an accurate length.
// The belt is then drawn by offseting each side from the pitch line. // The belt is then drawn by offseting each side from the pitch line.
// //
module belt(type, points, gap = 0, gap_pt = undef) { //! Draw a belt path given a set of points and pitch radii where the pulleys are. Closed loop unless a gap is specified module belt(type, points, gap = 0, gap_pt = undef, belt_colour = grey20, tooth_colour = grey50) { //! Draw a belt path given a set of points and pitch radii where the pulleys are. Closed loop unless a gap is specified
belt_colour = grey20;
tooth_colour = grey50;
width = belt_width(type); width = belt_width(type);
pitch = belt_pitch(type); pitch = belt_pitch(type);
thickness = belt_thickness(type); thickness = belt_thickness(type);