MPD

From LDraw.org Wiki
Jump to navigation Jump to search
MPD
Filename extension .mpd
Internet media type application/x-multi-part-ldraw
Developed by The LDraw.org Standards Committee
Type of format Document file format
File format infobox

Multi-Part Documents, also known as MPD files, are a way to combine several LDraw files into one consolidated source. This allows for ease in posting or emailing a model made up of many subparts.

MPDs have previously been referred to as Multi-Part DAT files.[1]

Structure

The MPD file uses 2 META Commands, only one of which is commonly used. The common statement is 0 FILE, the less common statement is 0 NOFILE.

To create an MPD file simply include the code for each individual file in the MPD file. At the beginning of each file's text, insert a 0 FILE statement. This separates and names the files.

The end of each file, or just the last file in the MPD, may be marked with a 0 NOFILE line. The 0 NOFILE command is only required if the file's contents are followed by non-LDraw content (such as the poster's signature lines).

In order to support the inclusion of LDraw files in message systems (like email), any text lines before the first 0 FILE statement will be discarded. It is considered to be an error for any LDraw code (other than comment lines) to appear before the first 0 FILE statement. Also, no LDraw commands should appear after a 0 NOFILE statement, and before the next 0 FILE statement.

When an MPD file is used to store a multi-file model, the first file in the MPD is treated as the "main model" - all other files in the MPD will only be rendered if they are referenced by the main model, directly or indirectly.

So far, there are no clear scoping or namespace rules on MPD files. If you put a file named stud.dat in your MPD file, don't be surprised to see your stud.dat file appear on the top of every single brick in your scene.

MPD META statements

FILE

Format: 0 FILE <model>

Where: <model> is the name of the following LDraw file.

NOFILE

Format: 0 NOFILE

There are no options or parameters.

Creating MPD files

To create a MPD file the following approaches may be useful.

Manually

As per the LDraw.org MPD Language Extension, the beginning of each submodel in an MPD file (including the main model) is indicated by a meta command like this:

0 FILE model.ldr

where "model.ldr" is the name of the submodel. Submodels may optionally be concluded with the following meta command:

0 NOFILE

The first model in an MPD file is considered the main model.

MLCad

If you already have the files and just wish to combine them you can join them together in MLCAD.

If you wish to create an MPD as you edit you may

  1. Open MLCad.
  2. Go to the Multipart menu and select New File.
  3. Enter the name and details of the file.
  4. Begin editing.
  5. When you need a new submodel repeat steps 2-4.
  6. When you wish to include a submodel in your current model go to the Document section in the Part selection list to select the model.

Bricksmith

Creating MPD files is a natural part of building with Bricksmith. Select Add Model from the Model menu to create a new submodel, or select an existing submodel from the Insert Reference submenu to insert an instance of that submodel in the current model. All submodels are listed in the Model menu as well as in the File Contents drawer, where you can examine their contents hierarchically or rearrange them via drag-and-drop.

External links