Thursday, October 29, 2009

LDraw Tutorial - Part 2

Do you miss parts? In this second part of the tutorial you will learn how to solve this problem.

In the first part of this LDraw tutorial we had a look at the basic options of one of the fundamental tools in the LDraw universe: Mike’s LEGO CAD or MLCad, created by Michael Lachman toward the end of the 90s. Despite it being a relatively simple program to use it has many options that make it possible to create advanced constructions with the LDraw parts library.

If you have already started to tinker with LDraw, maybe trying to document your own MOCs you will probably have run into some minor problems. One of them no doubt related to the fact that you couldn’t seem to locate the part you need.


Increasing the LDraw library

Although there are thousands of parts in the LDraw library, after a basic install you will soon find you miss some parts. It is quite likely that the part you are looking for already exists for LDraw. So why isn't it in the library you have just installed? This is due to the fact that each year LEGO produces new parts, and although these parts are gradually translated to the LDraw format, the construction process and the approval of the new designs by the LDraw foundation take time.

For some time the LDraw foundation didn’t release new part updates due to some legal restrictions related to the ownership of the virtual part definitions, but finally towards the end of 2008 an update was released and this year 2 new part updates have been presented. More are bound to come out as time goes by*. You can find these updates on the LDraw.org website [1]. They come in two formats:

  1. A windows executable. Provided you didn’t change the location of the LDraw parts library on your computer it is as simple as downloading and double clicking on the file. You only need the latest version of this executable file as it contains the full library of official parts.

  2. A zip file. This file can be used on any OS. First you need to unzip the file in the appropriate location (for Windows directly in C:\LDraw – you can also extract it somewhere else and then cut and paste it into this location). After that you need to either run MKLIST.EXE (which is located in C:\LDraw) or tell MLCad to scan for new parts (File > Scan Parts). MKLIST.EXE will ask you whether you want to sort parts by [N]umber or [D]escription. Type “N” and hit enter. It will probably complain a couple of times about filenames that are too long, but all you need to do is hit enter until the window closes by itself.

Another reason why a part may not be available is that parts (and their subparts) must be certified (basically this is a quality inspection process) before they can be made available officially. However, many as yet uncertified parts are available as unofficial parts. As a general rule, these parts are well designed and won't give you any problems when building a model, but there is a minimal possibility that the parts may be revised later on so the LDraw foundation advises that you use these parts at your own risk. Since these parts may be altered before they are approved, it is good practice to include them in the designs they have been used in. You can use MPDWizard to do this in a very easy way, but more about that later on.

It is becoming standard practice not to mix unofficial parts with official ones, but rather to place them in a separate folder named “Unofficial”.

Both if you want a single unofficial part or would like to get all of them at once, the first step is to visit the LDraw website and more specifically the Parts Tracker. There you can download the individual parts you need or a Zip file with all the unofficial files. This file is updated regularly to include the latest additions and the changes/improvements that have been made in some of the existing files.

If you decide to download only the parts you really need you should follow these steps:
  • Locate the part you are looking for by typing its number in the search box at the top right of the Parts Tracker page and click 'Go' (for example 32030).
  • Once you have found the part right-click on the 'download' link you will find right under the name of the file you are going to download and save it in the location mentioned just before that name (in this case it says Unofficial File parts/32030.dat which means you should save the file in the ‘parts’ folder inside the LDRAW folder where you installed the library. It is becoming standard practice not to mix unofficial parts with official ones, but rather to place them in a separate folder. If you decide to do so make sure to read the paragraph below about the “Unofficial” folder.)
  • Check if the file has any dependencies by looking under the heading “Required (unofficial) subfiles” and save each of the files that appear under this heading in the location specified in the name. Some of the files may already be present in your installation, but you need to check and make sure (just download and overwrite).
  • Before you can start using the parts you need to update the list of parts of your LDraw. Traditionally this was done in MSDOS, but fortunately it is also possible to do so inside MLCad. To do so, open the application and go to File > Scan parts. It may take some time to do a complete inventory of the parts on your system, depending on how many parts you have and the speed of your computer. After that, a window will open informing you that new parts have been found and asking you if you want to write a new Parts.lst file. Click on 'yes'. You can now start to use the new parts.

If you decide to download the file that contains all the unofficial parts you will have to unzip it inside your LDraw folder and follow the last of the steps above.




A word of warning

If you keep official and unofficial files separate it may happen that after an official update is released some files are duplicated: once as unofficial and once as official. In rare cases an unofficial file may be an update on an official file that has not been re-released yet, but usually these duplicate entries mean you should clean up your unofficial files folders. Unless they contain elements that did not come directly from the parts tracker, you may want to completely purge these files and re-download the full unofficial zip-file which will have been updated to reflect the changes. Remember to re-scan your parts library every time you make a change to it.


The “Unofficial” folder

Because unofficial parts may change and sometimes use uncertified subfiles, it is a good idea not to mix them with official parts. To this end it is becoming standard practice to place unofficial files in a separate folder inside the LDraw tree. This folder contains a copy of the directory structure the official parts are placed in, which is the following:

C:\LDraw\P
C:\LDraw\P\48
C:\LDraw\PARTS
C:\LDraw\PARTS\S

So the unofficial files are stored in:

C:\LDraw\Unofficial\p
C:\LDraw\Unofficial\p\48
C:\LDraw\Unofficial\parts
C:\LDraw\Unofficial\parts\s

Before you can use the parts located in this “Unofficial” folder you need to inform MLCad of its existence. In order to do so you need to make a few small changes to the MLCad.ini file, that is located at C:\LDraw\Apps\MLCad. You can open the file with a text editor. Near the end of the file you will find the heading [SCAN_ORDER]. You need to add the following lines under this heading:

3 = SHOW Unofficial\Parts
4 = HIDE Unofficial\P

If the location of your LDraw folder is anything else than C:\LDraw you will have to substitute for the absolute path of the location of your installation.

Later versions of MLCad.ini already come prepared for this change and you may simply have to delete the semi-colon at the beginning of the line to enable the search path for MLCad. The numbers at the beginning of the line should be the next available numbers for the list in your MLCad.ini. For example, if you already have 4 lines, simply change the numbers to 5 and 6.


A note about part numbers

How to know what part you need? You probably know what the part looks like and you may have an idea of how it may have been named, but part numbers and names aren’t always that obvious. When you order a replacement part from LEGO you need to use the 7 digit part code you find in the inventory which is usually at the end of the first instruction booklet. However, this number identifies a specific part in a specific colour and this code is not used by LDraw where parts are not related to a specific colour. On some parts you may have seen a 4 or 5 digit number ‘engraved’ in the plastic. This is the number LDraw uses. If you can’t find the number of the part your best option is to go to Peeron or Bricklink and identify the part in the inventory of one of the sets that contains it. However, the naming conventions of Peeron and BL aren’t the same and neither is the part number in every occasion (this is especially true of older parts). To make matters worse, LDraw doesn’t follow either one of these conventions but rather has a convention of its own. In rare cases a part may have a different number in all three systems, but usually LDraw concords with at least one of the other inventory systems.



*) Upon announcing the second LDraw Parts update for 2009 Chris Dee mentioned there is a third update in the making – http://news.lugnet.com/cad/?n=16421

7 comments:

Conchas said...

Another great tutorial, Jetro!

I have a felling this, might turn useful for some here, quite soon... ;D

RjbsNXT said...

indeed Conchas :), I've already made use of it to learn how to clean out my unofficial parts folder :)

AVCampos said...

This is possibly the most important LDraw-related skill to develop, since there are so many useful parts not available on the base package!

When I see pictures of great MOCs on Brickshelf, I often get a little disappointed because there isn't an LDraw file to download and examine how it's built... possibly because of the rather steep learning curve of the LDraw tools. Now, thanks to your tutorial, hopefully more people will start sharing their great creations in a whole new way: the LDraw way.

Santeri said...

I'd like to stress a little bit more that unofficial part origin and orientation changes and renumbering does really happen - especially if the part is hold voted. If it is, be sure to check what's wrong with it (scroll down towards the bottom of the page and there will be the hold review in question) - if it says anything about bad orientation, origin or filename (or number), there's a quite big chance that this file will be altered in a way that if you don't include it in your model as Jetro pointed out, your model will break when the file gets changed again!

Also, keep in mind that you are not licensed to include any part not being CA (short for Contributor Agreement) compatible in your model! At this point there are some Non-CA parts in the Parts Tracker, such as the 32561c01.dat USB Camera is Non-CA. The competition cannon 32074c01.dat was too before I remodelled it for CA - as a result both the origin and orientation (and possibly in the future the filename) was changed and now any model that uses the cannon will be broken. (but the compo cannon a very rare case though and there's like a few parts being Non-CA anyway)

So - unofficial files are good, but use them on your own risk.

Jetro said...

Thank you for stressing this point. In a later part of the tutorial I will explain how to avoid your files getting broken due to changes in the unofficial parts you may have used.

jorhoerst said...

Just 1 question: why can't I find the mlcad.ini file? I've searched everywhere on my computer but no luck.

Jetro said...

The MLCad.ini file should be in the same folder as your MLCad.exe file.

If you really don't have it (or would like to use the latest version) you can get it here

Related Posts Plugin for WordPress, Blogger...



© 2007-2014 TechnicBRICKs
TechnicBRICKs contents may be sporadically updated, if the authors finds further relevant info about a certain post, or content/spell mistakes. Hence please don't be surprised if you find few changes at later visits, relative to a previous read.

TechnicBRICKs often shows other peoples' creations and/or images. We always try to credit the author(s) and link to their main publishing website, and if possible with their name in real life.
Since this is not always possible, we request that if you find something here that is yours or from someone you know, you leave a comment on the respective post and claim the authorship.

TechnicBRICKs is optimized for Firefox 16.0 and 1600x1200 resolution displays or wider.

LEGO® is a trademark of The LEGO Group of companies which does not sponsor, authorize or endorse this blog.
LEGO, the LEGO logo, the Brick and Knob configurations, the Minifigure and MINDSTORMS, are registered trademarks of The LEGO Group.
Original LEGO images are copyrighted by The LEGO Group and are used here in accordance with their fair play policy.
You can visit the official LEGO® website at www.LEGO.com.