Creating Lego models with LDraw, Part 2: Model creation and MPD file structure

Back to overview

Are you into Lego? In this tutorial series, LDraw veteran Nathanel Titane introduces us to the different LDraw tools and shows how you can easily construct your own LEGO models and publish them to Sketchfab!

There are four articles in this series:

So now that you’ve downloaded the LDraw official parts library and chose the editor to work with, we are ready to begin.

For the purpose of this tutorial, and for consistency’s sake, given the variety of operating systems available, I will be using LeoCAD as the reference editor. It is readily available or can be built for all three majors OSs (Mac, Linux, Windows). It also has the advantage of having a highly modular panel-based interface, which you can customize to your liking or to your hardware’s content via the preferences or by dragging the various tool modules to wherever you would like them to be.

Note: That being said, don’t be alarmed at the various interface setups you will be greeted with on this tutorial, as I showcase the best possible view of a model to better help you understand what goes on as the model is being built. I usually reserve a whole screen to the 3D plane and have all the other panels on a separate monitor (or off screen according to where I’m at in the build).

“What will I do with this?” you might ask. Well, you can let your inner child come out and have fun by creating odd builds or make excellent use of the LDraw system while still being creative.

LDraw truly reveals its power when you want to either plan a build whether it be simple or complicated, and have it prototyped before even engaging the physical build process with actual Lego parts. In turn, such a step can also help you plan out your purchases by generating the needed parts list for the model and eventually acquiring them through the Bricklink online purchase system.

Another way to go at it would be for record keeping: whether it be lack of available parts for new builds or simply keeping track of the amount of models you’ve made so far (^___^ hehe!) and have them displayed online (wink wink), the LDraw system is a great tool to master, enabling you to do so.

I personally use LDraw for both scenarios quite frequently. As soon as the model I am building or planning has been completed (physically or as a virtual prototype reference), I start over from scratch, in 3D, to properly assemble the parts, in actual building order and archive the model for future reference or instruction editing purposes using LPub (see example here).

Basics and file structure:

The way a model can be built in any of those editors is basically the same: the editor parses your downloaded library and any other individual parts you might have gotten that do not have the ‘official’ status yet, and makes them readily available to use on a drag and drop basis from within the editor.

Each editor enables you to create your model within a virtual 3D space (similar to any other 3D editing software, abiding by most of the standards you would be greeted with if you already have any such experience with those).

From within the editor window, you can assemble multiple parts the same way you would while building a physical model by dragging any part from the list and dropping it onto the virtual plane. And so, the fun begins….

When assembling parts, you can easily change their attributes (orientation, color, grouping) via toolbar buttons or keyboard shortcuts, individually or by groups according to how a given editor handles such properties.

Now all this is fairly easy and straightforward: when you choose to go with this type of approach, you can still somewhat easily manage to create simple or even oddly complex models, comprised of a few hundred parts while still having it all contained into a single file.

You can use the provided tools to restrict parts and other elements into groups to better manage your model and it’s components into intricate assemblies. Such a model file, would by default carry the ‘ldr’ file extension: life is beautiful…

Now, what happens when you have a build that easily surpasses the 1000 parts count?
What happens when your build is of humanoid shape, has several accessories, gimmicks and pew-pews of all sorts? What happens when you need to manage that same build in order to easily update its parts, or change some part of it without altering the rest of the model? What happens when you want to create a variety of other models (5, 10, 20 30 or more) based on the same exact frame used in that initial build, without going through the trouble of repositioning absolutely all of its components every single time?

I think you get the idea of where I’m trying to go with this… To simplify all of this and help you build better we will be talking about the golden treasure of the LDraw system: the multipart file scheme.

This file type carries the ‘mpd’ extension.How it works is fairly simple, and is a treasure to any avid builder when using the LDraw system.

The multipart file structure, as its name implies, is an LDraw file type that uses multiple ldr files that are individually imported into the project. They constitute the essential components of your build and can then be set up (orientation and assembly) in relation to one another. The mpd file considers the imported ldr sub-models as parts! The main model (normally the first one in the list as per the specification) in the mpd file is what will be seen and parsed as your finished model, and within which the main elements and components of your build should be inserted.

Having this sort of tool in our possession and understanding how it works is paramount.
So, to sum it up, if you are trying to build a really complex model, you would have to create all its essential components as separate, individual ldr files.

Once they are all generated, you import them into a new project, one by one, duplicating the symmetrically needed ones and modifying the needed parts placement for such a result (ex.: ‘Right Arm’, ‘Left Arm’, which are essentially one and the same model, exported twice, one of which has been symmetrically modified to still be ‘build independant’, giving it its own set of properties). You then save the newly created project file as ‘WhateverYourModelNameIs.mpd’ and you are all set!

Positioning and referencing then becomes a breeze as you can then just drag/drop or insert the necessary sub-model component into the other sub-model that requires it (ex: Foot to Shin, Shin to Thigh, Legs to Waist, etc.)

Once all the component’s dependencies have been met and all the submodels are in place as you wish them to be (positioning, rotation), you then head back to the first model within the list. Up to now, you shouldn’t have added anything within this specific model and the plane should be blank. You then select and insert the main sub-models, in a centered and presentable fashion, that will be defining the actual build you have just completed. In most cases (for me at least), those are the Waist, Torso and Weapons/Accessory models.

So I leave you to explore, try new things and mostly have fun with this newly found addiction. I hope you will have enough time to go about and attempt at least one build to be ready for part 3: Complex positioning and renders!

LEGO® is a registered trademark of the LEGO Group. LDraw is a trademark owned and licensed by the Estate of James Jessiman.

Reproduced with permission from Nathanel Titane’s blog. Find the original article here:
Creating Lego models with LDraw, Part 2: Model creation and MPD file structure

About the author

Sketchfab Team

Leave a Reply

Your email address will not be published. Required fields are marked *

    Related articles