HBM004: LDraw Tutorial (IV)


 

LDraw Tutorial (IV)

LDraw

In this part of the LDraw tutorial you will discover an easy way to avoid mixing official and unofficial parts as well as learn the basics of the flexible part generator LSynth

 

Text and pictures by Jetro

 

Keeping unofficial parts separate from the official ones In a previous part of this tutorial I explained how to find and include parts that are not officially available.

There is a way to keep these unofficial parts separate from the official ones and still have them available in MLCad, but it requires making some minor adjustments, as well as including the unofficial parts inside the MPD file(which is recommendable anyway if you are going to use unofficial parts).

You will need to edit the MLCad.ini file which can be found in the installation folder of MLCad (typically C:\LDraw\Apps\MLCad\MLCad.ini). It is a plain text file with a large help section. Towards the end of this file you will find the following lines:

[SCAN_ORDER]

1 = SHOW Parts

2 = HIDE Parts\s

3 = HIDE P

4 = HIDE P\48

These lines indicate where MLCad should look for parts (within the LDraw folder in Parts, Parts\s, P and P\48). If you download the full unofficial file package and extract it in C:\LDraw\Unofficial, you will need to add the following lines to make these parts visible to MLCad:

5 = SHOW Unofficial\Parts

6 = HIDE Unofficial\Parts\s

7 = HIDE Unofficial\P

8 = HIDE Unofficial\P\48

The next time you open MLCad the parts contained in the Unofficial folder will be included in the parts tree. However, they will only be available to MLCad! That means that if you wish to render the file using a tool like LDView you will have to include the unofficial parts inside the MPD file of your construction. This can be done using a tool like MPDWizard[1] as described in the second part of this tutorial[2].

LSynth: flexible parts

In the previous part of this tutorial we saw how to generate a simple belt with the Belt Generator which is included in MLCad. However, this tool can’t be used to generate more complex belt configurations or to generate other types of flexible parts. To this end LSynth was created by Kevin CLague. This tool can be use directly, but it is easier to use it through the MLCad interface.

If you have installed the complete package of LDraw tools available at LDraw.org[3] in all likelihood MLCad is correctly configured for LSynth. In case you it can’t find LSynth, you’ll need to edit the MLCad.ini file to tell MLCad where to look for LSynth. Under the heading [LSYNTH] you will need to indicate the path to this application. By default the path is the following:

%PATH =C:\LDraw\Apps\LSynth

LSynth allows you to synthesize 11 different types of flexible parts which can be organized in two groups:

1) Cable and tube types

These parts are synthesized using constraint parts that indicate their location in an LDraw file. The most important one is LS00.DAT “~LSynth Constraint Part” [Fig. 1]. This part is used to indicate where a flexible part starts and finishes as well as any intermediate points. Additionally, the ridge of the piece is used to indicate the direction of the width of the cable.

This group includes the following types [4]:

ELECTRIC_CABLE

FIBER_OPTIC_CABLE

FLEX_CABLE

FLEX_SYSTEM_HOSE

FLEXIBLE_AXLE

PNEUMATIC_HOSE

RIBBED_HOSE

LDraw

 

Basically they are all synthesized in the same way, but in the case of the FIBRE_OPTIC_CABLE there is a part to draw the start of this cable (LS30.DAT – Technic Fiber Optic Cable – large end). The same is true for the end of the FLEXIBLE_AXLE (LS40.DAT – Technic Axle Flexible – end piece).

2) Belts, treads and closed chains

This group of parts is defined with the help of the elements around which they are placed. This means there is a large selection of gears and pulleys to choose from.

CHAIN (gears)

PLASTIC_TREAD (gear)

RUBBER_BAND (pulleys)

RUBBER_TREAD (sprockets)

 

The helper parts can be divided into three groups:

• Gears [Fig. 2] (73071, 6573, 4019, 6542, 3648, 60C01, 3650A, 3649 y 2855)

• Sprocket wheels [Fig. 3] (32007)

• Pulleys [Fig. 4] (3736, 4185, 2983, 4265A, 4265B, 4265C, 3713, 2736 y 50)

 

In the case of the gears you need to be careful to select which parts you choose as guides since not all gears of the same appearance work (of the several types of Crown gear that exist only one – 4265A – works whereas 4265B doesn’t). Something similar happens with the Technic Bush ½ (You can use 4265A, B and C but not 6577 or 32123).

Using LSynth

In order to use LSynth inside and ldr or mpd file you need to insert a number of commands which LSynth will recognize and interpret to synthesize the parts according to the specifications. The minimum LSynth command block looks as follows:

0 SYNTH BEGIN typo colour

guide

guide

0 SYNTH END

In the type field you need to indicate which of the above mentioned flexible parts you wish to synthesize (CHAIN, ELETRIC_CABLE, …).

The colour field indicates the colour of the synthesised part. The number corresponds to the colour numbers used in LDraw. In MLCad you can easily see these numbers clicking on the M in the colour bar and placing the pointer over the colour of your choice. In order to edit an LSynth command you can simply double click it.

The filed guide corresponds to the guide or constraint parts that will mark the path of the flexible part as well as its horizontal orientation. Additionally you can add commands to control the path of a belt/tread/chain part more precisely.

 

LDraw

 

In order to synthesize a cable or tube, you simply need to insert the appropriate LSynth commands into the LDraw file. In MLCad this can be done through an icon in the “Expert” bar o through the menu “Extras > LSynth > Add Command...”. From the dropdown menu in the window that opens you need to select the type of part you want to synthesize, after which three lines are automatically added to the file. Apart from the SYNTH BEGIN and SYNTH END lines mentioned before the line SYNTH SHOW is added. Parts included after this statement are supposed to stay visible after running LSynth, but this behaviour appears to be malfunctioning. In order to see the guide parts after running LSynth you will need to go to “Extras > LSynth > Show all” or the corresponding icon in the extras bar.

After inserting the necessary guide parts between SYNTH BEGIN and SYNTH END, taking great care that the parts appear in the order LSynth should handle them, you simply need to run LSynth (either from the corresponding menu entry or clicking on the icon). MLCad will ask if you want to save the changes you’ve made to the file in case you haven’t saved it after the last modification, after which

LSynth will run. Since LSynth really is a command line tool, you will very briefly see a window with black background executing LSynth and then the flexible part will appear in your file. If for some reason the result isn’t what you hoped it would be, you simply need to reopen the file you are working with without saving the changes or erase everything that appears from the line SYNTH SYNTHESISED BEGIN till SYNTH SYNTHESISED END.

In the case of belts, treads and chains it may be necessary to include additional commands to get the desired geometry. By default, LSynth will connect the guide parts (gears, pulleys etc.) counter clockwise and trying to connect all the guide elements inside the flexible part. When connecting two pulleys the default result will be what you can see in figure 5. However, if you want to get a shape like figure 6 you will need to inform LSynth of this change. There are three commands that can help you do this: CROSS, OUTSIDE and INSIDE.

In order to get the result you see in figure 6 you will need to put the left pulley in first place, then inform LSynth the belt needs to CROSS, place the second pulley and again indicate a CROSS: the CROSS command always comes in pairs. The same result may be obtained using INSIDE and OUTSIDE. These two commands always appear in pairs as well. The sequence of elements would be: pulley, OUTSIDE, pulley, INSIDE.

LDraw

When there are more than 2 pulleys things get a little more complicated, but the logic is the same. In order to obtain the result you see in figure 7 the lines need to be placed in the following order: green pulley, red pulley, OUTSIDE, blue pulley, INSIDE. Just like a belt is a part without a beginning or an end, this sequence can start at any point as long as the order of the lines doesn’t change. Keeping this in mind, would you be able to write the sequence for figure 8? [5]

 

Bibliography:

LEGO® Software Power Tools, chapter 7 "LSynth: A Bendable Part Synthesizer" por Kevin Clague, edit.Syngress.

"Setup and tutorial for running LSynth through MLCad" http://www.holly-wood.it/lsynth/tutorialen. html

Ldraw.org

[1] http://www.pobursky.com/print.php?sid=33

[2] The second part of this tutorial appeared in HispaBrick Magazine 002 which is only available in Spanish. However, the tool is very intuitive. If you wish to include unofficial parts in an MPD it is best to first extract the MPD using the second tab and then create a new MPD using the option “Choose official files over unofficial files”. After creating an MPD including files with this tool you may wish to open it again in MLCad and change the order of the models (go to Multipart > Model Sequence) so that the unofficial parts and sub-parts are at the end of the list.

[3] http://www.ldraw.org/Article126.html

[4] There is an eighth part type in the LSynth dropdown menu named RIGID_HOSE, but it appears this cannot be used to generate flexible parts.

[5] Red, CROSS, black, CROSS, green, OUTSIDE, blue, INSIDE. ■

..