Skip to content

Geesing/three-ldraw-packing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

three-ldraw

About

The packLDrawModel utility from the three.js repository is used to statically link an LDraw model's part file dependencies into one file for optimal rendering via THREE's LDrawLoader.

Bricklink Stud.io Compatibility

Bricklink Stud.io allows exports to the LDraw file format expected by THREE's LDrawLoader. However, Bricklink uses non-standard IDs for printed parts, leaving packLDrawModel unable to correctly link in the corresponding LDraw files.

This repo's packLDrawModel.mjs modifies the original utility to handle non-standard Bricklink part IDs by finding equivalent LDraw IDs provided through the Rebrickable API. If no equivalent exists, the packer defaults to the unprinted version of the part.

Usage

  • Download official parts library from LDraw.org and unzip in a directory (e.g. ldraw/)
  • Download your desired model file and place in the ldraw/models/ subfolder.
  • Place this script also in ldraw/
  • Create .env file in ldraw/ with the variable API_KEY="yourRebrickableAPIKey"
  • Issue command 'node packLDrawModel models/' or 'node packLDrawModel.mjs models/'
  • The packed object will be in ldraw/models/_Packed.mpd and will contain all the object subtree as embedded files.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors