Jump to content
M2m

LIF to OBJ - a python script to convert LDD bricks to .obj files

Recommended Posts

M2m

Quickly threw this program together as my 1st python program. Maybe useful to some. It converts bricks (not models) from LDD into .obj files which can be opened with any standard 3D program. 

 

https://github.com/sttng/LDD

Share this post


Link to post
Share on other sites
jamesster

Haven't had the chance to play around with it yet but looks promising! One quick thing, I glanced at the script and it looks like it uses Assets.lif - I'd recommend using the db.lif in AppData (C:\Users\USERNAME\AppData\Roaming\LEGO Company\LEGO Digital Designer\db.lif), or whatever the Mac equivalent is, as that's the file that's updated when LDD downloads a patch, and Assets.lif becomes out of date, so users would end up missing newer bricks:

 

 

Share this post


Link to post
Share on other sites
M2m

Thanks for the feedback. I removed any reference to Assets.lif now and just refer to db.lif. 

Share this post


Link to post
Share on other sites
M2m

Is there any updated format spec for .g(X) files ? Specifically regarding the flags ? I know 0x01 is for textures (and vertices and normals) but what a about others ?

Share this post


Link to post
Share on other sites
jamesster
5 minutes ago, M2m said:

Is there any updated format spec for .g(X) files ? Specifically regarding the flags ? I know 0x01 is for textures (and vertices and normals) but what a about others ?

All I know off the top of my head is that the .g(x) files contain UV mapped portions of bricks for decals/printing. I wanna say @lcdr might have more documented but I might be wrong, I'm sure someone does though.

 

Edit - I think there might be a flag involving definitions for borders/outlines on bricks too? Maybe? Don't quite remember, will try to dig through old chat logs and get back to when I'm home tonight.

Share this post


Link to post
Share on other sites
jamesster

Late update/not really an update - so the .g bricks in LEGO Universe have two flags disabled/lack some data compared to the LDD bricks. I think one of those is for brick outlines, dunno about the other. There was also some Technic-focused LEGO building instructions app some years back that had .g files with only one of the flags/data that LU lacked both of. That's about all the info I have unfortunately. Try asking @ProfessorBrickkeeper if you're curious about the building instruction app stuff.

Share this post


Link to post
Share on other sites
M2m

Thanks alot. This helped me to come up with an enhanced version that correctly merges .g , .g1 , .g2, etc.

 

https://github.com/sttng/LDD/blob/master/BrickReader.py

 

Start it with:

 

BrickReader.py <Brick No>

 

For ex:

 

BrickReader.py 99778

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.