How do LEGO Studio export files display?

Can the 3D models I created in Lego Studio be displayed on Threejs?

three.js has a LDrawLoader: three.js webgl - LDrawLoader

Thank you. I know,But the exported file has only one DEA

Error report after import:

THREE.ColladaLoader: Failed to parse collada file.
error on line 163 at column 31: Namespace prefix RoundingEdgeNormal on enable is not defined

Isn’t it possible to export to a different format? Normally DCC tools offer a bunch of formats for exporting.

Besides, have you tried to convert the Collada asset to glTF and then load it via GLTFLoader? Try the conversion with:

微信图片_20210713181339

You can export the above format

These are the import options.

I uploaded it wrong

Why don’t you use LDraw?

LDraw will also report an error

And how does this error look like? Do you mind sharing the LDraw asset in this topic?

zxc.ldr (6.8 KB)

error:
THREE.ColladaLoader: Failed to parse collada file.
error on line 1 at column 1: Document is empty

Why are you trying to load a ldr file with ColladaLoader?

LDrawLoader.js:1045 Uncaught LDrawLoader: Unknown colour code “4” is used at line 7 but it was not defined previously.

The feeling is that the exported LDR is a problem

I suggest you try to import the resulting LDraw file into Blender with the following plugin:

If it’s not possible to import the file, I suggest you report a bug to the developers of your DCC tool. If you can import the asset in Blender, there is potentially a problem with LDrawLoader (which should be consequently reported at GitHub as a bug).

1 Like

ok thank you

You can export to LDraw and view it here: https://beta.makerbrane.com/tools/ldraw-viewer.

LDraw models in the examples/models/ldraw directory were packed into one file from the files in the parts library with the utils/packLDrawModel.js utility.

In order to load model files which contain references to the library (not only colours but also primitive parts are needed), you have to download the pieces repository complete.zip file from ldraw.org. This contains the LDConfig.ldr which contains the colours, but also the rest of the library part files. Place the zip contents in a directory and place your model also under this directory. Set ldrawLoader.setPath( ... ) to the directory, and the model can be loaded.

Alternatively see the instructions in utils/packLDrawModel.js on how to pack a model from its file and the library files into one single file (which loads much faster)

1 Like

Thank you very much and I have solved the problem perfectly

1 Like

I’m glad of that :slight_smile: