M2m

pyldd2obj.py - a lxf to obj converter

Recommended Posts

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

tested on macOS Mojave and Python 2.7

Usage: pyldd2obj.py test01.lxf out_obj_file

Not by me but by jonnysp - I only did some backporting from Python 3 to 2.7 and added UTF-8 support.

Converts LDD lxf files into Alias|Wavefront obj files including mtl files and png textures.

Edited by M2m

Share this post


Link to post
Share on other sites

from the previous thread:

 

Quote

 

/Users/[Username]/Library/Application Support/LEGO Company/LEGO Digital Designer/db.lif

/Users/[Username]/liftmp/db.lif

/Users/[Username]/Downloads/LIF2OBJ/Assets/db.lif

[Username]MBP2:~ [Username]$ 

 


that's what I got when I searched for db.lif.  got the actual file path as well as the ones I extracted.

and i realized what i was doing wrong. i never put in the "out_obj_file" command.  i did it and it seemed to work.  but now i have no idea where the OBJs exported to. they aren't in the same folder as the test lxf.
 

Share this post


Link to post
Share on other sites

Output should be in the same location as where the python script resides. 

Share this post


Link to post
Share on other sites

Strange. I do as follows

1) Download the python script (obviously) :wink:

2) Change python script to executable:

My-MBP:Downloads user$ chmod +x pyldd2obj.py

3) Execute Script
My-MBP:Downloads user$ ./pyldd2obj.py /Users/user/Documents/LEGO\ Creations/Models/Treasure_Chest.lxf test_out

4) Output:
- - - pyldd2obj - - -
          _
         [_]
       /|   |\
      ()'---' C
        | | |
        [=|=]

- - - - - - - - - - - -
DB Version: 2670
Database OK.
Scene "Treasure_Chest" Brickversion: 2670
Progress: [##########------------------------------] 25.0%                     

Progress: [####################--------------------] 50.0%        

Progress: [####################--------------------] 50.0%   (4739) CHEST LID 2X

Progress: [##############################----------] 75.0%                     

Progress: [##############################----------] 75.0%   (57503) GOLD COIN 1

Progress: [########################################] 100.0% -                  

Progress: [########################################] 100.0% - (57503) GOLD COIN                                                                                

--- 0.0939090251923 seconds ---
My-MBP:Downloads user$

5) I get 2 files: test_out.mtl and test_out.obj

Share this post


Link to post
Share on other sites

that must be it. i never made it an executable.

 

does the actual .py script change after becoming executable?  because i finally did the chmod without getting errors and i ran the script and still no OBJ.

Share this post


Link to post
Share on other sites

did you get any output ?

What do you get if you just put:

python pyldd2obj.py

Share this post


Link to post
Share on other sites

/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'pyldd2obj.py': [Errno 2] No such file or directory

thats what i got when i did the command.

Share this post


Link to post
Share on other sites

Are you sure the file pyldd2obj.py is in the same directory as where you currently in ?

Share this post


Link to post
Share on other sites

no i did not do that. i just wrote the command as is with no directory.  but i moved the script to the desktop if it makes a difference.

i am betting this is a tall order but maybe a video tutorial would help me. i dont think i understand written direction.

Share this post


Link to post
Share on other sites

1. install LDD
2. copy the script and the lxf to a folder
3. open console
4. navigate to the folder
5. run "python pyldd2obj.py nameofyour.lxf nameoutputobj"
6. now you have nameoutputobj.obj at the folder

1698031672_runpyldd2obj.thumb.JPG.150af48067be6da673eddc3db043bb81.JPG

thats all

Share this post


Link to post
Share on other sites

maybe this is just a Maya issue but the OBJ objects seem to share faces so Maya has to merge them into one group. also, it comes with an mtl file but I see no PNGs that would be referenced in the shader.

Share this post


Link to post
Share on other sites
On 7/13/2019 at 12:08 AM, Kalta the Noble Mind said:

maybe this is just a Maya issue but the OBJ objects seem to share faces so Maya has to merge them into one group. also, it comes with an mtl file but I see no PNGs that would be referenced in the shader.

Is it different bricks overlapping and sharing faces ? I guess this is ‘normal’. The script just takes the 3D data as it comes from LDD. I guess one could add a scaling matrix to ‘shrink’ every brick by 1-2% to remove overlapping - if this is the overlapping problem you refer to. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.