Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

ldrawjs-utils

The build pipeline for the parts data of ldrawjs, a brick model editor that runs in the browser. It turns the official LDraw parts library into the files the editor loads: one 3D model and one picture per part, a searchable catalog, the colour table, and for each part the places where it connects to others.

Editor · Published data · Data repository · Data formats

How the parts data is made: the LDraw library and the LDCad Shadow Library go through three tools into the files that ldrawjs-db publishes

  • Three command-line tools, written in Rust, with three small dependencies between them (rayon, serde_json, png). No GPU, no browser and no network are needed once the libraries are downloaded.
  • Fast. The whole library, about 24,000 parts, is rebuilt in under two minutes on a laptop, the download aside.
  • Deterministic. The same input gives byte-identical output, with no timestamps in it, so a new release of the library shows up as a diff of what really changed.
  • Standard formats. Models are binary glTF 2.0 that pass the Khronos validator; everything else is PNG or JSON, specified below.

Contents

Quick start

Requirements

Rust A recent stable toolchain (1.77 or later).
curl, unzip, git For downloading the two libraries.
Node.js Only for --validate.
Disk About 800 MB for the libraries and 1.8 GB for the output.

Build everything

git clone https://github.com/ldrawjs/ldrawjs-utils.git
cd ldrawjs-utils
scripts/update-data.sh

The script downloads the LDraw library and the LDCad Shadow Library, converts every part, renders every thumbnail and works out every part's connectors.

Option
--skip-download Use the libraries already in data/ldraw and data/shadow.
--validate Also check every GLB with the Khronos glTF validator. Needs Node.js and takes a few minutes.
--help Show what the script does and these options.

What comes out

Everything lands in two folders, neither of which is committed:

data/
├── complete.zip        the LDraw library as downloaded (about 130 MB)
├── ldraw/              the library unpacked (about 620 MB)
└── shadow/             the LDCad Shadow Library (about 4,300 small files)

out/
├── parts/<id>.glb            one model per part (about 23,900 files, 1.3 GB)
├── thumbnails/<id>.png       one 256 x 256 picture per part (about 350 MB)
├── connectors/<id>.json      where each part connects to others (14 MB in all)
├── catalog.json              what parts exist and how to find them
├── colors.json               the LDraw colour table
├── manifest.json             a report of the run: sizes, counts, problems
└── connectors-manifest.json  the same for the connectors

Running it again is safe:

  • A full run removes the files of parts that are no longer in the library.
  • A downloaded library replaces the one in data/ only once it has arrived and unpacked completely.
  • Nothing is published. That is a separate step, described under Updating and publishing.

How it works

The script runs three tools one after another. Each can also be run by itself, on the whole library or on a few parts.

Tool Reads Writes Takes
1 ldraw-to-glb data/ldraw out/parts, catalog.json, colors.json, manifest.json about 8 s
2 part-thumbnails out/parts out/thumbnails a little over a minute
3 part-connectors data/ldraw, data/shadow, part-connectors/additions out/connectors, connectors-manifest.json about 1 s

The times are for the whole library on a ten-core laptop. All three tools use every core.

The order matters in one place: the thumbnails are drawn from the GLB files, so part-thumbnails runs after ldraw-to-glb. part-connectors reads the libraries directly and depends on neither.

Repository layout

ldrawjs-utils/
├── scripts/
│   └── update-data.sh        the one command: download, convert, render, connect
├── ldraw-to-glb/             a Cargo workspace
│   ├── parser/                 ldraw-parser: reads LDraw files (no dependencies)
│   ├── pipeline/               ldraw-pipeline: writes GLB, catalog, colours (binary ldraw2glb)
│   ├── scripts/fetch-library.sh
│   └── validate/               the glTF validation behind --validate (Node.js)
├── part-thumbnails/          a software renderer for the part pictures
├── part-connectors/          works out where parts connect
│   ├── additions/              our own shadow files, read after the shadow library's
│   └── scripts/fetch-shadow.sh
├── docs/
│   └── data-flow.svg         the diagram above
├── data/                     the libraries as downloaded (not committed)
└── out/                      everything generated (not committed)

