Skip to content
LDraw command line utilities
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

git:ldraw | L2CU
LDraw Linux Command line Utilities (L2CU)

This project aims at providing user running Linux-based distribution with the tools to handle LDraw related batch operations on multiple models and/or project files at a time.

It is mostly centered around the use of the BASH shell and opearates using minimal dependencies.

The utilities verify the presence of the required applications and other dependencies before proceeding but the user may wish to build or install the following requirements prior to using these scripts for a more streamlined experience:

L2CU is split into 5 utilities that each handle a specific task, or set of tasks relative to a type of operation relative to the LDraw parts system or LDraw based digital Lego models (ldr) or model assemblies (mpd).

[make-list] (

'make-List' was built as a need to replace the 'mklist.exe' utility that is found and packaged with the base LDraw package. It serves the exact same function, which is to 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 either parses and sorts the content of that directory by part number or by description. 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 such a text based index to parse the Ldraw parts directory contents.

[model-export] (

'model-export', as its name implies, serves as a batch LDraw model file exporter, that can generate (with the use of leocad and blender) 3ds, wavefront (as obj and mtl within a zip archive) and blend compatible and optimized 3D files of the selected LDraw model(s).

Those exported formats can be used to then upload the models online for showcasing or presentation, using WebGL based services such as Sketchfab.

[model-modify] (

'model-modify' serves as a bulk editing tool to enable batch editing and modification of LDraw based digital Lego model files and projects.

It can be extremely helpful in the case of massive model updates or adjustments that would normally be done manually through the LDraw model editor.

It uses stream editing to find and replace the appropriate string elements from the known syntax of the LDraw file specification.

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

  • modify any specific color for another (color option)
  • modify any specific part for another (part option)
  • modify the color of a specific part to any other color for that same part (bind option)
[model-render] (

'model-render' enables the user to generate preset high defintion renders of the selected LDraw model files or projects (using ldview) as the main rendering engine.

The user is required to specify the latitude and longitude parameters of the camera as well as a file saving suffix to register the coordinates as a viewing angle to the file name:

Defaults (as array): coordinates=("latitude,longitude") view=("Current View File Suffix")

coordinates=( "30,-135" "30,45" "30,180" "30,0" )

view=( "Quarter Back" "Quarter Front" "Back" "Front" )

Please refer to LDView's help manual to get you started on setting up your LDview/ldview preferences to generate the renderings using the visual settings and angles of your choice.

[model-upload] (

'model-upload' is a complementary utility to 'model-export'. It enables the user to batch upload the exported and optimized 3D formats to [Sketchfab] ( for public or private hosting and viewing of the selected models.

This utility is extremly useful in the case of multiple unique model uploads (new) or model updates, which would normally take minutes per model, and thus making several updates or uploads a daunting task.

The user must already be registered to the Sketchfab services and obtain the [API token] ( needed to enable communication with the hosting servers, for uploading, updating and setting environment and camera parameters to the uploaded files.

The utility also warns of the limitation of free subscription accounts: the model file size limit is set to 50Mb. If and when possible, the exported format will be compressed to limit the file size and prevent any errors while uploading.

An example of the output from both 'model-export' and 'model-upload' can be seen [here] ( the models are optimized and fused single-object blend files exported from either mpd or ldr formats and uploaded or updated on a regular basis.

Bug reports and enhancement requests are welcome :)

Feel free to follow developments and new model builds at my [Blog] ( or follow the [Sketchfab Blog] ( for Sketchfab/LDraw tutorials and editorials!

You can’t perform that action at this time.