Logo: Parsing Ldraw Build Instructions

Parsing Ldraw Build Instructions

Organisatioun
runtime-si
parsing-ldraw-build-instructions

Reads an LDraw .ldr / .mpd build file - submodels, STEP and ROTSTEP meta commands, part ids, colour codes, transforms in LDraw units - into ordered build steps of bricks on a stud grid, each brick as a cell (x, y, layer from 1), a size 'AxB', a rotation 0 / 90, a height in plates and a colour name from the LDraw colour table. Basic LEGO bricks, plates and tiles (1xN, 2xN, 4xN ...), DUPLO bricks and plates, and baseplates are converted; every other part, and any part that is turned off the 90-degree grid or sits between studs, is listed with a reason instead of guessed. Use when a build instruction comes as an LDraw file (from an editor, BrickGPT, or the LDraw model library) and the robot needs the bricks it describes, in order, in the stud-grid convention computing-brick-pose-from-stud-grid and planning-brick-assembly-order take.

Iwwersiicht

Editeurruntime-si
RepositoryRoboSkillHub
Skill-Nummparsing-ldraw-build-instructions
Stären
242
Forks
27
Matgeliwwert Dateien
3
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 3 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    runtime-si huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Parsing Ldraw Build Instructions an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/runtime-si/RoboSkillHub/tree/main/skills/parsing-ldraw-build-instructions
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/runtime-si/RoboSkillHub.git /tmp/RoboSkillHub
mkdir -p .claude/skills
cp -r /tmp/RoboSkillHub/skills/parsing-ldraw-build-instructions .claude/skills/parsing-ldraw-build-instructions
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Parsing Ldraw Build Instructions an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Parsing Ldraw Build Instructions automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Parsing Ldraw Build Instructions net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

parsing-ldraw-build-instructions

