The Materials and Geometry Format
Version 1.0, May 1995
Greg Ward,
Lawrence Berkeley Laboratory,
GJWard@Lbl.Gov
MGF has a simple entity-per-line structure, with a similar
appearance to Wavefront's .OBJ format.
Each entity is specified by a short keyword, and
arguments are separated by white space (tabs and/or spaces).
A newline may be escaped with a backslash ('\'), in which case it
counts as a space.
Lines and continued lines may have up to 4096 characters, including
newlines, tabs and spaces.
A comment is an ignored entity whose keyword is the pound sign ('#').
Here is an MGF file that describes a simple two-drawer file cabinet:
# Conversion from inches to meters
xf -s .0254
# Surface material
m burgundy_formica =
c
cxy .362 .283
rd .0402
c
rs .0284 .05
sides 1
# Cabinet vertices
v fc.xy =
p .05 0 0
v fc.xY =
p .05 18 0
v fc.XY =
p 35.95 18 0
v fc.Xy =
p 35.95 0 0
# Cabinet
prism fc.xy fc.xY fc.XY fc.Xy 24
# Drawer vertices
v fcd.Xz =
p 34 0 0
v fcd.XZ =
p 34 0 10
v fcd.xZ =
p 0 0 10
v fcd.xz =
p 0 0 0
# Two drawers
o drawer
xf -t 1 18.1 2 -a 2 -t 0 0 11
prism fcd.xz fcd.Xz fcd.XZ fcd.xZ .9
xf
o
# End of units conversion
xf
Application Notes