Merge branch 'spool_filament' of https://github.com/martinbudden/NopSCADlib into martinbudden-spool_filament

This commit is contained in:
Chris Palmer 2020-02-23 10:04:23 +00:00
commit 3d8a9ec8aa
1 changed files with 6 additions and 1 deletions

View File

@ -20,6 +20,7 @@
//! Filament spool models
include <../core.scad>
include <../utils/tube.scad>
function spool_diameter(type) = type[1]; //! Outside diameter
function spool_width(type) = type[2]; //! Internal width
@ -32,7 +33,7 @@ function spool_hub_taper(type) = type[8]; //! Diameter at which it tapers do
function spool_height(type) = spool_width(type) + 2 * spool_hub_thickness(type); //! Outside width
function spool_pitch(type) = spool_width(type) + spool_rim_thickness(type); //! Spacing of the rims
module spool(type) { //! Draw specified spool
module spool(type, filament_depth = 0, filament_color = "white") { //! Draw specified spool with optional filament
vitamin(str("spool(", type[0], "): Filament spool ", spool_diameter(type), " x ", spool_width(type)));
h = spool_height(type);
@ -57,4 +58,8 @@ module spool(type) { //! Draw specified spool
[r3, h - spool_hub_thickness(type) + spool_rim_thickness(type)],
[r2, h],
]);
if(filament_depth)
color(filament_color)
tube(r5 + filament_depth, r5, spool_width(type));
}