This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Documentation / Mathematica / Add-ons & Links / Standard Packages / Graphics /


3-Script is a file format for transferring descriptions of three-dimensional graphics objects from Mathematica to other programs. All Mathematica kernels have the ability to render three-dimensional images into the PostScript page description language. For certain applications, it is desirable to have a description of the image that retains the three-dimensional character that is lost when rendering into PostScript. The package Graphics`ThreeScript` supplies a number of utilities for writing suitable Mathematica objects into 3-Script format files.

This loads the package.

In[1]:= <<Graphics`ThreeScript`

This constructs a Graphics3D object.

In[2]:= obj = Graphics3D[
Polygon[{{0,0,0}, {0,1,0}, {0,1,1}}]]


This writes the 3-Script format into the file object.ts. Note that the filename is returned.

In[3]:= ThreeScript[ "object.ts", obj]


This shows the contents of the file.

In[4]:= !!object.ts

"% Graphics3D objects


0 0 0

0 1 1


1.3 -2.4 2.


0 0 0


1. 0. 1.

1 0 0

1. 1. 1.

0 1 0

0. 1. 1.

0 0 1


0 0 0

0 1 0

0 1 1"

The 3-Script format works with all three-dimensional primitives and directives. This includes both Graphics3D and SurfaceGraphics objects. Note that in the 3-Script format information such as coordinates appears below the command name.

Standard 3-Script descriptions of three-dimensional objects.

3-Script commands used as global directives.

3-Script is used by the Mathematica command Live that is available on platforms that support the GL library, such as Silicon Graphics computers. A 3-Script format file is written and this is passed to an external renderer to process. An alternative method you can use to pass a three-dimensional structure, or indeed any Mathematica expression into an external program, is to use the MathLink communications protocol.

A complete description of the 3-Script file format is contained in the Wolfram Research technical report, The 3-Script File Format, which can be found in the Mathematica Information Center, at; search the collection for `threescript'.