Jump to content

LDD Parts List generator


bartvbl
 Share

Recommended Posts

Brilliant! I've always wanted a tool like this, I'll try it out later. When you say that it gives names, are these LEGO names, Bricklink names, or something else?

Link to comment
Share on other sites

Brilliant! I've always wanted a tool like this, I'll try it out later. When you say that it gives names, are these LEGO names, Bricklink names, or something else?

They are the names used by LDD. You can occasionally see them when hovering over a brick in the brick menu.

Link to comment
Share on other sites

ProfessorBrickkeeper

Nice job bartvbl, I'll have to remember to try this when I can... If you add an Bricklink XML generator and exporter as well, then you could end up being able to rival Brickhelper... :)

Link to comment
Share on other sites

Download, but didn't know how to use it for lack of readme (ended up extracting the JAR and reading your strings).

Can you provide source code perhaps? I'd love to see how it's written. It looks pretty simple.

Link to comment
Share on other sites

Download, but didn't know how to use it for lack of readme

I tried it out, and its usage involves putting an lxf file in the same folder as the JAR, then then typing in the filename upon using.

 

Seems quite useful.

Link to comment
Share on other sites

Download, but didn't know how to use it for lack of readme (ended up extracting the JAR and reading your strings).

Can you provide source code perhaps? I'd love to see how it's written. It looks pretty simple.

Sorry about that! Yes, the program is *very* simple. I thought that by running it it would explain itself well enough, but I guess that wasn't the case. If you run it, it'll ask you to enter a .lxf file name of a file that is located in the same directory as the jar. Though I suppose you can also supply it with an absolute path to a file if you so desire. It will then spit out an html file in the same directory as the jar that has thec same name as the LXF file, which contains the parts list.

 

Here's the complete source code (2 files): http://pastebin.com/2udFzVCU

 

There's a third file in the jar that parses the XML files that define the bricks, but isn't actually used in the tool. I used JrMasterModelBuilder's (did I get that right?) LIF exctractor to get to those :D

 

Here's the source of that one: http://pastebin.com/87b6kfhi

 

Note that for both "tools" you need to add XOM to the buildpath. Get it at http://xom.nu/

 

Edit: yes, the code is pretty horrible. But hey, it's a really small tool :P

Link to comment
Share on other sites

That is pretty simple, as you said. It could even be easily ported to other languages! (No, I'm not going to port it to Python. :P)

 

I'm a bit surprised you write an XHTML file instead of an HTML5 file, but if it works, it works.

 

There's a third file in the jar that parses the XML files that define the bricks, but isn't actually used in the tool. I used JrMasterModelBuilder's (did I get that right?) LIF exctractor to get to those :D Here's the source of that one: http://pastebin.com/87b6kfhi

 

Yes, you got JMMB's name right. His LIF Extractor doesn't produce a file list, unless you edited it to write one as it extracted the archive. As for your source, it looks like it just creates a simple file tree almost. This would create the partsList.txt file if it were run, correct?

 

Good job on the tool. I've seen these tools before (plenty on Sourceforge, LDD 4.1.8 even added a BOM), but this makes a very clean, mostly understandable HTML file (few small could be tweaks might help it, but that could just be me. :P). :)

Link to comment
Share on other sites

I'm a bit surprised you write an XHTML file instead of an HTML5 file, but if it works, it works.

I tried to keep it as simple as possible, so I just used a simple good ol' HTML 4 table

 

Yes, you got JMMB's name right. His LIF Extractor doesn't produce a file list, unless you edited it to write one as it extracted the archive. As for your source, it looks like it just creates a simple file tree almost. This would create the partsList.txt file if it were run, correct?

From the top of my head, you first extract the Assets.lif file, then find db.lif and extract that one. Finally, go into the Assets/db/Primitives folder. It should be stuffed with XML files and a folder called "LOD0". Each of those XML files is named after the part number (ex. 2863.xml), and they all have the part name stored in the XML file itself. So all I had to do to get a link between the part number and its name was to open each XML file, read its name, and link it to its file name. I dumped it to the console, saved the contents of the console to the "partNames.txt" that comes with the converter. Then the parts list generator loads that in at runtime (way faster than looking through all the XML files again, saves a couple of seconds :P)

 

Good job on the tool. I've seen these tools before (plenty on Sourceforge, LDD 4.1.8 even added a BOM), but this makes a very clean, mostly understandable HTML file (few small could be tweaks might help it, but that could just be me. :P). :)

Oh yeah, totally. Because I Definately didn't forget to add some margin to the table headers

 

*ahem*

Link to comment
Share on other sites

I tried to keep it as simple as possible, so I just used a simple good ol' HTML 4 table

 

I was more or less referring to the HTML5 doctype, not using HTML5-only code. A table works well either way.

 

From the top of my head, you first extract the Assets.lif file, then find db.lif and extract that one. Finally, go into the Assets/db/Primitives folder. It should be stuffed with XML files and a folder called "LOD0". Each of those XML files is named after the part number (ex. 2863.xml), and they all have the part name stored in the XML file itself. So all I had to do to get a link between the part number and its name was to open each XML file, read its name, and link it to its file name. I dumped it to the console, saved the contents of the console to the "partNames.txt" that comes with the converter. Then the parts list generator loads that in at runtime (way faster than looking through all the XML files again, saves a couple of seconds :P)

 

Except db.lif is located in %AppData%LEGO CompanyLEGO Digital Designerone more folder here, I think. Yea, what you just said is what I got from reading your source. I was positive it didn't have any file writing code, and since I saw it dumped it to the console, I figured you just copy-pasted it into a file. I think the method works well, better than going through the XMLs every time (though it has be to be updated with each LDD release).

 

Oh yeah, totally. Because I Definately didn't forget to add some margin to the table headers *ahem*

 

You know what this sounds like? You need to put the source on GitHub so you can revisions. :P

Link to comment
Share on other sites

You know what this sounds like? You need to put the source on GitHub so you can revisions. :P

Or better: so that I can accept pull requests ;)

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.