Home :: Login :: Forgot Password :: Search :: FAQ
Support our host

News

Software

Reference

Community

Parts Library

About Us

Reference > Tutorials
Published By ahui on Sunday, September 07, 2003 - 02:59 AM

Printer-friendly page
.MPD (Multi-Part Dat) FILES
What are .MPD files
TOP
Multi Part Dat (MPD) files are an LDraw file that contains more than one LDraw file within it. This is done for a number of reasons, such as being able to create complex models by modeling each part of the model separately and having only one file instead of many for your model, to name a few. When you use a .MPD file you have several sub-models that are used to create the main model. Figure 1 shows you a model called mini_park.

Figure 1: Mini Park Image (Click on the image to enlarge)
The model in figure 1 is made up of several sub-models. The advantage of using sub-models is that instead of having to select and move ALL the parts associated with a sub-model you only have to select one item, the sub-model itself. In figure 1, the UPSP Mail Box contains 15 parts while the tree contains 24 parts. What would you like to move? 15 parts for the mail box or just 1?
How do I create a .MPD file?
TOP
This example uses MLCAD as the LDraw editor and Microsoft NOTEPAD for the text editor. Any LDraw & Text editor can create .MPD files.
Step 1 Open MLCad, create and save your sub-model. (Our example uses the following sub-models: LampPost-ModernVer1, PlanterTree-Fruit, and USPSBox.)
Step 2 Repeat step 1 for each additional sub-model you may have.
Step 3 Close MLCad and ensure that ALL your sub-models are located in the \ldraw\models\ sub-folder.
Step 4 Open MLCad to create the final model that will contain all the sub-models.
It is necessary to open/close MLCAD to ensure that MLCad memory cache gets cleaned out and you can "see" your models when click on the models group in MLCad.
Step 5 Create your main model with it's sub-models. To place sub-models in your main model click on the MODELS group in MLCad and drop & drag your sub-models from the preview panel into your model as shown in figure 2.
Adding sub-models to a model
Figure 2: Adding sub-models to a main model in MLCad (Click on the image to enlarge)
Step 6 Save your main model using the .LDR file extension. (Our example file is called Complete.ldr.)
Step 7 Open your main model in any text editor. Our example looks like this:

0 Name: complete.ldr
0 Author: Ahui Herrera
0 e-mail: jedi_agh@yahoo.com
0 http://www.geocities.com/jedi_agh/
0 Unofficial Model
0 ROTATION CENTER 0 0 0 1 "Custom"
0 ROTATION CONFIG 0 0
1 2 -10 0 20 1 0 0 0 1 0 0 0 1 3865.DAT
0 STEP
1 2 -110 -8 40 1 0 0 0 1 0 0 0 1 PlanterTree-Fruit.ldr
1 2 90 -8 40 1 0 0 0 1 0 0 0 1 PlanterTree-Fruit.ldr
0 STEP
1 2 -20 -8 30 1 0 0 0 1 0 0 0 1 UPSPBox.ldr
1 2 -10 -48 80 1 0 0 0 1 0 0 0 1 LampPost-ModernVer01.ldr
0
Step 8 Save your file in the text editor as <filename>.mpd. Ensure that your text editor does not place a .TXT at the end of your file. You may need to change the "SAVE AS TYPE" during the save process from .TXT" to "ALL FILES" If your text editor saves your file as <filename>.mpd.txt just rename it to <filename>.mpd. Our example is called mini_park.mpd.
Step 9 In order for LDraw to understand .MPD files a comment line MUST be placed at the top of each line BEFORE the actual file. This comment line is as follows:

0 FILE <filename>

For our example of complete.ldr it would be:

0 FILE complete.ldr
0 Name: complete.ldr
<...the rest of the file...>

Ensure that the FILE <filename> is EXACLTY THE SAME as the <filename> on the second comment line called Name.
Step 10 So in order to combine the 3 sub-models into the .MPD file, for our example, you would add the comment line to each file and then copy & paste into the mini_park.mpd file.

