ruler not displayed on render

This commit is contained in:
Adrian Mariano 2024-05-01 17:24:52 -04:00
parent c9172c15ac
commit ec52d79c99

View file

@ -3652,7 +3652,8 @@ module cylindrical_heightfield(
// Usage:
// ruler(length, width, [thickness=], [depth=], [labels=], [pipscale=], [maxscale=], [colors=], [alpha=], [unit=], [inch=]) [ATTACHMENTS];
// Description:
// Creates an attachable ruler for checking dimensions of the model.
// Creates an attachable ruler for checking dimensions of the model. The rule appears only in preview mode (F5) and is not displayed
// when the model is rendered (F6).
// Arguments:
// length = length of the ruler. Default 100
// width = width of the ruler. Default: size of the largest unit division
@ -3683,12 +3684,12 @@ module cylindrical_heightfield(
module ruler(length=100, width, thickness=1, depth=3, labels=false, pipscale=1/3, maxscale,
colors=["black","white"], alpha=1.0, unit=1, inch=false, anchor=LEFT+BACK+TOP, spin=0, orient=UP)
{
inchfactor = 25.4;
if ($preview){
checks =
assert(depth<=5, "Cannot render scales smaller than depth=5")
assert(len(colors)==2, "colors must contain a list of exactly two colors.");
length = inch ? inchfactor * length : length;
unit = inch ? inchfactor*unit : unit;
length = inch ? INCH * length : length;
unit = inch ? INCH*unit : unit;
maxscale = is_def(maxscale)? maxscale : floor(log(length/unit-EPSILON));
scales = unit * [for(logsize = [maxscale:-1:maxscale-depth+1]) pow(10,logsize)];
widthfactor = (1-pipscale) / (1-pow(pipscale,depth));
@ -3739,10 +3740,10 @@ module ruler(length=100, width, thickness=1, depth=3, labels=false, pipscale=1/3
}
children();
}
}
}
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap