brick xml
   

 reference

 

 

Elements

model
info
part
step
submodel
 

Common Attributes

coordinates
transform
color
 

 

 

Brick XML Model 0.3 Element Reference

The following is an element reference for Brick XML Model 0.3, as specified in brick-xml-20030501.dtd (http://brick-xml.sourceforge.net/DTD/brick-xml-20030501.dtd)

Element attributes and contents in grey are optional.

 

<model>

The root element of a Brick XML Model document.

 

<model
   x= x
   y= y
   z= z
   transform=

>

   <info> [0,1]

   <step> [0+]

   <part> [0+]

   <submodel> [0+]

</model>

The optional x, y, and z attributes specify the x, y, and z placement coordinates of the model.  The coordinates of any child <part> or <submodel> elements will be relative to these coordinates.  If these values are not present, the point <0, 0, 0> will be assumed.

The optional transform attribute specifies the global transformation to be applied to the model and any child <part> or <submodel> elements. 

Examples:

<model>
    ...
</model>

<model x="0" y="9" z="9.6">
    ...
</model>


<info>

Used to provide optional information about a model.  This element is optional, but if used, only one <info> element is allowed inside a <model> element.
 

<info
  title= title of model
  creator= name/program
  date= date created

>

   optional text

</info>

The optional title attribute specifies the title or name of the model.

The optional creator attribute specifies the name of the person or program that created the model.

The optional date attribute specifies the date and/or time the model was created.

Text can optionally be placed in this element to give more detailed information about the model. 

Examples:

<info creator="Fred Mertz"/>

<info title="Temple" creator="Gary Thomas" date="12/31/2001"/>

<info>
    This model is based on the real temple of
    blah blah blah blah blah blah blah blah
    blah blah blah blah blah blah blah blah...
</info>


<part>

Used to specify a part of a model (construction element), it's color, location, and any transformation applied to it.
 

<part id= part #/id
  color=part color
  x=x coordinate
  y=y coordinate
  z=z coordinate
  transform=
/>

The id attribute specifies the part to be used.

The color attribute specifies the color of the part.

The x, y, and z attributes specify the x, y, and z placement coordinates of the part.

The optional transform attribute specifies the transformation to be applied to the part. 

Examples:

<part id="3001" color="red" x="16" y="-32" z="0"/>

<part id="3865" color="green" x="0" y="0" z="0"/>

<part id="3001" color="#0066A7" x="16" y="-32" z="0"/>


<step>

Used to indicate a step in the construction of a model.

<step
  name= step name/number
>

   optional text

</step>

The optional name attribute specifies a name, number, or other identifier for the step.

Text can optionally be placed in this element to give more detailed information about the step.

Examples:

<step/>

<step name="3"/>

<step name="Wing">
   This step's kind of tricky, so make 
   sure you don't screw it up.
</step>

 

<submodel>

Used to specify a submodel, it's location, and any transformation applied to it.

 

<submodel
  id= id or uri
  x= x coordinate
  y= y coordinate
  z= z coordinate
  transform=

/>

The id attribute specifies an external Brick XML Model file to include as a submodel in the current model.  A filename, URL, or other type of identifier can be used.

The optional x, y, and z attributes specify the x, y, and z placement coordinates of the submodel.  The submodel's origin will be offset by these values.  If these values are not present, the point <0, 0, 0> will be assumed.

The optional transform attribute specifies the transformation to be applied to the submodel. 

 

Examples:

<submodel id="car.bxml"/>

<submodel id="C:\mocs\minifig.bxml" x="0" y="9" z="9.6"/>

<submodel id="http://example.com/sample.bxml" x="0" y="9"z="9.6"/>

<submodel id="1594" x="1" y="5"z="9"/>

 

 

Common Attributes

The following are attributes and values common to one or more element types.

Coordinates (x, y, z)

The x, y, and z attributes used in <model>, <part> or <submodel> elements represent x, y, and z Cartesian coordinates.

Coordinate System

The proposed coordinate system for Brick XML is the right-handed Cartesian coordinate system shown in Figure 1 below.  This is the same coordinate system used in engineering, aviation, and many CAD systems.

Figure 1 - Right-hand coordinate system

Units

For maximum flexibility, coordinates may be specified using decimal values, and can include an optional unit of measurement, as listed in the following table.

Unit Name Description
st Stud Width of standard 1 x 1 brick.
br Brick Height of standard brick.
pl Plate Height of standard plate.
lu L Units Unit used to describe part sizes by integer ratios.
ld LDraw Standard unit used by LDraw compatible programs.
mm Millimeter -
in Inch -

Table 1 - Units of Measurement

TO DO:

What should the default unit of measurement be?

  Equivalent measurement in:
Unit st br pl lu ld mm in
st 1 0.833 2.5 5 20 7.985 0.31437
br 1.2 1 3 6 24 9.582 0.37724
pl 0.4 0.33 1 2 8 3.194 0.12575
lu 0.2 0.166 0.5 1 4 1.5972 0.06288
ld 0.05 0.04166 0.125 0.25 1 0.3993 0.01572
mm 0.12523 0.10436 0.31309 0.6261 2.50446 1 0.03937
in 3.18097 2.65083 7.95229 15.9033 63.6132 25.4 1

Table 2 - Unit Conversion Table

If units are specified, a single space should be placed between the value and unit to aid in programmatic parsing.  For example:

"100 br"
"1.25 mm"
"3 pl"
etc.

Units can be be independently specified for the x, y, and z coordinate.  For example:

<part id="3001" color="&red;" x="12 st" y="34 mm" z="5 pl" />

Transforms

The transform attribute used in <model>, <part> or <submodel> elements represents a transformation of the element's alignment, position, scale, and/or other geometry attributes.  The values for this attribute may vary, but will always be in the general form of a function call with n number of comma-separated parameters, such as:

<transformation_type>(<parameter 1>, <parameter 2>, ..., <parameter n>)

Two types of transforms should be supported initially: rotate and matrix

rotate(x, y, z)

rotate is a 3 parameter transform that specifies an element's alignment by specifying rotations about the x, y, and z coordinate axis, measured in degrees.  For example:

<part ... x="0" y="0" z="0" transform="rotate(0,0,90)" />

<part ... x="0" y="0" z="0" transform="rotate(45,0,135)" />

matrix(a, b, c, d, e, f, g, h, i)

matrix  is a 9 parameter transform that specifies an element's alignment, scale, and/or shear using a standard rotation matrix.

<part ... transform="matrix(1, 0, 0, 0, 1, 0, 0, 0, 1)" />

<part ... transform="matrix(0, 0, -1, 0, 1, 0, 1, 0, 0)" />

TO DO:

Another form of transform is needed to describe bendable parts, such as tubing, fabric, etc.

 

 

Color

The following are color entities which can be used in place of color ids.

TO DO:

What format should color IDs be?  Hex RGB?  Color guide IDs?

Entity Name

Color ID

&aqua;
&beige;
&black;
&blue;
&blue-chrome;
&blue-violet-iridescent;
&bright-green;
&bronze-chrome;
&burgundy;
&chartreuse;
&clear;
&dark-blue;
&dark-brown;
&dark-orange;
&dark-pink;
&dark-red;
&dark-warm-gray;
&deep-yellow-orange;
&forest-green;
&glow-in-the-dark;
&gold-chrome;
&gold-dull-chrome;
&gold-iridescent;
&gray;
&gray-iridescent;
&green-chrome;
&green-dull-chrome;
&indigo;
&lavender;
&light-blue;
&light-blue-violet;
&light-brown;
&light-salmon;
&light-turquoise;
&light-warm-gray;
&light-yellow;
&lime;
&magenta;
&mauve;
&medium-brown;
&mint-green;
&old-clear;
&old-milky-white;
&old-pink;
&orange;
&peach;
&pearlescent;
&pink;
&red;
&salmon;
&sand-blue;
&sand-green;
&sand-red;
&sand-violet;
&silver-chrome;
&silver-dull-chrome;
&smoke;
&tan;
&teal;
&trans-blue;
&trans-dark-gray;
&trans-glitter-pink;
&trans-glitter-violet;
&trans-green;
&trans-light-blue;
&trans-neon-orange;
&trans-neon-yellow;
&trans-pink;
&trans-red;
&trans-violet;
&trans-yellow;
&turquoise;
&very-light-blue;
&very-light-yellow;
&violet-blue;
&white;
&yellow;
&yellow-orange;