Primitives Reference: Difference between revisions
Holly-Wood (talk | contribs) |
Holly-Wood (talk | contribs) No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 675: | Line 675: | ||
r=10: 1-24ring10, 1-16ring10, 1-12ring10, 5-48ring10, 1-8ring10, 7-48ring10, 1-6ring10, 5-24ring10, 1-4ring10, 2-4ring10, 4-4ring10<br> | r=10: 1-24ring10, 1-16ring10, 1-12ring10, 5-48ring10, 1-8ring10, 7-48ring10, 1-6ring10, 5-24ring10, 1-4ring10, 2-4ring10, 4-4ring10<br> | ||
r=11: 1-24ring11, 1-16ring11, 1-8ring11, 7-48ring11, 3-16ring11, 1-4ring11, 7-16ring11, 2-4ring11, 4-4ring11<br> | r=11: 1-24ring11, 1-16ring11, 1-8ring11, 7-48ring11, 3-16ring11, 1-4ring11, 7-16ring11, 2-4ring11, 4-4ring11<br> | ||
r=12: 1-12ring12, 1-8ring12, 1-4ring12, 1-6ring12, 2-4ring12, 4-4ring12<br> | r=12: 1-12ring12, 1-8ring12, 3-16ring12, 1-4ring12, 1-6ring12, 2-4ring12, 4-4ring12<br> | ||
r=13: 1-16ring13, 1-12ring13, 1-8ring13, 1-6ring13, 5-24ring13, 1-4ring13, 5-12ring13, 11-24ring13, 3-4ring13, 4-4ring13<br> | r=13: 1-16ring13, 1-12ring13, 1-8ring13, 1-6ring13, 5-24ring13, 1-4ring13, 5-12ring13, 11-24ring13, 3-4ring13, 4-4ring13<br> | ||
r=14: 1-24ring14, 1-16ring14, 1-12ring14, 1-8ring14, 1-6ring14, 3-16ring14, 1-4ring14, 3-8ring14, 5-12ring14, 3-4ring14, 4-4ring14<br> | r=14: 1-24ring14, 1-16ring14, 1-12ring14, 1-8ring14, 1-6ring14, 3-16ring14, 1-4ring14, 3-8ring14, 5-12ring14, 3-4ring14, 4-4ring14<br> | ||
Line 681: | Line 681: | ||
r=16: 1-16ring16, 1-8ring16, 7-48ring16, 1-6ring16, 1-4ring16, 7-16ring16, 2-4ring16, 3-4ring16, 5-6ring16, 4-4ring16<br> | r=16: 1-16ring16, 1-8ring16, 7-48ring16, 1-6ring16, 1-4ring16, 7-16ring16, 2-4ring16, 3-4ring16, 5-6ring16, 4-4ring16<br> | ||
r=17: 1-16ring17, 1-12ring17, 1-6ring17, 5-24ring17, 1-4ring17, 1-3ring17, 2-4ring17, 4-4ring17<br> | r=17: 1-16ring17, 1-12ring17, 1-6ring17, 5-24ring17, 1-4ring17, 1-3ring17, 2-4ring17, 4-4ring17<br> | ||
r=18: 1-16ring18, 7-48ring18, 1-6ring18, 5-24ring18, 1-4ring18, 4-4ring18<br> | r=18: 1-16ring18, 1-12ring18, 7-48ring18, 1-6ring18, 5-24ring18, 1-4ring18, 4-4ring18<br> | ||
r=19: 1-24ring19, 1-16ring19, 1-12ring19, 5-48ring19, 1-8ring19, 1-6ring19, 11-48ring19, 1-4ring19, 2-4ring19, 4-4ring19<br> | r=19: 1-24ring19, 1-16ring19, 1-12ring19, 5-48ring19, 1-8ring19, 1-6ring19, 11-48ring19, 1-4ring19, 2-4ring19, 4-4ring19<br> | ||
r=20: 1-12ring20, 1-8ring20, 5-24ring20, 11-48ring20, 1-4ring20, 4-4ring20<br> | r=20: 1-12ring20, 1-8ring20, 5-24ring20, 11-48ring20, 1-4ring20, 4-4ring20<br> | ||
Line 923: | Line 923: | ||
r=7: 1-4con7, 3-8con7, 2-4con7, 4-4con7<br> | r=7: 1-4con7, 3-8con7, 2-4con7, 4-4con7<br> | ||
r=8: 1-8con8, 1-4con8, 2-4con8, 4-4con8<br> | r=8: 1-8con8, 1-4con8, 2-4con8, 4-4con8<br> | ||
r=9: 3-16con9, 1-4con9, 3-8con9, 2-4con9, 4-4con9<br> | r=9: 3-16con9, 1-8cone9, 1-4con9, 3-8con9, 2-4con9, 4-4con9<br> | ||
r=10: 1-8con10, 3-8con10, 1-4con10, 2-4con10, 4-4con10<br> | r=10: 1-8con10, 3-8con10, 1-4con10, 2-4con10, 4-4con10<br> | ||
r=11: 1-4con11, 5-16con11, 2-4con11, 4-4con11<br> | r=11: 1-4con11, 5-16con11, 2-4con11, 4-4con11<br> | ||
Line 1,053: | Line 1,053: | ||
::t02i1111, t02i2000, t02i2258, t02i3333, t02i4000<br> | ::t02i1111, t02i2000, t02i2258, t02i3333, t02i4000<br> | ||
::t04i0462, t04i0625, t04i6381, t04i0857, t04i0909, t04i1111, t04i1304, t04i1333, t04i1429, t04i1538, t04i1765, t04i1786, t04i2000, t04i2258, t04i2500, t04i2667, t04i3077, t04i3333, t04i4000, t04i4167, t04i5000, t04i5455, t04i6381<br> | ::t04i0462, t04i0625, t04i6381, t04i0857, t04i0909, t04i1111, t04i1304, t04i1333, t04i1429, t04i1538, t04i1765, t04i1786, t04i2000, t04i2258, t04i2500, t04i2667, t04i3077, t04i3333, t04i4000, t04i4167, t04i5000, t04i5455, t04i6381<br> | ||
::t08i0909, t08i2000, t08i4167, t08i4235, t08i4588, t08i4643<br> | ::t08i0909, t08i2000, t08i250, t08i4167, t08i4235, t08i4588, t08i4643<br> | ||
::t16i0909, t16i1429, t16i2000, t16i3333, t16i4643<br> | ::t16i0909, t16i1429, t16i2000, t16i3333, t16i4643<br> | ||
<br> | <br> | ||
Line 1,121: | Line 1,121: | ||
High resolution:<br> | High resolution:<br> | ||
::r04o1000, r04o1800<br> | ::r04o1000, r04o1800<br> | ||
::r08o2000, r08o3000, r08o11000<br> | ::r08o1800, r08o2000, r08o3000, r08o11000<br> | ||
|- | |- | ||
Line 3,065: | Line 3,065: | ||
||Exact dimensions X = 29.703; Z = 7.906 | ||Exact dimensions X = 29.703; Z = 7.906 | ||
|- | |- | ||
| '''logo-bugatti.dat''' || '''Logo Bugatti''' | |||
|- | |||
|[[File:Logo-bugatti.png|200px|alt=Logo-bugatti]] | |||
||Exact dimensions X = 15.3; Z = 7.75 | |||
|- | |||
| '''logo-bugatti-box.dat''' || '''Logo Bugatti Outer Box''' | |||
|- | |||
|[[File:Logo-bugatti-box.png|200px|alt=Logo-bugatti-box]] | |||
||Exact dimensions X = 15.3; Z = 7.75 | |||
|- | |||
| '''logo-camaro-script.dat''' || '''Logo Camaro Script''' | | '''logo-camaro-script.dat''' || '''Logo Camaro Script''' |
Latest revision as of 21:01, 20 December 2024
LDraw Primitives Reference
Latest Update: 16.11.2024, added the LDraw 2024-09 primitives.
This page is a source of reference for the LDraw primitives in the \LDraw\p directory. Primitives are defined as highly re-usable components of LEGO parts modelled for LDraw. They serve several purposes :
- To speed up parts authoring by providing a library of components which can be incorporated into several parts
- To allow rendering software to make substitutions of curved components
Within this reference material the available primitives are categorised into:
Each section contains an overview of the characteristics common to all primitives within that category. Primitives are grouped into classes within each category - one class of primitive serving a similar purpose at different sizes or resolutions. For each class of primitive, a brief description of the purpose of the primitive is provided, with notes on its co-ordinate origin, default size and rules for scaling. A list of the available primitives is shown.
An understanding of the orientation of the co-ordinate axes is essential for authoring a part for LDraw. For reference within this page the axes and their direction is shown in this diagram.
Rectilinear primitives
Nomenclature
Boxes are named boxF, with F representing the number of faces a box has. The suffix E represents the number of edges removed.
F and E are may followed by an additional letter. The hyphen is removed if F is accompanied by a modifier.
Face modifiers:
- o - faces are opposite to each other
- t - faces are all touching each other (usually, it's implied, but box4t.dat is a thing)
- u - missing faces form a U-shape
Edge letters:
- p - groups of edges are parallel to each other
- a - some missing faces have no adjacent edges
Scaling and orientation
These rectilinear elements may be scaled in the {x}, {y} and {z} dimensions to make elements of any size. For example
1 16 0 0 0 40 0 0 0 1 0 0 0 20 rect.dat
would generate a 80LDu x 40LDu rectangle in the {x,z} plane.
Although the default orientation of the rect.dat primitive is in the {x,z} plane the LDraw language allows for this to be transformed
1 16 0 0 0 0 1 0 40 0 0 0 0 20 rect.dat
would generate a 80LDu x 40LDu rectangle in the {y,z} plane.
1 16 0 0 0 40 0 0 0 0 20 0 1 0 rect.dat
would generate a 80LDu x 40LDu rectangle in the {x,y} plane.
Do NOT rotate rect primitives outside of right angles: 90°, 180 ... on all axes.
Return to top |
Return to top |
Curved primitives
LDraw represents curved surfaces as polygons. For circular components two series of primitives are provided.
All the circular primitives are orientated in the {x,z} plane with their origin at the centre of the circle and a default radius of 1 LDu. Primitives are provided for complete circles and for commonly used fractions of a complete circle. Where the naming convention includes a prefix of the form n-f this indicates the fraction (n/f) of the circle drawn by the primitive. Where this fraction is less than an entire circle, the primitive starts at {+x,0} and progresses in a conterclockwise direction when viewed from above {-y}.
To avoid rounding errors, it is preferable to use existing fractional circular primitives, or create a new primitive, rather than rotate an existing primitive by anything other than 90 or 180 degrees. For example, use 3-16XXXX.dat rather than combining 1-8XXXX.dat with 1-16XXXX.dat rotated by 22.5 degreees.
To avoid matrix arithmetic problems in some renderers, the third dimension ({y} in the default orientation) of two-dimensional primitives must be given a non-zero scaling factor. LDraw circles are normally formed of 16-sided polygons (hexdecagons) - the regular resolution. For larger elements, where scaling-up of hexadecagons would give too angular an appearance, a series of high resolution primitives based on a 48-sided polygon are available. These may also be used for parts not well suited to a 16-fold symmetry.
These circular elements may be scaled by the same factor in both the {x} and {z} dimensions to make circular elements of greater or less than 1LDu radius. For example
1 16 0 0 0 3 0 0 0 1 0 0 0 3 4-4edge.dat
would generate a circle in the {x,z} plane with a radius of 3LDu.
They may also be scaled asymmetrically in the x and z dimension to make ellipses.
Although the default orientation is in the {x,z} plane the LDraw language allows for these to be transformed
1 16 0 0 0 0 1 0 3 0 0 0 0 3 4-4edge.dat would generate a circle in the {y,z} plane
1 16 0 0 0 3 0 0 0 0 3 0 1 0 4-4edge.dat would generate a circle in the {x,y} plane
Return to top |
Return to top |
Technic primitives
Return to top |
Return to top |
Return to top |
Return to top |
Return to top |
Return to top |
Return to top |
Return to top |
Return to top |
Return to top |
Return to top |
Return to top |
Stud primitives
Each studxxx primitive described below has a matching low resolution stu2xxx primitive, used by the fast-draw mode of renderers - these stu2xxx primitive must never be used in part files. An additional primitive (studline.dat) is used to substitute a single line for studs by the super fast-draw mode of LDraw.
All stud primitives are modelled with the solid disc uppermost, even if designed for the underside of parts (stud3, stud4, stud8, stud11). The origin is at the base of the stud and they extend for 4LDU in the {-y} dimension. To use for the underside, the primitives need to be inverted in the {y} dimension, viz.
1 16 x y z 1 0 0 0 -1 0 0 0 1 stud3.dat
These primitives must not be scaled in the {x} or {z} dimensions. Ideally they should not be scaled in the {y} dimension either, to allow the accurate substitution of chamfered studs by high-quality renderers [but this rule is flouted in the regular brick files, where stud4 is scaled by 5 to generate the underside tube].
Return to top |
Return to top |
Return to top |
Stud group primitives
Stud groups are provided to reduce the size of part files with many regularly spaced studs. The naming convention is stugN-XxZ.dat, where:
- N = type of stud (regular stud, hollow stud, underside stud, etc.)
- X = number of studs on the x axis
- Z = number of studs on the z axis
To prevent an overload of the library with excessive combinations, the numbers on the x and z axis are limited to:
- 1xZ stugs
- Xx1 stugs (Due to stud orientation you cannot rotate a 1xZ stud group by 90 degrees to get a Xx1 stud group)
- XxZ stugs where X = Z
These primitives must not be scaled.
Return to top |
Logo primitives
This section comprises various primitives of LEGO and non-LEGO logos mostly used on patterns and stickers. These might be used as primitives or inlined code to see fit.
Return to top |
Miscellaneous primitives
This section comprises miscellaneous primitives that do not fit neatly into any of the other categories. All are highly specialised and represent components of parts which fit together with each other or other standard parts. As such these primitives are not intended to be re-sized.
Return to top |
Text primitves
The section comprises reusable glyphs for constructing text patterns. These primitives may be re-sized.
The naming convention for these primitives is typeffci, where ff is an arbitrary two-letter abbreviation for the typeface, c is the glyph class (u=upper case letter, l=lower case letter, n=number, s=symbol, a=accented letter) and i is the glyph identifier (a-z for the upper and lower case letters, 0-9 for the numbers).
Return to top |
Duplo primitives
This section comprises primitives for Duplo parts, all of which have been modelled and released into the official library.
Return to top |
Joint-8 Ball primitives
This section comprises miscellaneous primitives that do not fit neatly into any of the other categories. All are highly specialised and represent components of parts which fit together with each other or other standard parts. As such these primitives are not intended to be re-sized.
Return to top |
Minifig primitives
This section comprises primitives for minifig parts. All are highly specialised and represent components of parts which fit together with each other or other standard parts. As such these primitives are not intended to be re-sized.
knob1.dat | Minifig Arm Knob |
hipstud.dat | Stud for Minifig Hips |
hipstuda.dat | Stud for Minifig Hips without Base Edges |
hipstudh.dat | Stud for Minifig Hips with Hole |
Arm primitives
This section comprises miscellaneous primitives that do not fit neatly into any of the other categories. All are highly specialised and represent components of parts which fit together with each other or other standard parts. As such these primitives are not intended to be re-sized.
Return to top |
Click-lock primitives
This section comprises miscellaneous primitives that do not fit neatly into any of the other categories. All are highly specialised and represent components of parts which fit together with each other or other standard parts. As such these primitives are not intended to be re-sized.
Return to top |
Clip primitives
This section comprises miscellaneous primitives that do not fit neatly into any of the other categories. All are highly specialised and represent components of parts which fit together with each other or other standard parts. As such these primitives are not intended to be re-sized.
Return to top |
Wheel holding pin primitives
This section comprises miscellaneous primitives that do not fit neatly into any of the other categories. All are highly specialised and represent components of parts which fit together with each other or other standard parts. As such these primitives are not intended to be re-sized.
Return to top |
Handle primitives
This section comprises miscellaneous primitives that do not fit neatly into any of the other categories. All are highly specialised and represent components of parts which fit together with each other or other standard parts. As such these primitives are not intended to be re-sized.
handle.dat | Handle for Flat Shields |
handle2.dat | Handle for Bent Shields |
phandle1.dat | Bar Handle Attachment with Open Side |
phandle2.dat | Bar Handle Attachment with 2 Open Sides |
Return to top |
Hinge primitives
This section comprises miscellaneous primitives that do not fit neatly into any of the other categories. All are highly specialised and represent components of parts which fit together with each other or other standard parts. As such these primitives are not intended to be re-sized.
Return to top |
ZNAP parts primitives
This section comprises primitives for the ZNAP parts, all of which have been modelled and released into the official library.
Return to top |
Clikits primitives
This section comprises miscellaneous primitives that do not fit neatly into any of the other categories. All are highly specialised and represent components of parts which fit together with each other or other standard parts. As such these primitives are not intended to be re-sized.
clikitsstud.dat | Clikits Stud |
clikitshole.dat | Clikits Hole |
Return to top |
The rest of development
This section comprises miscellaneous primitives that do not fit neatly into any of the other categories. All are highly specialised and represent components of parts which fit together with each other or other standard parts. As such these primitives are not intended to be re-sized.
Return to top |