Git Product home page Git Product logo

text_on_openscad's Introduction

text_on_OpenSCAD

A library for putting customised "text on" 3D shapes in OpenSCAD with changeable fonts, languages/scripts, text direction.

Only works with OpenSCAD v 2014.xx and later -- where text() module is added and unicode text is supported. The text module is still an experimental feature in newer releases and must be enabled at run time (--enable=text).

This is a rewrite and extension of the great write.scad (v3 from http://www.thingiverse.com/thing:16193) to use the new OpenSCAD internal text() primitive.

  • All credit to Harlan Martin ([email protected]) for his great effort on the original.
  • Great thanks to @t-paul (and the OpenSCAD dev team) on adding the new text() primitive giving us other fonts.

Functions are provided for putting text on:

  • Spheres
  • Cylinders (including unequal top and bottom radii)
  • Cubes
  • Circles

Text can be unicode charaters and in any font (installed on your system), language (e.g. "en","cn","jp"), script (e.g. "arabic","hiragana"), size and direction ("ttb", "btt", "rtl", "ltr").

There are examples in the /examples directory to get you started. See below for some image renders.

Installation and Usage

Option 1 (Quick)

  • Copy text_on.scad into the same directory as your .scad file.
  • Add "use <text_on.scad>" to your .scad file.

Option 2 (Nicer)

  • Copy (or link) the "text_on" directory into your OpenSCAD library directory (In OpenSCAD File/Library Folder will show you where it is).
  • Add "use <text_on/text_on.scad>" to your .scad file.

Module Arguments

See the top comments section in of text_on.scad for the module definition

The modules use the arguments with the same name as their underlying shapes in order to define the dimensions of the object to put "test_on (e.g. sphere() uses r, so does text_on_sphere() ).

They also expose the arguments of the text() primitive:

  • t
  • size
  • spacing
  • font
  • direction -- ltr, ttb, btt or rtl
  • language
  • script
  • halign -- left, right or center
  • valign -- baseline, bottom, top or center

And additional arguments:

  • extrusion_height //i.e. how far it sits proud
  • rotate
  • center //center the text at the location it is being written (NOT that the object is centered)
  • locn_vector //Where the faux-object has been translated to.

Quick Example - Text On Sphere

%sphere(r=15); //Partially visible "base" object
text_on_sphere("Hello World",r=15);

Quick Example - Text On Cylinder

%cylinder(r1=rad1,r2=rad2,h=40); //Partially visible "base" object
text_on_cylinder(t="Text",r1=rad1,r2=rad2,h=40, font="Liberation Mono", direction="ttb", size=5);

Example Images

The examples in /examples produce the following:

text_on_cube.scad

alt text

text_on_font.scad.png

alt text

alt text

text_on_circle.scad.png

alt text

text_on_cylinder.scad.png

alt text

text_on_sphere.scad.png

alt text

text_extrude.scad

alt text

Development

Please fork from at https://github.com/brodykenrick/text_on_OpenSCAD and fix any bugs or add any features and send a pull request.

text_on_openscad's People

Contributors

brodykenrick avatar neon22 avatar pavpen avatar t-paul avatar trevorrowe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

text_on_openscad's Issues

Cutout letter O

Hi,

This isn't your problem but is probably a common one. How should I deal with cut out 0?

It leaves an impossible print section. Is there some way to 'fill' it?

Warnings while testing example text_on_cube.scad

Hi!

I've got the latest OpenSCAD http://files.openscad.org/OpenSCAD-2014.03-x86-64-Installer.exe
I've put the latest version of text_on_cube.scad and text_on.scad in the same directory and changed the reference like this:

use <text_on.scad>

When I open it in OpenSCAD I get:

Loaded design 'C:/Users/daniel/Dropbox/3DModels/Toys/MinecraftChest/text_on_cube.scad'.
  compiled module: 0xb426c30
Module cache size: 1 modules
Compiling design (CSG Tree generation)...
WARNING: Ignoring unknown module 'text'.
WARNING: Ignoring unknown module 'text'.
WARNING: Ignoring unknown module 'text'.
WARNING: Ignoring unknown module 'text'.
WARNING: Ignoring unknown module 'text'.
WARNING: Ignoring unknown module 'text'.
WARNING: Ignoring unknown module 'text'.
WARNING: Ignoring unknown module 'text'.
WARNING: Ignoring unknown module 'text'.
WARNING: Ignoring unknown module 'text'.
WARNING: Ignoring unknown module 'text'.
WARNING: Ignoring unknown module 'text'.
WARNING: Ignoring unknown module 'text'.
WARNING: Ignoring unknown module 'text'.
WARNING: Ignoring unknown module 'text'.
Compiling design (CSG Products generation)...
ERROR: CSG generation failed! (no top level object found)
PolySets in cache: 4
PolySet cache size in bytes: 2000
CGAL Polyhedrons in cache: 0
CGAL cache size in bytes: 0

What am I doing wrong here?

I'm running OpenSCAD on a 64 bit Windows 7.

how do I just do regular LTR text on the side of a cylinder?

use <text_on/text_on.scad>

rad1 = 30;
rad2 = rad1;

%cylinder(r1=rad1,r2=rad2,h=40); //Partially visible "base" object
text_on_cylinder(t="Text",r1=rad1,r2=rad2,h=40, font="Liberation Mono", direction="ttb", size=5);

this scrunches up all the text, I just want regular text LTR that you can read on the side of a cylinder.

text on cylinder broken in openscad 2021.1

text_on_cylinder

when running the example file for text on cylinder ,text is rendered in a clump in the middle of the cylinder

and a load of error messages are generated:

Parsing design (AST generation)...
Compiling design (CSG Tree generation)...
WARNING: undefined operation (number * undefined) in file text_on.scad, line 111
WARNING: undefined operation (number / undefined) in file text_on.scad, line 111
WARNING: undefined operation (undefined * number) in file text_on.scad, line 111
WARNING: undefined operation (undefined * number) in file text_on.scad, line 111
WARNING: undefined operation (number * undefined) in file text_on.scad, line 188
WARNING: Problem converting rotate(a=undef) parameter in file ../../../OpenSCAD/libraries/text_on/text_on.scad, line 188
ECHO: "text_on_cylinder:WARNING - Slanty-cylinders don't support centering yet. Setting center to false. You can adjust updown and eastwest and achieve most of what you are after...."
WARNING: Ignoring unknown variable 'updown' in file ../../../OpenSCAD/libraries/text_on/text_on.scad, line 355
WARNING: Unable to convert translate([0, 0, undef]) parameter to a vec3 or vec2 of numbers in file ../../../OpenSCAD/libraries/text_on/text_on.scad, line 355
WARNING: Ignoring unknown variable 'eastwest' in file ../../../OpenSCAD/libraries/text_on/text_on.scad, line 356
WARNING: Problem converting rotate(a=undef) parameter in file ../../../OpenSCAD/libraries/text_on/text_on.scad, line 356
WARNING: Ignoring unknown variable 'updown' in file ../../../OpenSCAD/libraries/text_on/text_on.scad, line 361
WARNING: undefined operation (number - undefined) in file text_on.scad, line 326
WARNING: undefined operation (undefined + number) in file text_on.scad, line 326
WARNING: undefined operation (number - undefined) in file text_on.scad, line 322
WARNING: undefined operation (number * undefined) in file text_on.scad, line 322
WARNING: undefined operation (undefined / number) in file text_on.scad, line 322
WARNING: undefined operation (number + undefined) in file text_on.scad, line 322
WARNING: undefined operation (number * undefined) in file text_on.scad, line 103
WARNING: undefined operation (number / undefined) in file text_on.scad, line 103
WARNING: undefined operation (undefined * number) in file text_on.scad, line 103
WARNING: undefined operation (undefined * number) in file text_on.scad, line 103
WARNING: undefined operation (number * undefined) in file text_on.scad, line 364
WARNING: undefined operation (undefined * number) in file text_on.scad, line 364
WARNING: undefined operation (number + undefined) in file text_on.scad, line 364
WARNING: Problem converting rotate(a=undef) parameter in file ../../../OpenSCAD/libraries/text_on/text_on.scad, line 365
WARNING: Unable to convert translate([undef, 0, 0]) parameter to a vec3 or vec2 of numbers in file ../../../OpenSCAD/libraries/text_on/text_on.scad, line 372
WARNING: Ignoring unknown variable 'updown' in file ../../../OpenSCAD/libraries/text_on/text_on.scad, line 361
WARNING: undefined operation (number - undefined) in file text_on.scad, line 326
WARNING: undefined operation (undefined + number) in file text_on.scad, line 326
WARNING: undefined operation (number - undefined) in file text_on.scad, line 322
WARNING: undefined operation (number * undefined) in file text_on.scad, line 322
WARNING: undefined operation (undefined / number) in file text_on.scad, line 322
WARNING: undefined operation (number + undefined) in file text_on.scad, line 322
WARNING: undefined operation (number * undefined) in file text_on.scad, line 103
WARNING: undefined operation (number / undefined) in file text_on.scad, line 103
WARNING: undefined operation (undefined * number) in file text_on.scad, line 103
WARNING: undefined operation (undefined * number) in file text_on.scad, line 103
WARNING: undefined operation (number * undefined) in file text_on.scad, line 364
WARNING: undefined operation (undefined * number) in file text_on.scad, line 364
WARNING: undefined operation (number + undefined) in file text_on.scad, line 364
WARNING: Problem converting rotate(a=undef) parameter in file ../../../OpenSCAD/libraries/text_on/text_on.scad, line 365
WARNING: Unable to convert translate([undef, 0, 0]) parameter to a vec3 or vec2 of numbers in file ../../../OpenSCAD/libraries/text_on/text_on.scad, line 372
WARNING: Ignoring unknown variable 'updown' in file ../../../OpenSCAD/libraries/text_on/text_on.scad, line 361

Any way to curve along a cylinder vertically?

Any way to get text to follow the curve of a cylinder when it is rotated 90 degrees?
In this snippet, you can see it appears flat, and doesn't curve along the surface of the cylinder.

rad1=3;
rad2=3;
%cylinder(r1=rad1,r2=rad2,h=40, $fn=100); //Partially visible "base" object
text_on_cylinder(t="Text",r1=rad1,r2=rad2,h=40, rotate=90, font="Liberation Mono", direction="ttb", size=5);

Add Letter Buffering Support

As a text_on user, I would like to be able to vary the thickness of letters being typeset.

In other fields of science, a shell of a given width added to a polygon is known as a buffer.

Text on inside of cylinder

I want to put text on the inside of cup shape object. With text_on_cylinder the text I get is flipped (because it's for reading from outside). How can I make text readable from inside?

Clock Face Text

I've got the latest OpenSCAD http://files.openscad.org/OpenSCAD-2015.03for Linux put the latest version of text_on_circle.scad and text_on.scad in the same directory and changed the reference like this:

use <text_on.scad>

here's my problem:

text_on_circle(t="123456789",r=r,font="DejaVuSansCondensed",spacing=3);

works fine.

How do I apply more than single digits? Ex: 10, 11, 12?

Thanx

difference doesn't work

Hi, i try to use the library to put text on cilynder and it works but if i try to use difference() to engrave text on cylinder wall it doesn't work.

warnings with east and rotate parameter in sphere example

OpenScad2021.1
[WARNING: variable east not specified as parameter in file text_on_sphere.scad, line 15](#15, C:/.../text_on_OpenSCAD-master/examples/text_on_sphere.scad)

[WARNING: variable rotate not specified as parameter in file text_on.scad, line 445](https://github.com/brodykenrick/text_on_OpenSCAD/issues/445 C:/.../text_on_OpenSCAD-master/text_on.scad)
[WARNING: variable halign not specified as parameter in file text_on.scad, line 445](https://github.com/brodykenrick/text_on_OpenSCAD/issues/445, C:/.../text_on_OpenSCAD-master/text_on.scad)
[WARNING: variable valign not specified as parameter in file text_on.scad, line 445](https://github.com/brodykenrick/text_on_OpenSCAD/issues/445, C:/.../text_on_OpenSCAD-master/text_on.scad)
[WARNING: Ignoring unknown variable 'east' in file C:/.../text_on_OpenSCAD-master/examples/text_on_sphere.scad, line 25](https://github.com/brodykenrick/text_on_OpenSCAD/issues/25, C:/.../text_on_OpenSCAD-master/examples/text_on_sphere.scad)
ECHO: undef

...
translate([10,100,-20]){
color("blue")
sphere(25);
color("lightblue")
text_on_sphere("Rounded"
,r=25
,extrusion_height=4
,spin=45
,northsouth=30
,east=20
,size=20
,rounded=false
,center=true);
}
echo(east);
...

Option 2 confused

According to Option1, change to:
Option 2 (Nicer)
1.Copy the text_on.scad (or link) into your OpenSCAD library directory ([File/Show Library Folder...]).
2.Add "use <text_on.scad>" in your .scad file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.