Primitives Reference: Difference between revisions
Holly-Wood (talk | contribs) No edit summary |
Holly-Wood (talk | contribs) No edit summary |
||
| Line 1,177: | Line 1,177: | ||
|- | |- | ||
| [[File:Axl2hol8.png|200px|thumb|alt=Axl2hol8]] | | [[File:Axl2hol8.png|200px|thumb|alt=Axl2hol8]] | ||
||This primitive | ||This primitive comprises a 1LDu long section of reduced technic axle, without any ends. It may be scaled in the {y} dimension as necessary. | ||
|- | |- | ||
| Line 1,196: | Line 1,196: | ||
| [[File:Axl2end.png|200px|thumb|alt=Axl2end]] | | [[File:Axl2end.png|200px|thumb|alt=Axl2end]] | ||
||This primitive is used to produce the "plus-shaped" cross section of a technic axle hole reduced. | ||This primitive is used to produce the "plus-shaped" cross section of a technic axle hole reduced. | ||
|} | |||
{| class="wikitable" | |||
|+ | |||
===Technic axle hole semi-reduced=== | |||
|- | |||
| '''axl3hole.dat''' || '''Technic axle hole semi-reduced''' | |||
|- | |||
| [[File:Axl3hole.png|200px|thumb|alt=Axl3hole]] | |||
||This primitive produces a technic axle hole with semi-reduced teeth including the disc ends and all edges. It may be scaled in the {y} dimension as necessary. | |||
|- | |||
| '''axl3hol2.dat''' || ''' Technic axle hole semi-reduced - side edges''' | |||
|- | |||
| [[File:Axl3hol2.png|200px|thumb|alt=Axl3hol2]] | |||
||This primitive produces the edges at the ends of the "plus-shaped" semi-reduced technic axle. | |||
|- | |||
| '''axl3hol3.dat''' || '''Technic axle hole semi-reduced - tooth outer edges''' | |||
|- | |||
| [[File:Axl3hol3.png|200px|thumb|alt=Axl3hol3]] | |||
||This primitive produces the outer edges of the teeth of a semi-reduced technic axle hole. | |||
|- | |||
| '''axl3hol6.dat''' || '''Technic axle hole semi-reduced tooth''' | |||
|- | |||
| [[File:Axl3hol6.png|200px|thumb|alt=Axl3hol6]] | |||
||This primitive represents the teeth of a semi-reduced technic axle hole. It may be scaled in the {y} dimension as necessary. | |||
|- | |||
| '''axl3hol8.dat''' || '''Technic axle hole semi-reduced - perimeter''' | |||
|- | |||
| [[File:Axl3hol8.png|200px|thumb|alt=Axl3hol8]] | |||
||This primitive comprises a 1LDu long section of semi-reduced technic axle, without any ends. It may be scaled in the {y} dimension as necessary. | |||
|- | |||
| '''axl3hol9.dat''' || '''Technic axle hole semi-reduced - tooth inner edges''' | |||
|- | |||
| [[File:Axl3hol9.png|200px|thumb|alt=Axl3hol9]] | |||
||This primitive produces the inner edges of the semi-reduced "plus-shaped" technic axle. | |||
|- | |||
| '''axl3ho10.dat''' || ''' Technic axle hole semi-reduced - tooth surface''' | |||
|- | |||
| [[File:Axl3ho10.png|200px|thumb|alt=Axl3ho10]] | |||
|| This primitive used to produce the fill the "plus-shaped" cross section of a semi-reduced technic axle to the bounding circle. | |||
|- | |||
| '''axl3end.dat''' || '''Technic axle hole semi-reduced - end surface''' | |||
|- | |||
| [[File:Axl3end.png|200px|thumb|alt=Axl3end]] | |||
||This primitive is used to produce the "plus-shaped" cross section of a technic axle hole semi-reduced. | |||
|} | |||
{| class="wikitable" | |||
|+ | |||
===Special Technic axle primitive=== | |||
|- | |||
| '''axlebeam.dat''' || '''Technic Axle Truncated to fit Technic Beam End Surface''' | |||
|- | |||
| [[File:Axlebeam.png|200px|thumb|alt=Axlebeam]] | |||
||This primitive produces the tip of an axle to be used between a cylinder of 9 LDu radius and an axle primitive. | |||
Usage example:<br> | |||
1 16 0 0 -10 9 0 0 0 0 -9 0 20 0 2-4cyli.dat<br> | |||
1 16 0 0 0 1 0 0 0 1 0 0 0 1 axlebeam.dat<br> | |||
1 16 0 -20 0 1 0 0 0 10 0 0 0 1 axlehol8.dat | |||
|- | |||
| '''axlesphe.dat''' || '''Technic axle - truncated to fit ball joint''' | |||
|- | |||
| [[File:Axlesphe.png|200px|thumb|alt=Axlesphe]] | |||
||This primitive produces the tip of an axle, truncated to fit a 12.81 LDu radius sphere. | |||
Usage example:<br> | |||
1 16 0 0 0 12.81 0 0 0 0 12.81 0 -12.81 0 8-8sphe.dat<br> | |||
1 16 0 0 0 1 0 0 0 1 0 0 0 1 axlesphe.dat<br> | |||
1 16 0 -20 0 1 0 0 0 7.19 0 0 0 1 axlehol8.dat | |||
|- | |||
| '''axles.dat''' || '''Axle Sloped''' | |||
|- | |||
| [[File:Axles.png|200px|thumb|alt=Axles]] | |||
||This primitive produces the tip of an axle, truncated by a slope with the height of 1 LDu. It may be scaled in the {y} dimension as necessary. | |||
|- | |||
| '''axlecap.dat''' || '''Axle Endcap''' | |||
|- | |||
| [[File:Axlecap.png|200px|thumb|alt=Axlecap]] | |||
||This primitive produces the beveled tip of an axle. | |||
|- | |||
| '''axlecaph.dat''' || '''Axle Endcap with Hole 4D''' | |||
|- | |||
| [[File:Axlecaph.png|200px|thumb|alt=Axlecaph]] | |||
||This primitive produces the beveled tip of an axle with a center hole of 2 LDu radius. | |||
|- | |||
| '''axlecaph2.dat''' || '''Axle Endcap with Hole 5D''' | |||
|- | |||
| [[File:Axlecaph2.png|200px|thumb|alt=Axlecaph2]] | |||
||This primitive produces the beveled tip of an axle with a center hole of 2.5 LDu radius. | |||
|- | |||
| '''axleconnect.dat''' || '''Technic Axle to Connector Hole Perpendicular Joint 0.5''' | |||
|- | |||
| [[File:Axleconnect.png|200px|thumb|alt=Axleconnect]] | |||
||This primitive produces a right angle connection between an axle and a Technic connector hole. | |||
Usage example:<br> | |||
1 16 0 0 0 1 0 0 0 1 0 0 0 1 axleconnect.dat<br> | |||
1 16 0 0 0 -1 0 0 0 1 0 0 0 1 axleconnect.dat<br> | |||
1 16 0 0 0 1 0 0 0 1 0 0 0 1 connhole.dat<br> | |||
1 16 0 0 -30 0 0 -1 -1 0 0 0 20 0 axle.dat | |||
|} | |} | ||
Revision as of 08:07, 6 December 2023
LDraw Primitives Reference
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.
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
Technic primitives



















































































































