Take the 2-minute tour ×
LEGO® Answers is a question and answer site for LEGO® and building block enthusiasts. It's 100% free, no registration required.

Sorry if this is kind of a dumb question, but do LDraw files describe models (with translation and rotation values with references to bricks contained in other files), or do they describe the bricks themselves (such as the individual vertices, lines, polygons, etc.)? Or do different LDraw file types work in different ways?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

Both, often in the same file.

If you take a look at the .ldr file format specification you can see that each file is made up of an number of different types of "line", one of which is a Subfile Reference where you can specify the colour, position, rotation and scale of the model.

Other lines can then be added to describe Lines, Triangles, Quadrilaterals and Optional Lines, which are specified by their individual vertices.

For example, the 1x1 Brick [part:3005] has the following non-comment lines (I've added comments to show what it's doing):

0 Author: James Jessiman
0 !LICENSE Redistributable under CCAL version 2.0

0 // Meta line, causes the next line to be drawn "inside-out", to make 
0 // the inside of the brick.
0 // Followed by a subfile reference for a "box with 5 faces".
0 BFC INVERTNEXT
1 16 0 24 0 6 0 0 0 -20 0 0 0 6 box5.dat

0 // Draw 4 quadrilaterals to fill in the edges of the base of the brick
4 16 10 24 10 6 24 6 -6 24 6 -10 24 10
4 16 -10 24 10 -6 24 6 -6 24 -6 -10 24 -10
4 16 -10 24 -10 -6 24 -6 6 24 -6 10 24 -10
4 16 10 24 -10 6 24 -6 6 24 6 10 24 10

0 // Draw another 5 sided brick for the outside of the brick
1 16 0 24 0 10 0 0 0 -24 0 0 0 10 box5.dat

0 // Draw a stud on the top using the "stud" subfile.
1 16 0 0 0 1 0 0 0 1 0 0 0 1 stud.dat

Common subfiles include the studs and tubes on bricks.

When you save a model in MLCad or similar as an .ldr file it's basically all Subfile lines.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.