1
0
mirror of https://github.com/kristov/ldraw2stl.git synced 2025-05-15 06:10:11 -07:00
ceade 3b042dbb4e Introduce an optional cache
With no cache:

    $ time bin/dat2stl --ldrawdir=ldraw --file ldraw/parts/11295.dat > 11295.stl
    real    0m1.857s
    user    0m1.764s
    sys     0m0.092s

    $ time bin/dat2stl --ldrawdir=ldraw --file ldraw/parts/11295.dat > 11295.stl
    real    0m1.834s
    user    0m1.786s
    sys     0m0.048s

With cache:

    $ time bin/dat2stl --cache --ldrawdir=ldraw --file ldraw/parts/11295.dat > 11295.stl
    real    0m1.084s
    user    0m1.044s
    sys     0m0.040s

    $ time bin/dat2stl --cache --ldrawdir=ldraw --file ldraw/parts/11295.dat > 11295.stl
    real    0m1.076s
    user    0m1.028s
    sys     0m0.048s
2025-03-22 13:29:00 +01:00
2025-03-22 13:29:00 +01:00
2025-03-22 13:29:00 +01:00

ldraw2stl

Convert LEGO LDraw files to STL, for super-sizing and 3d printing!!

  1. Locate the ldraw parts archive at getting started (note: the wget link below might go stale):
  2. Install LeoCAD so you can find your parts (optional)
  3. Make a note of the .dat file name in LeoCAD, and then run:
wget https://library.ldraw.org/library/updates/complete.zip
unzip complete.zip
bin/dat2stl --file ldraw/parts/3894.dat --ldrawdir ./ldraw > 3894.stl

Use the --scale argument to scale the part:

bin/dat2stl --file /usr/share/ldraw/parts/3894.dat --ldrawdir ./ldraw --scale 4 > 3894.stl

For a 4X scale one of those!

Windows users

A user reported that they were able to get the tool to work on Windows using Strawberry Perl. However, they encountered an issue that Powershell redirection under Windows will by default create a unicode file. Apparently STL readers interpret this as a binary file (because STL has both binary and ascii specifications) and fail to read it. To force ascii redirection use:

perl bin/dat2stl --file [part file] --ldrawdir [ldraw library] | Out-File -Encoding Ascii [output.stl]
Description
No description provided
Readme 66 KiB
Languages
Perl 100%