Java API for loading and transforming LDraw data models

For example how can be loaded LDraw model to Three.js and displayed at HTML page see this example.

Role of library

with LDraw package could be done following tasks:

  • Load LDraw file including sub models, parts, comments, meta information and primitives into memory.
  • Convert LDraw model into another model (for examples Three.js).
  • Storing Three.js model to file.
  • It's ready to add another target data model, file reader or writer.
  • Simply create transformers between different models.

High level view

Library reads LDraw files build in memory model of it. LDraw model file could be converted to another form. There are some examples but any new target format could be added.

High level view

There is also way to create in another tool LDraw file model and than save it in LDraw file format.

Under the hood

here will be described library usage and functionality.

LDraw model

When LDraw file is loaded into application memory in memory is file stored as model. It's logical representation of original file. In memory LDraw model could be stored back to file. Following image shows class diagram of entities that create LDraw model.

LDraw in memory logical model

Part resolving

Sub file refered from DAT or MPD file have to be resolved. Process is described at following picture:

LDraw model converting

LDraw logical model is one part second think are logical models of other formats. When LDraw model should be converted in some other in memory model there have to be created Transformer. It could be simple of complex tool that translate one model into target one. Finally target data model have to be stored in some other file format using it's own saver.

process of LDraw file from to another format