LDraw.org Discussion Forums
Generate custom LDCad set part bin - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: LDraw Editors and Viewers (https://forums.ldraw.org/forum-11.html)
+--- Thread: Generate custom LDCad set part bin (/thread-21758.html)



Generate custom LDCad set part bin - Trevor Sandy - 2016-09-08

This walkthrough will demonstrate how to generate a LDCad Set part bin using my fork of BrickUtils.

You can download BrickUtils2.5.exe or BrickUtils2.5.jar archive distribution.

As set is defined as the collection of parts needed to digitally configure a model.

A set part bin will contain a set's parts and, optionally, quantity of each part.

This walkthrough will use example set LEGO Technic 42046 - Getaway Racer.

You can also download the 42046-01.zip walkthrough archive.

1.   Download Bricklink Set xml file
1.1 Be sure to check the "Inventory" radio button
1.2 Select "Set" at the inventory dropdown dialog
1.3 Add suffix "-01" to the set number and enter into "Item No:" dialog - e.g. 42046-01
1.4 Select "XML" at the "Download Format:" dropdown dialog
1.5 Rename S-42046-01.xml to 42046-01.xml

2.   Do Google Image Search for "Technic 42046.png"
2.1 Select and save .png image (best with transparent background) as 42046-01.png
   

3. Import 42046-01.xml into BrickUtils using "Bricklink XML dump" menu button 
   

4.   Configure imported set data
4.1 Define set attributes using search dialog button
4.2 Click "Search", enter "42046" in "By set #" dialog and click "Search"
4.3 Select available row and click "OK"
4.4 Remove extra parts and sticker sheet
   

5.   Map missing LDraw part numbers in "Part Mapping" tab(as necessary)
5.1 Parts with missing LDraw number are automatically transferred to the "Part Mapping" tab
5.2 Delete sticker set from part mapping
5.3 Search for parts in LDraw part library
5.4 Add part to part mapping
   

6.   Rebuild working list
6.1 Confirm no more missing LDraw part numbers
   

7.   Generate part bin (.pbg) file
7.1 Export parts bin set .pbg file using "LDCad Parts-bin Set" menu button
7.2 Select "Include quantity" set option if you want to see in the LDCad parts bin the quantity of each part used
7.3 Save file as 42045-01.pbg
7.4 Confirm Save status
7.5 Open .pbg file in text editor and confirm image name - e.g. 42046-01.png
7.6 Copy 42045-01.pbg and 42046-01.png to ".\LDCad\partBin\default\sets"
7.7 Launch LDCad and navigate to part bin: "Part Listings of LEGO Sets/Parts in the 42046-01 set"
   

8. Configure your model !
   

Note: The .pbg notation for adding LDCad template parts are as follows:
- wheel_15038+44771.ldr:[sourceInv=templates] [color=0]
- path\technicFlexAxle.ldr:[sourceInv=templates] [color=0]
- shortcut\hinge_2429+2430.ldr:[sourceInv=templates] [color=72]

Cheers,


RE: Generate custom LDCad set part bin - Philippe Hurbain - 2016-09-09

Thanks for the extensive tutorial... Maybe it should give more details in the parts mapping section which is imho the most troublesome point in the whole process...


Quote:You can download BrickUtils2.5.exe or BrickUtils2.5.jar archive distribution.
What is the difference between this version and the 0.2.0.0 published here http://forums.ldraw.org/thread-15309-post-15309.html#pid15309 ?


RE: Generate custom LDCad set part bin - Trevor Sandy - 2016-09-09

(2016-09-09, 7:12)Philippe Hurbain Wrote: Maybe it should give more details in the parts mapping section which is imho the most troublesome point in the whole process...


Quote:You can download BrickUtils2.5.exe or BrickUtils2.5.jar archive distribution.
What is the difference between this version and the 0.2.0.0 published here http://forums.ldraw.org/thread-15309-post-15309.html#pid15309 ?

Indeed, the part mapping functionality is not intuitive. Although this functionality is not related to generating a .pbg file is most certainly is complementary. Going forward, I'll update this post and post a separate walkthrough on using BrickUtils part mapping.

Actually, I can't really remember what I changed since 2.0.0 and I'm not interested to review the source. I did this enhancement as a quick-and-dirty modification to help me isolate only the parts needed for models with available parts list. From time to time, I've revisited the source performing little tweaks here and there. 

In writing the part bin walkthrough, I've decided there are some more tweaks worth doing. I'll put the source under CM for those tweaks and any future updates going forward.

Cheers,


RE: Generate custom LDCad set part bin - Philippe Hurbain - 2016-10-05

Hi Trevor,
Don't know how, but I managed to corrupt the database with a duplicated mapping entry (well... at least one). Now when I import a set that uses this part, I get a message  telling that the entry is duplicated, and no further brick is imported. Is there a way to delete the faulty entry? I'd hate to have to rebuild again the database from scratch...


RE: Generate custom LDCad set part bin - Trevor Sandy - 2016-10-06

(2016-10-05, 15:39)Philippe Hurbain Wrote: Is there a way to delete the faulty entry?

Philo, Yes there is. Roll up your DB admin sleeves...

BrickUtils uses H2 - the java SQL database (http://www.h2database.com/html/main.html). You'll need to start with obtaining their jdbc driver to connect - use the URL above.

Next you'll need a nice DB utility to query the BrickUtils dataset. I use Execute Query (http://www.executequery.org/index.php). It's java based and completely portable.

With Eq, you can directly manipulate the table or export to Excel (or whatever you want), manipulate the dataset and import. H2 is light-weight so you easily copy/paste to make a working copy of your BrickUtils DB.

Although it is quite obvious once you've connected the the schema, the data table you'll be interested in is PARTMAPPING. Here's an image of the schema.

   

Let me know if you need any specifics on setting up your DB connection ?

Cheers,


RE: Generate custom LDCad set part bin - Philippe Hurbain - 2016-10-06

Thanks Travis,
Got everything, but feel like a cow in front of a laptop... Many things a completely obscure for me Sad