Loading

Spiff.scad

by stuartpb, published

Spiff.scad by stuartpb Jun 20, 2013

Featured Thing!

0 Share
Download All Files

Thing Apps Enabled

Order This Printed View All Apps

License

Use This Project

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.

Print Thing Tag

Thing Statistics

6130Views 2120Downloads

Summary

An OpenSCAD module for writing variable-width text. Download Spiff.scad and spiffsans.scad, then see the Instructions for how to use this in your own works (or use poorman-spiff to generate a copy-pasteable demo).

Spiff.scad on GitHub

Requirements

Spiff.scad requires at least OpenSCAD 2013.06, as it uses module recursion to calculate variable glyph widths.

If you're stuck on an older version of OpenSCAD, you can still generate the equivalent code for writing text using poorman-spiff.

Due to OpenSCAD's recursion limit, you may encounter problems writing longer strings. If this happens, try breaking your write call up into multiple calls with shorter strings.


Note that, while this is listed as a derivative of Write.scad, it is not derivative code, and is almost completely incompatible (they're almost compatible in the sense that they both write text, but that's it).

Instructions

Usage

write(string,font,spacing=1)

Draws a group of 2D polygons for the given string, using the given font (see section on Fonts, below). Glyphs are spaced apart by the value of the third "spacing" parameter (1 unit by default). By default, if no font is specified, Spiff Sans will be used. (spiffsans.scad should be included in the same directory as Spiff.scad.)

These 2D polygons can be transformed in 3D space using the regular OpenSCAD transformations in combination with linear_extrude.

Example

use <Spiff.scad>;  

write("Variable width text");  

translate([0,-12,0]) linear_extrude(height=4)  
  write("Simple as anystring");  

See spiff-examples for more examples of Spiff.scad in use.

Fonts

See the readme on GitHub for documentation of the font structure used by Spiff.scad.

Converters for various font formats to this font representation are being developed at https://github.com/stuartpb/spaggers .

All Apps

3D Print your file with 3D Hubs, the world’s largest online marketplace for 3D printing services.

App Info Launch App

This App connects Thingiverse with Makeprintable, a cloud-based mesh repair service that analyzes, validates and repairs most common mesh errors that can occur when preparing a 3D design file for p...

App Info Launch App

Kiri:Moto is an integrated cloud-based slicer and tool-path generator for 3D Printing, CAM / CNC and Laser cutting. *** 3D printing mode provides model slicing and GCode output using built-in...

App Info Launch App
KiriMoto Thing App

With 3D Slash, you can edit 3d models like a stonecutter. A unique interface: as fun as a building game! The perfect tool for non-designers and children to create in 3D.

App Info Launch App

Both "a" and "A" are displayed as "A". The data for both capital and lower case glyph of every letter are the same. It seems that this package only draws capital fonts :(

Dec 19, 2014 - Modified Dec 19, 2014
stuartpb - in reply to runsun

This package can draw mixed-case fonts- it's just that the default font, Spiff Sans, as I drew it, is an all-caps font, as it was designed for industrious, functional text. You're welcome to contribute your own lower-case letterforms.

Awesome, I can't wait to try this! On a feature request note, the one fancy function in Write.scad that I actually used a lot was WriteCylinder. It's vastly more convenient than placing each letter individually (especially with variable-width). If you could implement something like that, it would be spectacular.

I thought about that. What I ultimately figured was that the functionality of write_cylinder would be better served by something like a general cylindrical transformation module, or a Minkowski sum, or the intersection of a long linear extrusion with a cylinder. (I don't know how to do a cylindrical transformation myself, though.)

Top