Jump to content

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


M2m
 Share

Recommended Posts

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:

 

 

  • Like 1
Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

  • 3 weeks later...
TheDiplomat

@Imagixel I highly recommend this online textbook for Python. It's one of the most enjoyable learning experiences I've ever had for a language:
http://interactivepython.org/courselib/static/thinkcspy/index.html

 

Aside from that, it's really good to just find small, cool stuff you'd want to create, then look up how to make it. I found that starting out learning programming just for the sake of learning programming was a horrible experience. My parents tried to teach me Java and Pascal when I was young, and demonstrated how it could be used to find the area of the various shapes, or perform simple calculations, etc. I didn't absorb very much of that. It wasn't until I wanted to make games using Unity, or do webscraping, that things actually clicked a bit for me.  TL;DR: Find something simple yet cool you want to do (graphics, a small game, a bash script, etc.) and learn how to do that.

Link to comment
Share on other sites

 Share

×
×
  • 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.