l2cu

l2cu

Donate

[ L²CU // Project Page ] [ Version // 2026-10-06 ]


Welcome to L²CU

L²CU uses Frobulator to streamline the scripts and make redundant code a thing of the past.

L²CU (The LDraw Linux Command line Utility) stems from a set of independent scripts written over the last few years to respond to an obvious need for efficient management of LDraw model files in several ways, with bulk editing being one of them.

Most older and even more modern editors miss that mark to provide such features and that is where L²CU tries to fill the gap in a simple, user-friendly way.

What can it do?

L²CU supports the standard LDraw model file extension (ldr), the multi-part document (model assembly) file extension (mpd) and the LDraw part file extension (dat).

In short, with L²CU you can:

You can also tweak or rework the utility’s functions to match your preferences.

How does it work?

LDraw model files (ldr, mpd and even dat) are plain text files, thus making them stream edit friendly:

L²CU is a shell script (BASH) that parses and modifies the text in the model file to get the job done. It is optimized for portability and uses a very minimal set of dependencies to get the job done.

Every model found in the selected directory (and its subdirectories) is processed - paths containing spaces included.

What does it need?

On startup, L²CU verifies the presence of necessary dependencies before proceeding and processing the user’s change request(s). Missing dependencies are installed on request - privilege escalation is only asked for when something is missing.

You will need:

Usage

Usage: ./l2cu [EXTENSION] | [OPTION] [PARAMETER]

-d, --directory       Specify [d]irectory to load models from.
-f, --file            Specify model [f]ile extension to work on.                      [ all | dat | ldr | mpd ]
-e, --export          Run model file [e]xport.                                        [ csv | 3dstudio | collada | blender | wavefront ]
-r, --render          Run model file [r]endering.                                     [ full | flat | wireframe | overlay | social | thumbnail | 0 - 7 ]
-i, --instructions    Generate model [i]nstruction file.                              [ pieces | samples ]
-m, --modify          Run model file [m]odification.                                  [ lint | color | part | bind | step ]
-o, --overwrite       Write modifications to the [o]riginal model file.
-w, --download        Run do[w]nload of the LDraw parts library.                      [ official | unofficial ]
-l, --list            Generate the LDraw parts [l]ist for use with legacy editors.    [ description | number ]
-h, --help            Show [h]elp and usage information.

Examples ↴

bash l2cu --file mpd --render full --directory ~/models
bash l2cu --file ldr --export collada --directory ~/models
bash l2cu --file mpd --modify step --directory ~/models/work-in-progress

Without a directory or file extension, L²CU asks for them - defaults are the current directory and mpd files.

‘render’

The render function generates preset, high definition renders of the selected LDraw model files or projects (using LeoCAD to process the renders).

Renders are saved under each model’s ‘renders’ directory:

View presets (latitude / longitude):

preset latitude longitude
0 30 0
1 30 45
2 30 90
3 30 135
4 30 180
5 30 225
6 30 270
7 30 315

You can refer to the LeoCAD help manual to get you started on setting up your editing and rendering preferences.

‘export’

This function serves as a 3D standard file exporter. It can generate (with the use of LeoCAD and/or Blender) the following formats:

Exports are saved under each model’s ‘exports’ directory - files above 25 MB are flagged for their loading times.

The model exports can be used for showcase purposes, displaying them online in personal or commercial galleries (uses WebGL: Three.JS)

Examples:

‘instructions’

This function generates building instructions with LPub3D, based on a configuration framework (title, piece count, category and url are filled in for each model):

Models flagged with a ‘work-in-progress’ file receive placeholder samples instead.

‘modify’

Here is where the batch editing happens: this feature is extremely helpful when processing massive model updates and color or part adjustments that would normally be done manually through an editor.

The script parses the model files, using the LDraw file specification syntax as reference.

The user can modify any ldr or mpd file in one of five ways:

Colors can be entered by name, number or hexadecimal value - the official LDraw colors are listed when no match is found.

Only the part and submodel lines that match the request are rewritten - every other line is kept as is, line endings included. Stray ‘ . . .’ tails left on meta lines by earlier versions of L²CU are repaired along the way.

Modifications are written to a timestamped copy of the model file (‘[model]-modified-[timestamp].[extension]’) unless the overwrite option is selected.

‘download’

The ‘download’ function lets you download the LDraw parts library. This is especially useful for quick updates or if you’re getting started.

You can download:

LeoCAD reads the parts library archive directly - no extraction needed.

‘list’

The ‘list’ option was the initial project script that started L²CU over 6 years ago.

This (now) function was built as a need to replace the ‘mklist.exe’ utility that is found and packaged with the base LDraw parts library archive. It serves the exact same purpose: parse and generate an updated list of all the parts located under the main ‘LDraw’ directory (within ./LDraw/parts).

The user can create a list that sorts the parts in that directory either by part number or by part description. Moved parts are skipped - parts with descriptions starting with ‘_’ or ‘~’ are listed last.

This utility comes in handy with the use of editors or other LDraw related application that do not have the ability to generate their own parts index or that rely on the old text based index (parts.lst) to load parts into the editor (i.e.: MLCAD, which can be run using Wine when using Linux-based distributions).

More modern or cutting-edge editors now generate a cached dynamic index or database on startup and do not require the list generated by this function anymore.

To find examples that make use of L²CU, or to simply browse my models, you can visit my Blog which is hosted at GitHub as well.

Repositories:

Frobulator to streamline the scripts and make redundant code a thing of the past.

LeoCAD to export LDraw models into an exploitable 3D format via L²CU.

LPub3D to generate instructions out of the models submitted to L²CU.

Three.JS to create the viewer used to render and display my models on your web browser.

GNU/Bash as the shell environment on top of which the scripts function.

Reports:

Submit bug report or feature request

Projects:

GitHub Repo stars

GitHub Repo stars

GitHub Repo stars

GitHub Repo stars

GitHub Repo stars

GitHub Repo stars

GitHub Repo stars

GitHub Repo stars

GitHub Repo stars


[ L²CU // Project Page ] [ Version // 2026-10-06 ]

Enjoying L²CU? Buy me a coffee to show your appreciation!

Donate