An LDraw file is how a digital LEGO instruction travels: editors (LDCad, MLCad, Studio's export), generators (BrickGPT writes one brick per line and a 0 STEP after each) and the LDraw model library all write it. This skill turns one into the robot's vocabulary: which brick, which stud cell, which layer, which way round, what colour, in which step. No robot, no camera; pure parsing on the CPU (1-135 ms for 60 library models of up to 9,700 parts).

How it composes

  • Before it: the file (a path, or the text in ldraw_text).
  • After it: planning-brick-assembly-order takes steps (or bricks) and orders them so every brick is supported when it is pressed; each placement then goes through computing-brick-pose-from-stud-grid (cell, size, rotation to a metric pose on the calibrated baseplate) and pressing-a-brick-onto-studs. The colour names are tools/colour's: look for the next brick with colour.classify(..., palette="lego") and compare name with the brick's colour.
  • unsupported_part and off_grid still return every brick that did convert. Whether a partial build is useful (a wall without its window) is the caller's call; the lists say exactly what is missing.

The grid convention

  • x runs along LDraw +X, y along LDraw +Z, layer up (LDraw's -Y); x, y, up is right-handed.
  • cell {x, y, layer, rotation}: (x, y) is the brick's lowest-x, lowest-y stud (its corner at every rotation, ICL's calc_brick_loc anchor), 0-based. layer 1 is a brick standing on the baseplate (ICL's z, and computing-brick-pose-from-stud-grid's layer), or on the level of the lowest brick when there is no baseplate. Layers count brick heights; a plate is a third of a LEGO brick (half a DUPLO brick), so a brick on a plate is at layer 1.333333; z_units (plates above the ground, from 0) and height_units give the same heights as whole plates.
  • size 'AxB' (also as brick_size) with A <= B; rotation 0 puts A along x, 90 puts B along x (ICL and BrickGPT's ori 0 / 1, also returned as ori). span_x / span_y repeat the footprint in studs. A 180 or 270 degree turn of a rectangular brick is the same brick, so it reads 0 or 90. A brick record can go straight into the pose skill's cell / brick_size and occupied.
  • Origin (origin): auto uses a single baseplate's corner and top (cell (0, 0) is the plate's corner stud, as in the pose skill's plate frame; baseplate.bricks_outside lists any brick past its edge), else min (the lowest corner and bottom of all bricks); ldraw counts from LDraw's own origin (ground y = 0).

What it reads

  1. Files: 0 FILE blocks of an .mpd (the first is the model; 0 NOFILE ends a block); sub-files an .ldr references are looked up beside it, or passed in files. A plain .ldr is one model.
  2. Steps: 0 STEP and 0 ROTSTEP end a step; empty steps are dropped and steps renumbered from 1. source_step keeps the step's number within its own (sub)model.
  3. Submodels: inline (default) builds a submodel in place: its own steps come before the step that places it (ldraw-py's unwrap order), with the placing line's transform applied; flatten puts the whole submodel in the placing step. Colour 16 in a submodel takes the placing line's colour. A submodel that includes itself is invalid_file.
  4. LPub metas: parts between BUFEXCHG ... STORE and RETRIEVE (shown for one step, then taken away) are dropped, as ldraw-py drops them; other 0 lines (comments, GHOST, MLCAD HIDE, !LPUB) are ignored.
  5. Parts (type-1 lines): the table below, printed variants (3001p01, 3068bp03) as their base part, and the LDraw colour code as a name. Everything else goes to unsupported with its line and step.

Inputs

  • ldraw_path (required in the graph) or ldraw_text; files (name -> text, extra sub-files).
  • submodels: inline | flatten. origin: auto | baseplate | min | ldraw. system: lego | duplo to override the system read from the parts (default: the one most bricks use; the other system's bricks are unsupported, since one stud grid cannot hold both).

Outputs

route, detail, and:

  • steps: [{step, model, source_step, bricks: [...]}] in build order.
  • bricks: the same bricks flat. Each: id, part, base_part, kind (brick / plate / tile; tiles have studs_on_top: false), system, size, brick_size, rotation, ori, cell, span_x, span_y, z_units, height_units, studs_on_top, colour, colour_code, colour_in_palette (true when tools/colour's lego palette has the name), step, model, source_step, position_ldu (the part's origin in LDraw units, after the submodel transforms).
  • unsupported, off_grid: [{part, line, reason, model, source_step, step_in_file}].
  • baseplate: the plate used as the grid (part, size, span_x, span_y, plate_studs - the pose skill's [nx, ny], x along LDraw X -, bricks_outside), or empty.
  • system, n_bricks, n_steps, n_unsupported, n_off_grid, steps_json (the steps as a JSON string, for graphs that pass text).

The lists are not in produces_outputs, which takes only gap schema types.

The part table

Checked against the official LDraw library (complete.zip downloaded 2026-11-08): each part's box, computed from its geometry and sub-files, spans the listed studs along its own X and Z, with its top face at y = 0 and its bottom 24 LDU (brick), 8 (plate, tile), 48 (DUPLO brick) or 24 (DUPLO plate) lower. All 1452 printed variants of these parts in the library have the base part's box.

kindparts
LEGO bricks1x1 3005, 1x2 3004, 1x3 3622, 1x4 3010, 1x6 3009, 1x8 3008, 1x10 6111, 1x12 6112, 1x16 2465, 2x2 3003, 2x3 3002, 2x4 3001, 2x6 2456, 2x8 3007, 2x10 3006, 4x6 2356, 4x10 6212, 4x12 4202, 8x8 4201, 8x16 4204
LEGO plates1x1 3024, 1x2 3023 / 3023b, 1x3 3623, 1x4 3710, 1x5 78329, 1x6 3666, 1x8 3460, 1x10 4477, 1x12 60479, 2x2 3022, 2x3 3021, 2x4 3020, 2x6 3795, 2x8 3034, 2x10 3832, 2x12 2445, 2x16 4282, 3x3 11212, 4x4 3031, 4x6 3032, 4x8 3035, 4x10 3030, 4x12 3029, 6x6 3958, 6x8 3036, 6x10 3033, 6x12 3028, 8x8 41539
LEGO tiles1x1 3070b, 1x2 3069b, 1x3 63864, 1x4 2431, 1x6 6636, 1x8 4162, 2x2 3068b, 2x3 26603, 2x4 87079, 2x6 69729, 4x4 1751
DUPLObricks 2x2 3437, 2x3 87084, 2x4 3011, 2x6 2300, 2x8 4199, 2x10 2291; plates 2x4 40666, 2x6 98233, 2x8 44524, 4x4 14721, 4x6 25549, 8x8 51262
baseplatesLEGO 32x32 3811, 16x16 3867, 48x48 4186, 8x16 3865, 8x32 4187, 24x40 3645, 16x24 3334, 16x32 3857; DUPLO 16x16 5930, 24x24 4268, 12x16 6851, 8x12 31043, 16x24 6475

Not converted (listed as unsupported): slopes, round and modified bricks, jumpers, hinges, Technic, minifigures, any part not above. Adding a rectangular part is one table line once its box is checked the same way.

Measured

  • Tests (tests/bundles/test_parsing_ldraw_build_instructions.py): hand-written files for steps and comments, an .mpd with a submodel placed twice (one turned 90 deg) on a baseplate, inline vs flatten, colour 16 inheritance, external and missing sub-files, a self-including submodel, LPub buffer exchange and ROTSTEP, DUPLO on a DUPLO baseplate with a LEGO brick mixed in, and six kinds of off-grid part; BrickGPT's own to_ldr lines round-trip to its (h, w, x, y, z); the colour names agree with tools/colour's palette.
  • LDraw sample models (James Jessiman, distributed in LDraw.org's complete library): pyramid.ldr - 13 bricks in 4 steps, steps_ready, an 8x8 ring of 2x4s up to a 2x2 at layer 4. car.ldr - 33 bricks, plates and tiles in 7 steps, 28 parts unsupported (wheels, windscreen, steering wheel, lights, mudguards...).
  • 60 Official Model Repository files (library.ldraw.org/omr sets 1-60, each !LICENSE Redistributable under CCAL version 2.0; mostly Technic and Architecture): no crash, 1-135 ms each. 5,056 parts converted, 31,244 unsupported, 1,451 off_grid (801 tilted - SNOT sub-assemblies on their side, 528 off the stud grid, 70 turned, 52 between plate heights). One file is all basic bricks: 1869-1 South African Flag (Merlijn Wissink, CCAL 2.0) - 82 bricks of 8 sizes, steps_ready; it is in the tests.
  • Not done: no robot, no simulation (nothing moves). Whether a converted build can actually be pressed in order is planning-brick-assembly-order's check.

Limits

  • One stud grid: a build mixing LEGO and DUPLO keeps the majority system.
  • Sideways building (SNOT), jumper offsets and turntables are reported, not converted; a model built mostly that way yields little.
  • The table is by part id. An unofficial or renamed id of a basic brick is unsupported until it is added.
  • LDraw colours are rendering colours: on a real camera, learn the palette (tools/colour's colour.measure) and match by name.

The constants, and why

  • STUD_LDU 20 / 40, UNIT_LDU 8 / 24, UNITS_PER_BRICK 3 / 2: the LDraw spec's 20 LDU per stud and 24 per brick (BrickGPT's x0 / 20 and y0 / 24); DUPLO from its parts' geometry (2x2 brick 3437 spans 80 LDU, 48 high; DUPLO plates 24 high).
  • GRID_TOLERANCE_LDU = 1 (0.4 mm): editors write 59.9998 for 60; a jumper's half stud is 10 LDU.
  • MATRIX_TOLERANCE = 1e-3: rotation entries written with 4-6 decimals.
  • Grid phase: the fractional offset most bricks share (to 1/20 stud), so a model shifted half a stud everywhere still converts, and the brick on a jumper is the one reported.

Provenance

Parsing adapted from ldraw-py (Michael Gale, MIT): parse_file's 0 FILE split, parse_model's 0 STEP split, get_parts_from_model's buffer exchange masking, recursive_parse_model's transform composition, and unwrap_model's order (a submodel's steps before the step that places it). The cell arithmetic is BrickGPT's Brick.from_ldr (Ava Pun et al., MIT): x = x0 / 20 - h / 2, y = z0 / 20 - w / 2, z = -y0 / 24. Changed: no dependencies; LPub page, PLI, callout and view bookkeeping dropped; BrickGPT's eight sizes and two exact matrix strings became a checked part table and any 90-degree yaw; plates, tiles, DUPLO and baseplates added; heights in plates; unsupported and off-grid parts reported instead of raising. The script's header lists the changes; the licences are LICENSE.ldraw-py and LICENSE.brickgpt beside this file. Colour names and part geometry: LDraw.org library (CC BY 2.0 / CC BY 4.0, attribution LDraw.org). LEGO and DUPLO are trademarks of the LEGO Group, which does not sponsor or endorse this.

Matgeliwwert Dateien

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Parsing Ldraw Build Instructions?

Reads an LDraw .ldr / .mpd build file - submodels, STEP and ROTSTEP meta commands, part ids, colour codes, transforms in LDraw units - into ordered build steps of bricks on a stud grid, each brick as a cell (x, y, layer from 1), a size 'AxB', a rotation 0 / 90, a height in plates and a colour name from the LDraw colour table. Basic LEGO bricks, plates and tiles (1xN, 2xN, 4xN ...), DUPLO bricks and plates, and baseplates are converted; every other part, and any part that is turned off the 90-degree grid or sits between studs, is listed with a reason instead of guessed. Use when a build inst...

Firwat Parsing Ldraw Build Instructions op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Parsing Ldraw Build Instructions besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Parsing Ldraw Build Instructions an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/runtime-si/RoboSkillHub/tree/main/skills/parsing-ldraw-build-instructions an. TypingMind liest d'Datei SKILL.md, bëndelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Parsing Ldraw Build Instructions benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Parsing Ldraw Build Instructions benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Parsing Ldraw Build Instructions domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Parsing Ldraw Build Instructions gratis?

Jo. runtime-si huet de Skill ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