Difference between revisions of "MPD"

From LDraw.org Wiki
Jump to navigation Jump to search
m (Owen Burgoyne moved page Multi Part Dats to Multi-Part Document: Corrected name as per official LDraw standard.)
(Updated with information from LDraw.org)
Line 1: Line 1:
'''Multi Part Dats''' or '''MPDs''' for short, are an official extension of the LDraw specification. They are, in a nutshell, multiple LDraw files within one file.
+
'''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.
  
==Creating MPDs==
+
==Structure==
 +
 
 +
The MPD file uses 2 META Commands, only one of which is commonly used. The common statement is <code>0 FILE</code>, the less common statement is <code>0 NOFILE</code>.
 +
 
 +
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 <code>0 NOFILE</code> 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 <code>0 FILE</code> statement will be discarded. It is considered to be an error for any LDraw code (other than comment lines) to appear before the first <code>0 FILE</code> statement. Also, no LDraw commands should appear after a <code>0 NOFILE</code> statement, and before the next <code>0 FILE</code> 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 <code>stud.dat</code> in your MPD file, don't be surprised to see your <code>stud.dat</code> file appear on the top of every single brick in your scene.
 +
 
 +
==MPD META statements==
 +
 
 +
===FILE===
 +
Format: <code>0 FILE <model></code>
 +
 
 +
Where:
 +
<code><model></code> is the name of the following LDraw file.
 +
 
 +
===NOFILE===
 +
Format: <code>0 NOFILE</code>
 +
 
 +
There are no options or parameters.
 +
 
 +
==Creating MPD files==
  
 
To create a MPD file the following approaches may be useful.
 
To create a MPD file the following approaches may be useful.
Line 18: Line 45:
  
 
===MLCad===
 
===MLCad===
MLCad can be downloaded from [http://www.lm-software.com/mlcad/ lm-software.com].
+
If you already have the files and just wish to combine them you can join them together in [[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
 
If you wish to create an MPD as you edit you may
Line 30: Line 55:
 
#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.
 
#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]]===
+
===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.
+
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.
  
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]
 
[[Category:Mac]]
 
[[Category:Mac]]
 
[[Category:Windows]]
 
[[Category:Windows]]
 +
[[Category:File formats]]

Revision as of 09:27, 17 January 2015

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.

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.