/*
- * seg_digit.scad : 7 segment and 16 segment digit generation library
+ * digit7.scad : 7 segment digit generation library
*
- * Author : Jose Ignacio Croce Busquets <jose.croce@gmail.com>
+ * Author : Jose Ignacio Croce Busquets <jose@crossforests.com>
*
* Date : 08-DEC-2013
*
+ * Copyright 2014, 2015 Jose Ignacio Croce Busquets
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
* Usage
* The module contains the following public methods
*
translate(v = [ i * digit_spacing(h), 0, 0 ])
put_digit7(s[i], h, on);
}
- translate(v = [ search(".", s)[0] * digit_spacing(h), 0, 0 ])
- segment_dp(h, on);
+ translate(v = [ (search(".", s)[0] - 1) * digit_spacing(h), 0, 0 ])
+ put_digit7(s[i], h, on);
for (i = [ search(".", s)[0] : len(s) ]) {
- translate(v = [ (i - 1) * digit_spacing(h) + segment_length(h) * 0.5
+ translate(v = [ (i - 1) * digit_spacing(h)
, 0
, 0 ])
put_digit7(s[i], h, on);
*/
module put_digit7(c, h, on = true)
{
+ if (c == ".") digit7_P(h, on);
if (c == "0") digit7_0(h, on);
if (c == "1") digit7_1(h, on);
if (c == "2") digit7_2(h, on);
segment_g(segment_length(h), on);
}
+/* Draws a decimal point in a 7 segment digit
+ * h digit length
+ * on on-relief/low-relief flag
+ */
+module digit7_P(h, on = true)
+{
+ segment_p(segment_length(h), on);
+}
+
//---------------------------------------------------------------------------
// Examples
//---------------------------------------------------------------------------
digit7_int(65535, ex_height);
translate(v = [ digit_spacing(ex_height), 0.5 * ex_height, 0 ])
- digit7_float(123.45, ex_height);
+ digit7_float(1234.56, ex_height);
// Low relief examples
// Low relief effect is performed by substracting from the base
digit7_int(65535, 100, on = false);
translate(v = [ digit_spacing(ex_height), 0.5 * ex_height, 0 ])
- digit7_float(123.45, 100, on = false);
+ digit7_float(1234.56, 100, on = false);
}
-/* EOF : seg_digit.scad */
+/* EOF : digit7.scad */