Function Repository Resource:

TextToLines3D

Source Notebook

Convert text strings into three-dimensional graphics primitives

Contributed by: Erik Mahieu

ResourceFunction["TextToLines3D"][text]

converts the String text into a collection of 3D Line objects.

Details and Options

The following options can be used:
"LineColor"Bluecolor of the Line objects
"LineThickness"1AbsoluteThickness of the Line objects
Furthermore, the following options of Style can be used: FontSize, FontFamily, FontSlant, FontVariations, FontTracking and FontWeight.

Examples

Basic Examples (1) 

Render text as 3D graphics:

In[1]:=
Graphics3D[ResourceFunction["TextToLines3D"]["Mathematica"]]
Out[1]=

Scope (2) 

The Line objects generated by TextToLines3D can be used inside Graphics3D together with other Graphics primitives:

In[2]:=
Graphics3D[{{LightGray, Cuboid[{0, -5, 3.6}, {55, 5, 3.2}]},
  ResourceFunction["TextToLines3D"]["Mathematica", "LineColor" -> Red,
    "LineThickness" -> 3, FontSize -> 12, FontFamily -> "American Typewriter"]}, PlotRange -> All, Boxed -> False]
Out[2]=

TextToLines3D creates a colored Line primitive that can be wrapped in Graphics3D:

In[3]:=
lines = ResourceFunction["TextToLines3D"]["Mathematica"];
% // Short[#, 5] &
Out[4]=
In[5]:=
Graphics3D[lines]
Out[5]=

Options (1) 

Many Style options can be used inside TextToLines3D:

In[6]:=
Graphics3D[
 ResourceFunction["TextToLines3D"]["Wofram", FontFamily -> "Arial Black", FontSlant -> Italic, FontTracking -> "Condensed", FontWeight -> "Plain", FontVariations -> {"Underline" -> True}], ViewPoint -> {1.3, -2.4, 2.}]
Out[6]=

Applications (1) 

3D letters and text can be used in many applications. Here is a rotated "G":

In[7]:=
Graphics3D[
 Rotate[ResourceFunction["TextToLines3D"]["G", "LineThickness" -> 6, "LineColor" -> Red], \[Pi]/4, {0, 0, 1}, {2.5, 0, 0}], PlotRange -> {{0, 6}, {-4, 4}, Automatic}]
Out[7]=

Properties and Relations (1) 

Similar result can be obtained using the resource function SymbolToPolygon:

In[8]:=
Graphics3D[{EdgeForm[Black], Red, ResourceFunction["SymbolToPolygon"]["Wolfram"]}, PlotRange -> {Automatic, Automatic, {.95, 1.05}}]
Out[8]=

Neat Examples (1) 

The Line primitives can easily be replaced by Tube primitives:

In[9]:=
Graphics3D[{{LightGray, Cuboid[{0, -5, 3.6}, {55, 5, 3.2}]},
  ResourceFunction["TextToLines3D"]["Mathematica", LineColor -> Green,
     LineThickness -> 3, FontSize -> 12, FontFamily -> "American Typewriter"] /. Line -> (Tube[#, .35] &)},
  PlotRange -> All,
 Boxed -> False, Axes -> False]
Out[9]=

Publisher

Erik Mahieu

Version History

  • 1.0.0 – 06 November 2020

Related Resources

License Information