Our mini_park.mpd would look like this:

0 FILE complete.ldr
0 Name: complete.ldr
<...code for model...>
0
0 FILE PlanterTree-Fruit.ldr
0 Name: PlanterTree-Fruit.ldr
<...code for model...>
0
0 FILE LampPost-ModernVer01.ldr
0 Name: LampPost-ModernVer01.ldr
<code for model>
0
0 FILE UPSPBox.ldr
0 Name: UPSPBox.ldr
<...code for model...>
0
Step 11 Save and close your file.
Step 12 In order to test your model you need to delete or remove all the sub-models from the \ldraw\models sub-folder.
You need to do to ensure that the .MPD file is working correctly. If there is an error is the .MPD file and you also have the sub-models in the SAME folder your LDraw editor will NOT detect the error.
This is because your editor will use the sub-model OUTSIDE of the .MPD file as a reference.
Step 13 Open your .MPD file to see if it works properly.
How do I create a .MPD file - the easy way
The steps above show you the fundamentals of creating a .MPD file. However, 3rd party LDraw applications now make it easier than ever in creating .MPD files. One such application is LPub (http://www.users.qwest.net/~kclague/LPub/). LPub is capable of creating a .MPD file with the click of a single button!
Step 1 Place all your submodels in the same location. In our example we placed the sub-models: LampPost-ModernVer1, PlanterTree-Fruit, USPSBox and Complete.ldr in C:\ldraw\models.
Step 2 Open LPub (version 2.1.0.8 or higher) and load your final model by clicking on file -> Open LDraw File, in our case complete.ldr
Step 3 Click file -> Save as MPD and LPub will create your .MPD file!
Common Mistakes
TOP
If MLCad gives you an error like saying that “a model can not be found” or your model is missing sub-models the common mistake it that you had a spelling mistake in your .MPD file. Make sure that the comment line has THE SAME name and the file name.
Tips for Big .MPD Files
TOP
If you create a big enough .MPD file with many submodels you may noticed that when loading your file into MLCAD it might take a while to load especially if your first model is the final completed version. To help in speeding up the upload time you can create a blank sub-model file as your first sub-model in your .MPD file. What are we talking about you say? Look at our revised park model and notice that when first uploaded in MLCAD you will see noting! This first blank file is a good canidate for general comments about your .MPD file and/or model.

Help Desk Tutorial: .MPD (Multi-Part Dat) Files
Version 1.2
Created by Ahui Herrera, LDraw Help Desk
http://www.ldraw.org/



Recipient 2007
Kevin Clague

Want to learn more about LDraw? Check out the following books:




Current Contest Winners

Model of the Month


Scene of the Month



Vote for Next Month's Winner

Submit Your Creation for Next Month's Contest

What's new in lugnet.cad?

Re: Blender to LDraw exporter (Blend2Dat v0.2)
by Stefan Garcia - 27 hours ago

Re: Blender to LDraw exporter (Blend2Dat v0.2)
by Philippe Hurbain - 34 hours ago

Re: Blender to LDraw exporter (Blend2Dat v0.2)
by Stefan Garcia - 2 days ago

58231.DAT Slope 33 3 x 6 is wrong type
by Lutz Uhlmann - 3 days ago


There are 56 unlogged users and 0 registered users online.

You can log-in or register for a user account here.





 


 Log in Problems?
 New User? Sign Up!

©2003-2008 LDraw.org, see Legal Info for details.
LDraw™ is a trademark owned and licensed by the Estate of James Jessiman
This website is powered by Peeron.com.

LEGO® is a registered trademark of the LEGO Group, which does not sponsor, endorse, or authorize this site. Visit the official Lego website at http://www.lego.com.
LDraw is a completely unofficial, community run free CAD system which represents official parts produced by the LEGO company.