The three tools are separate Cargo projects, each built and tested from its own folder. part-connectors uses ldraw-to-glb/parser to find files in the library; nothing else is shared.

The tools

ldraw-to-glb

Converts LDraw parts into GLB files, and writes the catalog and the colour table. It is a Cargo workspace of two crates:

  • parser/ (ldraw-parser, no dependencies) reads LDraw files and flattens a part into plain geometry: it follows sub-file references, applies their transforms, resolves inherited colours and works out which way every face points (LDraw's BFC rules).
  • pipeline/ (ldraw-pipeline, binary ldraw2glb) welds vertices, computes smooth normals, writes the GLB files and builds the catalog and colour table.
cd ldraw-to-glb
cargo run --release -p ldraw-pipeline                     # the whole library
cargo run --release -p ldraw-pipeline -- --only 3001,3020 # just these parts
cargo run --release -p ldraw-pipeline -- --help
Option Default
--library <dir> ../data/ldraw The LDraw folder, containing parts/ and p/.
--out <dir> ../out Where the files are written.
--only <part,...> Convert just these parts. Such a run writes GLB files and nothing else, so it cannot leave the catalog describing a handful of parts.
--conditional-lines off Also store LDraw's conditional lines (see The part files). Adds about 40% to the files.

ldraw-to-glb/scripts/fetch-library.sh downloads and unpacks the library on its own, and ldraw-to-glb/validate/ holds the glTF validation used by --validate:

cd ldraw-to-glb/validate
npm install
npm run validate          # every GLB in ../../out/parts

part-thumbnails

A small software renderer, with no GPU and no browser involved, so it runs anywhere and gives the same picture every time: orthographic camera, z-buffer, smooth shading, edge lines and silhouettes, drawn at three times the size and scaled down.

cd part-thumbnails
cargo run --release                                   # every part in ../out/parts
cargo run --release -- --only 3001 --size 128 --color C91A09
cargo run --release -- --help
Option Default
--parts <dir> ../out/parts The folder with the part GLB files.
--out <dir> ../out/thumbnails Where the PNG files are written.
--size <px> 256 Width and height of a picture.
--color <RRGGBB> BFC4C8 The colour of the part itself, in sRGB.
--only <part,...> Render just these parts.

It reads the GLB files written by ldraw-to-glb and depends on the conventions of the part files. If those change, its reader (part-thumbnails/src/glb.rs) has to follow.

part-connectors

Works out where every part connects to others: its studs, the holes studs go into, pins and the holes for them, axles, clips, hinges.

The LDraw library has the shape of each part and nothing about how parts join. The LDCad Shadow Library adds that, but not as a list for each part: it is a patch over the LDraw library, a file of the same name whose lines count as added to the official one. The stud is described once, on the primitive stud.dat; a 2 x 4 plate has its eight studs by referencing that primitive eight times, and only the holes underneath are written for the plate itself. This tool reads the two libraries together, follows every reference with its move, turn and change of size, and writes each part a plain list.

cd part-connectors
scripts/fetch-shadow.sh                       # the shadow library -> ../data/shadow
cargo run --release                           # every part in ../data/ldraw
cargo run --release -- --only 3001,3020       # just these parts
cargo run --release -- --help
Option Default
--library <dir> ../data/ldraw The LDraw folder, containing parts/ and p/.
--shadow <dir> ../data/shadow The shadow library, in the same layout.
--additions <dir> additions Our own shadow files, described under Additions to the shadow library.
--out <dir> ../out Where the files are written.
--only <part,...> Just these parts. Such a run writes their files and leaves the manifest alone.

How the two libraries are read

  • A file's snaps are those of every file it references, each placed the way the reference places that file; less what a SNAP_CLEAR takes away; plus those its own shadow file writes or brings in with SNAP_INCL. Each file is worked out once and remembered.
  • A reference that resizes or mirrors a file keeps a snap only as the snap's own scale and mirror rules allow. A stud does not survive being made wider; an axle may be made longer. A reference that skews a file loses its snaps.
  • Rotations written to three decimals are rotations. Sizes within 1% are the same size, and axes within 0.02 of square are square; they are then made exactly so.
  • The list is the same however the part was put together. Every repetition is laid out as a point, points that coincide are counted once, and what is left is gathered into grids again: a whole rectangle where there is one, rows where there is not.

Where the format's description is silent

The published description of the shadow library's format (https://www.melkert.net/LDCad/tech/meta) is older than the library, and LDCad itself is the only reference. Where the two differ, or the description says nothing, this is what the tool does:

  • An include brings the lines of the shadow file it names, and of the shadow files that one includes; not what the official file of that name gathers from its references. 4085c includes 4085a for its clip and the hole under it, and has its stud from its own reference to stud.dat.
  • A clear inside an included file takes away what the including part had from its references, and nothing the part's own shadow file added. 2780 includes 3673, whose shadow starts by clearing; without that reaching 2780 the pin would be there twice. Two includes of such a file in one part do not clear each other.
  • A grid may have three counts and three steps (1 C 2 C 2 0 80 60): along X, Y and Z. The described form has two, along X and Z.
  • mirror=corZ corrects a mirrored snap by its Z axis instead of its X.
  • Properties the description does not have (match and placement on SNAP_GEN) are kept under extra. MIRROR_INFO and HINTS lines are not about connecting and are only counted.

Additions to the shadow library

part-connectors/additions/ holds files in the shadow library's own format, under the same paths (p/stud4.dat). The lines of each count as written after those of the shadow library's file of the same name, so they can add to a file, and with SNAP_CLEAR take away from it. They are under the shadow library's licence, CC BY-SA 4.0. The folder is part of this repository; nothing is downloaded for it.

What is there now is one thing: the hole inside a tube. The tubes under a brick or a plate two studs wide or more are hollow, and a stud fits inside one. The shadow library says so for three of the primitives such tubes are drawn with (stud4o.dat, stud4od.dat, stud16.dat), with this line:

0 !LDCAD SNAP_CYL [ID=aStud] [gender=F] [caps=A] [secs=R 6 4] [scale=YOnly]

For the most used one, stud4.dat, it has the line switched off, with a note that LDCad cannot yet keep such a hole from catching parts that were meant for the ordinary holes beside it. The other primitives of the family have no shadow file at all. The additions give the same line to every tube primitive that is hollow all the way and has its open end where a stud's top would be:

Primitives
stud4, stud4a, stud4h, stud4oda The plain tube and its variants.
stud4f1n … stud4f5n (eleven files) The tube with fillets to the walls beside it.
stud16a, stud16od, stud21a, stud22a The split and the slotted tube.

stud4s.dat and stud4s2.dat are left out: they are the slanted inner end of a tube under a slope, not its opening. stud3.dat is a solid pin.

  • The line keeps the name aStud. That is how a part's shadow file takes such a hole away again (SNAP_CLEAR [ID=aStud], which five parts do), and how this tool knows the hole for what it is: every hole of that name, the shadow library's own three included, is written with "tube": true.
  • A tube the part has a hole of its own for is not written twice. Many parts with one tube, round plates and cones among them, have that hole in their own shadow file, since the primitive's was switched off. Where a tube opens within 0.05 LDU of where an ordinary hole of stud width opens, only the ordinary hole is written. That happens about 1,200 times.
  • What it was checked against. LeoCAD carries stud and hole positions for 318 parts, worked out separately. For the 299 parts both have, every one of the 572 tube holes written here is in LeoCAD's list as well, and the holes LeoCAD has that are missing here went from 762 to 197. Most of those that remain are ordinary holes of parts the shadow library has no file for. Nothing was copied from LeoCAD's data, which is under another licence; it was only compared with.

Data formats

What follows is the specification of every generated file. The same text is published with the data, in the readme of ldrawjs-db.

A part's <id> is its LDraw file name without .dat, in lowercase (3001, 3626cp01), and is the same in every folder.

The part files

Each part is a standard binary glTF 2.0 file. Anything that reads glTF can open one. A few conventions matter to a program that wants to place parts in a model and colour them:

  • Units and axes are baked in. LDraw measures in LDU (0.4 mm) with -Y up; the files are in metres with +Y up, and a part's front faces +Z. A point (x, y, z) of LDraw is at 0.0004 · (x, −y, −z). The part's own origin is kept.

  • Placing a part. An LDraw rotation matrix M becomes C · M · C with C = diag(1, −1, −1), and its position (x, y, z) becomes 0.0004 · (x, −y, −z).

  • Positions are integers. They are stored as 16-bit integers (KHR_mesh_quantization, the only extension used) on a grid of 1/128 LDU or, for parts that reach further than 256 LDU from their origin, a coarser power of two. The node's scale turns them into metres, so a reader must apply it. There is no translation on the node. Normals are normalised signed bytes.

  • Colours go by material name. Geometry is split by which colour it takes once the part is placed:

    Material Meaning
    ldraw:16 The colour the part is given.
    ldraw:24 The edge colour that goes with it.
    ldraw:<code> A colour fixed in the part: prints, multi-colour parts.
    ldraw:<code>:edge The edge colour that goes with a fixed colour.
    ldraw:0x2RRGGBB A fixed colour given directly as RGB.
  • One mesh, two kinds of primitive. Surfaces are triangles with positions, normals and indices. Edge lines are LINES primitives.

  • Faces whose direction LDraw does not vouch for are written twice, once each way, so every material can be single-sided.

  • Conditional lines are left out unless asked for with --conditional-lines. They would be about a third of each file, and a renderer with smooth shading does not need them.

  • Attribution travels with the file. asset.copyright holds the part's author and licence, and asset.extras.ldraw its original file name and description.

Every file passes the Khronos glTF validator without errors or warnings.

The catalog

catalog.json lists every part that has a part file, and how to find it.

{
  "version": 1,
  "source": "LDraw parts library, https://www.ldraw.org, CC BY 4.0",
  "libraryUpdate": "2026-10",
  "categories": ["Animal", "Antenna", "..."],
  "flags": { "pattern": 1, "sticker": 2, "internal": 4, "alias": 8, "physicalColour": 16, "thirdParty": 32, "shortcut": 64 },
  "parts": {
    "id": ["23714", "62575p01", "..."],
    "description": ["Animal Ant", "Animal Ant with Marbled Trans Brown Pattern", "..."],
    "category": [0, 0, "..."],
    "keywords": ["", "Bricklink 62575pb01, Jungle, Rebrickable 23714pat0001, set 7624, set 7626", "..."],
    "flags": [0, 1, "..."]
  },
  "aliases": { "10": "10a", "100": "3665" }
}
  • parts is column-oriented. Its five arrays have the same length, and the same index in each is the same part. Parts are in LDraw's own order: by description, with sizes in numeric order ("2 x 4" before "2 x 10").

  • id is the part's file name without .dat, in lowercase. It is the name of the part's files here (parts/<id>.glb, thumbnails/<id>.png, connectors/<id>.json) and what a model file calls the part.

  • description is LDraw's, tidied for reading: the padding inside sizes is removed ("Brick 2 x 4" becomes "Brick 2 x 4"), and so is the character LDraw puts in front to classify the part, which is in flags instead.

  • category is an index into categories, which is sorted by name. It is the part's !CATEGORY where it has one, and the first word of its description otherwise.

  • keywords is the part's !KEYWORDS, joined with ", ". Often ids used by other catalogs.

  • flags is a bit field. The meaning of each bit is in the top-level flags, so that a reader need not hard-code the numbers:

    Flag Bit Set for
    pattern 1 A printed part: "Pattern" in the description, or a pNN suffix on the id.
    sticker 2 A sticker, or a part with one applied: "Sticker" in the description, or a dNN suffix.
    internal 4 ~ in front: a piece of another part, or obsolete. Not for use by itself.
    alias 8 = in front, or an Alias type: another name for an existing part.
    physicalColour 16 _ in front, or a Physical_Colour type: a part fixed to one colour.
    thirdParty 32 | in front: not made by the original manufacturer.
    shortcut 64 A Shortcut type: several parts assembled into one.
  • aliases maps the ids of parts that were renamed (LDraw's "~Moved to" files) to their current ids. Such an id has no files of its own; a model that uses it means the part it leads to.

  • libraryUpdate is the newest LDraw release any of the parts belongs to, as year-number.

The colour table

colors.json is LDraw's colour table (LDConfig.ldr), sorted by code.

{
  "version": 1,
  "source": "LDConfig.ldr, LDraw parts library, https://www.ldraw.org, CC BY 4.0",
  "colors": [
    { "code": 0, "name": "Black", "value": "#1B2A34", "edge": "#808080", "finish": "solid" },
    { "code": 33, "name": "Trans Dark Blue", "value": "#0020A0", "edge": "#000B38", "finish": "solid", "alpha": 128 }
  ]
}
Field
code The LDraw colour code: what a model file gives a part, and the number in the material names of the part files (ldraw:<code>).
name LDraw's name, with spaces for its underscores.
value The colour, as #RRGGBB in sRGB.
edge The colour of the edge lines that go with it.
finish solid, chrome, pearlescent, rubber, metal or material (glitter, speckle and the like).
alpha 0 to 255, only on a colour that is see-through.
luminance 0 to 255, only on a colour that glows.

The thumbnails

thumbnails/<id>.png is one picture per part: 256 x 256 pixels, RGBA with a transparent background. The part is seen from the front, the right and above, without perspective, and fills the picture. It is drawn in a neutral light grey (#BFC4C8) where it takes the colour it is given; prints and other fixed colours are their own.

The connector files

connectors/<id>.json is the list for one part. Every part has a file; one with nothing known about it has an empty list. A 2 x 4 plate:

{
  "part": "3020",
  "license": "CC BY-SA 4.0. Made from the LDCad Shadow Library ...",
  "connectors": [
    { "kind": "cyl", "gender": "M", "caps": "A", "secs": [["R", 6, 4]], "pos": [-30, 0, -10], "grid": [4, 2, 20, 20] },
    { "kind": "cyl", "gender": "F", "caps": "B", "secs": [["R", 6, 4]], "pos": [-30, 8, -10], "grid": [4, 2, 20, 20] },
    { "kind": "cyl", "gender": "F", "caps": "A", "secs": [["R", 6, 4]], "pos": [-20, 4, 0], "grid": [3, 1, 20, 0],
      "ori": [1, 0, 0, 0, -1, 0, 0, 0, -1], "tube": true }
  ]
}
  • part is the part's id. license is there whenever the list is not empty.

  • Units and axes are LDraw's, not those of the GLB files: LDU, -Y up, relative to the part's origin. They are what a model file is written in.

  • pos and ori place a connector. ori is a rotation, nine numbers row by row as LDraw writes a matrix, and is left out when it is the identity. A shape runs from pos along the negative Y axis of its orientation: the stud above rises from the top of the plate, and the hole reaches up into it from the bottom. With "center": true the shape lies half to each side of pos instead.

  • grid is [countX, countZ, stepX, stepZ]: the connector repeated along its own X and Z axes, the first one at pos. A 48 x 48 baseplate is one line.

  • kind is one of:

    Kind Fields
    cyl gender, secs, caps A cylinder: M goes into F. Studs, pins, axles, bars, and the holes for them.
    clp radius, length A clip. It takes a bar: a male cylinder of its radius.
    fgr genderOfs, seq, radius The fingers of a hinge: the gender of the first, the width of each, the radius of their tips where given.
    gen gender, bounding, group Anything else. Fits only another of the same group. bounding is a rough size: ["box", x, y, z] (half sizes), ["cube", size], ["cyl", radius, length], ["sph", radius] or ["pnt"].
    sph gender, radius A ball, or the socket for one. The shadow library writes these as gen at present, so none are published.
  • secs is a cylinder's shape along its length, as [shape, radius, length] for each stretch: R round, A axle, S square; _L and L_ are a rim that gives way, belonging to the stretch before or after. A stud is [["R", 6, 4]]; the hole in a Technic beam is [["R", 8, 2], ["R", 6, 16], ["R", 8, 2]].

  • caps says which ends of a cylinder are closed: none, A (the end at pos), B (the far end) or two. For a hole this is what says where it is entered, and it is not always at pos: the ordinary holes above are closed at B and open at pos, on the underside of the plate; the third line is written from its closed end, 4 below the top, and opens at the far end, pos and four along the way it runs, which is the underside again. A hole with none is entered from either end.

  • tube marks the hole inside a tube under a part: the three tubes between the eight holes of the plate above. A stud fits in one, and the part then sits half a stud off, in both directions, from where its ordinary holes would put it. Such a hole has the shape of any other hole for a stud, so the mark is the only way to tell the two apart: to prefer the ordinary holes, or to leave the tubes out. A tube that the part has an ordinary hole for, opening at the same place, is written once, as that hole.

  • slide marks a connection the parts can slide along; group, where a connector has one, limits it to others of the same group; extra holds properties this tool does not know, as the shadow library wrote them ({"placement": "free"}). All three are left out when they do not apply.

  • A round cylinder has no turn of its own. LDraw files turn studs about their own axis every which way, which means nothing for a round shape. Such a connector is written in the one orientation that goes with the way it points, so an upright stud has no ori at all. Axles, square holes, clips and the rest keep the turn they were given.

Two parts join where a male and a female connector of matching shape are at the same place, on the same axis. A brick sits on another when the open end of its holes is at the pos of the other's studs. The files say where the connectors are; what fits what, how much play there is, and whether the parts then pass through each other, is for the program that uses them.

Coverage follows the shadow library. In the 2026-11 library 18,404 of 24,043 parts have at least one connector (every plate, 96% of bricks, 85% of Technic). A part the shadow library has no file for still has the studs its primitives give it, and the tubes under it, but not the ordinary holes underneath, which are written part by part. The tubes are not from the shadow library, which has them switched off; they are an addition of this project's, 25,738 of them in 4,142 parts.

The reports

Two files describe a run and are not needed to use the data.

manifest.json, from ldraw-to-glb:

Field
generator, source, libraryUpdate What made the files, from what, and from which LDraw release.
units, upAxis, ldrawUnitInMetres "metres", "+Y" and 0.0004: the space the part files are in.
parts By id: file, description (as LDraw writes it), bytes, triangles, vertices, lines, conditionalLines.
aliases The same map as in the catalog.
empty Parts with nothing to draw, by id, with their description. They have no files.
failed Parts that could not be converted, by id, with the reason.
problems Parts that were converted with something amiss, by id: missingFiles (references that lead nowhere) and unparsedLines.

connectors-manifest.json, from part-connectors:

Field
generator, sources, license What made the files, from what, and the licence they are under.
libraryUpdate, shadowCommit The LDraw release, and the commit of the shadow library.
units, upAxis "LDU" and "-Y": the space the connector files are in.
counts parts (files written), withConnectors, withoutConnectors, moved (renamed parts, which have no file), connectors (lines), places (what the lines stand for once their grids are counted out), placesByKind, and tubeHoles (how many of the places are holes inside tubes).
shadowFiles all, used, and the list of those unused: shadow files for parts the LDraw library no longer has.
additions The files that part-connectors/additions/ had lines for.
problems.failed Parts whose file could not be written, by id.
problems.unresolvedIncludes By file: the SNAP_INCL references that name no shadow file.
problems.unreadableLines By file (shadow/... or ldraw/...): the shadow lines that could not be read, with line numbers.
problems.snapsLostToReferences By the file the snaps were in: how many did not survive a reference, as scaled, mirrored or sheared.
problems.unknownToThisProgram Properties and names the format's description does not have, with counts.
problems.otherLdcadLines !LDCAD lines that are not about connecting, by name, with counts.

Updating and publishing

The data is rebuilt when the LDraw library has a new release, when the shadow library has gained parts, or when one of the tools has changed.

  1. Rebuild. scripts/update-data.sh, with --validate after a change to ldraw-to-glb.

  2. Read the two reports. In out/manifest.json, failed should be empty and problems short: both name the parts concerned. In out/connectors-manifest.json, problems lists everything that could not be used: shadow lines that could not be read, includes that lead nowhere, unknown properties, and for each file how many of its snaps were lost to references that resized, mirrored or skewed it. A new property there usually means the shadow library's format has grown.

  3. Publish. Copy the contents of out/ into a checkout of ldrawjs-db and push it. Files of parts that have left the library are gone from out/ and have to go from the checkout as well, which a plain copy does not do. With the two repositories side by side:

    for dir in parts thumbnails connectors; do
      rsync -a --delete "out/$dir/" "../ldrawjs-db/$dir/"
    done
    cp out/*.json ../ldrawjs-db/
  4. Update the specification if a format changed: Data formats here and readme.md in ldrawjs-db say the same thing and are changed together.

The editor finds the data through the libraryUrl in its public/config.json, so a copy published anywhere else works the same way.

Development

Each tool is built and tested from its own folder:

(cd ldraw-to-glb    && cargo test --release)   # 55 tests
(cd part-thumbnails && cargo test --release)   # 12 tests
(cd part-connectors && cargo test --release)   # 59 tests
  • Tests that need the libraries skip themselves. Four tests of ldraw-to-glb and ten of part-connectors check real parts, and are skipped when data/ldraw or data/shadow is not there. Run scripts/update-data.sh once, or the two fetch scripts, to have them run.
  • A bug fix comes with a test that fails without it.
  • The output is the regression test. Since a run is deterministic, a change that is not meant to change the data can be checked by comparing out/ before and after it, and one that is meant to shows exactly which files it touched.
  • The code is not laid out by rustfmt. cargo fmt rewrites every file of a crate; leave it out, and keep to the layout of the code around a change.
  • Comments say why, in plain complete sentences.
  • This README is the only documentation. There are no READMEs inside the tools. A change to a tool, an option or a format is described here in the same change.

Known limits

  • Textures (LDraw's TEXMAP) are not converted; such parts get their geometry without the image.
  • There are no reduced-detail versions of parts.
  • Only the official library is converted, not unofficial parts.
  • Thumbnails draw every part opaque, in one neutral colour; a part that is normally transparent does not look it.
  • Connectors are as complete as the shadow library is. A part it has no file for gets its studs and its tubes, and not its ordinary holes. Hollow studs that a part makes longer (stud2a.dat) are lost, by the shadow library's own rule: about 260 snaps in all.
  • The tubes under slopes are not all found: where the tube is drawn with the slanted primitive alone (stud4s.dat), there is no hole for it.

Licence and credits

What Licence
The code in this repository MIT, as declared in the Cargo manifests
part-connectors/additions/ CC BY-SA 4.0
Generated: parts/, thumbnails/, catalog.json, colors.json, manifest.json CC BY 4.0
Generated: connectors/, connectors-manifest.json CC BY-SA 4.0

The data the tools process is the LDraw parts library, the work of the LDraw community, licensed under CC BY 4.0. The generated files are derived from it and carry the same licence; the attribution is written into every part file.

The connector files are also derived from the LDCad Shadow Library by Roland Melkert and its contributors, and from the few lines in its format that part-connectors/additions/ adds to it, both licensed under CC BY-SA 4.0. That licence is share-alike: connectors/ and connectors-manifest.json are published under CC BY-SA 4.0, and each file with connectors says so. They are kept apart from the part files for this reason, which stay under CC BY 4.0.

LDraw™ is a trademark owned and licensed by the Jessiman Estate.

This is an independent, community project. It is not affiliated with, sponsored by or endorsed by any toy manufacturer.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages