LDraw.org Discussion Forums
Generate LDCad parts bin custom list. - 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 LDCad parts bin custom list. (/thread-15309.html)

Pages: 1 2


Generate LDCad parts bin custom list. - Trevor Sandy - 2015-01-27

You can generate LDCad parts bin lists using this modified version of BrickUtils: BrickUtils-0.2.0.0(trev).jar, (.exe version).

Other modifications include the ability to create part-mappings. For a complete list of BrickUtils modifications see the ChangeLog.

This application is distributed under the terms of the GNU General Public License. You can download the source code here.

BrickUtils is free software developed by Mario Pascucci and is available on SourceForge.

For example, after importing bricklink .xml set into BrickUtils(trev)...

Following are the steps to generate a .pbg file (LDCad parts bin list):

   


.png   BrickUtils_02.png (Size: 7.54 KB / Downloads: 165)


.png   BrickUtils_03.png (Size: 6.86 KB / Downloads: 163)

   

   

Do not hesitate if you have any questions or remarks.

Cheers,
Trevor


Re: Generate LDCad parts bin custom list. - Roland Melkert - 2015-01-27

Very handy indeed.

This is now (as far I know of) officially the first 3rd party support tool for my LDCad, thanks Smile


Re: Generate LDCad parts bin custom list. - Jason Smith - 2015-01-28

Trevor I'm trying to run this on Ubuntu, which .jar file is the one to start? I tried to create a runme.sh of a few but couldn't get it to go.


Re: Generate LDCad parts bin custom list. - Trevor Sandy - 2015-01-28

Hello Jason - sorry, the previous executable jar file contained only Windows library jars (gluegen & jogl), as it was the dev version ;-).

I have since updated the download jar. The current download now contains the full cross-platform compliment of library jars.

I suspect the missing linux platform glugen and gogl jars may have caused your issue. Please try the current download and let me know if you continue to have unexpected behavior.

To answer your question, start the BrickUtils-0.2.0.0(trev).jar file. The launch class is brickUtils.

java -jar <filename>.jar should do - I would rename the file:-).

Please note that I did not run/test on linux; however, I do not believe my updates would have impacted the original BrickUtils cross-platform compatability.

Cheers,
Trevor


Re: Generate LDCad parts bin custom list. - Trevor Sandy - 2015-01-28

You are welcome! LDCad is an excellent application.


Re: Generate LDCad parts bin custom list. - Jason Smith - 2015-01-28

Well it worked Smile Fantastic I must say.

The only issues I had was it wouldn't run until I renamed it, more specifically I had to remove the () from the file name. For some reason it ran after removing just those.

Then it just hung on downloading the LDraw library zips, it just sat at 0% forever. So I simply copied the two zips into the folder and it started right up.

I went through your steps above with a recent moc of mine and it all worked great.

Great work, thank you.


Re: Generate LDCad parts bin custom list. - Trevor Sandy - 2015-01-28

Excellent, you are welcome!

Cheers,
Trevor


Re: Generate LDCad parts bin custom list. - Philippe Hurbain - 2015-02-24

I used your tool to build this http://forums.ldraw.org/showthread.php?tid=15670&pid=15670#pid15670 - very handy!
Actually the only thing I struggled with was downloading xml from Bricklink...

I initially expected LDCad to decrease part count as they are used in the model, but I realize now that it is far from obvious to do when using submodels!


Re: Generate LDCad parts bin custom list. - Merlijn Wissink - 2015-02-24

I download my xml files from Rebrickable, that's a lot easier than Bricklink.


Re: Generate LDCad parts bin custom list. - Roland Melkert - 2015-02-24

Philippe Hurbain Wrote:I initially expected LDCad to decrease part count as they are used in the model, but I realize now that it is far from obvious to do when using submodels!
That's a planned feature Smile


Re: Generate LDCad parts bin custom list. - Philippe Hurbain - 2015-12-11

Hi Trevor,
I like this tool a lot, problem is that the database that makes the link between Bricklink and LDraw part numbers is no longer updated by Mario (see http://www.eurobricks.com/forum/index.php?showtopic=65428&st=50#entry2402478), any idea how this could be done?


Re: Generate LDCad parts bin custom list. - Trevor Sandy - 2016-01-08

Hi Philo,

I imagine if you follow the url in the settings window (BrickUtills update URL) - you can download the last copy of the mapping input xml file. Then you can update and host it as you want.

In fact here's the url https://sourceforge.net/projects/brickutils/files/brickutils/updates/.

Pointing BrickUtils to your URL should allow you to automate the import.

Perhaps it could be good to find a source (BrickLink ?) that could provide a consistent part mapping data feed - then it would not be too much to process for BrickUtils needs.

Cheers.


Re: Generate LDCad parts bin custom list. - Philippe Hurbain - 2016-01-08

Mmhhh... I slowly start to understand things but...
Editing the xml is tedious at best. I have the feeling that the "Part Mapping" tab of Brickutils should be able to define new mappings but despite many attempts I can't figure out how it's supposed to work - Mainly how to add a new entry ???


Re: Generate LDCad parts bin custom list. - Trevor Sandy - 2016-01-09

Ah, good question. I remember when I added this functionality, I wanted to respect Mario Pascucci's original intent to keep the system closed. To this end, you cannot add mappings from the UI; instead, upon BrickLink XML dump import the application will automatically transfer unmapped parts to the Part Mapping tab. At this time, you have to functionality to 'manually' create mappings and save them to the database.

So one way to add new mappings is to create and import a BL XML dump formatted XML file with the parts '<ITEM>' you want to add. The format is pretty simple. Here is an example:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<INVENTORY>
   <ITEM>
      <ITEMTYPE>P</ITEMTYPE>         <!-- P=Regular Part             -->
      <ITEMID>2431</ITEMID>            <!-- Part Number                -->
      <QTY>2</QTY>                       <!-- Part Quantity              -->
      <COLOR>1</COLOR>                <!-- BrickLink Color Code       -->
      <EXTRA>N</EXTRA>                 <!-- Extra in set (Default=N)   -->
      <ALTERNATE>N</ALTERNATE>     <!-- Alternate Part (Default=N) -->
      <MATCHID>0</MATCHID>             <!-- Set Alternate (Default=0)  -->
      <COUNTERPART>N</COUNTERPART>  <!-- Part Assembly (Default=N)  -->
   </ITEM>
</INVENTORY>

Let me know if this helps.

Cheers,


Re: Generate LDCad parts bin custom list. - Philippe Hurbain - 2016-01-10

Not yet completely sure to know what I am doing, but I was able to define a few new mappings, so I should finally get it... Thanks Wink


Re: Generate LDCad parts bin custom list. - Jetro de Château - 2016-02-15

On a related note, I'm trying to track down a number of parts that don't have an LDraw ID in the imported brick list I get in the modded version of BrickUtils. What is the smartest way of gong about finding those references?

I'm looking at the WeDo 9580-1 set inventory and I'm missing a couple of minifig parts (heads and torso)


Re: Generate LDCad parts bin custom list. - Philippe Hurbain - 2016-02-15

I click on column "LDraw ID" header. The table gets sorted by LDraw id and the missing ones are on top.


Re: Generate LDCad parts bin custom list. - Jetro de Château - 2016-02-15

I know which ones I am missing. I was hoping for some pointers on how to located the correct LDraw reference for those parts.


Re: Generate LDCad parts bin custom list. - Philippe Hurbain - 2016-02-15

Sorry, misunderstood your need. I have no good solution for your problem, except (perhaps) enter portions of description in LDFind...


Re: Generate LDCad parts bin custom list. - Jetro de Château - 2016-02-17

OK. So I'm not really missing any obvious better methods. Thanks for confirming. The parts that are missing are not really important, I just thought I'd ask in case I this comes up again.


Re: Generate LDCad parts bin custom list. - Jaco van der Molen - 2016-02-20

Hi,
I am unable to run both exe and jar versions of brickutils.
What do I need to run it?


Re: Generate LDCad parts bin custom list. - Philippe Hurbain - 2016-02-20

I use the exe version, and as far as I remember I did nothing special to get it work (Win 7 home, or win XP). Any error message?


Re: Generate LDCad parts bin custom list. - Jaco van der Molen - 2016-02-20

Win XP.
Nothing happens. Starting the exe says am I sure to open a downloaded programm > Yes.
Few seconds activity, then nothing. No errors, no messages, no program started, not even in the task manager....
Strange.


Re: Generate LDCad parts bin custom list. - Philippe Hurbain - 2016-02-20

??? Sad


Re: Generate LDCad parts bin custom list. - Jaco van der Molen - 2016-02-20

Ok, I got the original jar file of SF for the last "official" version of BrickUtils and that one starts.
After downloading a lot of stuff, I can at least work with it (not that I know what to do yet)
The main reason I wanted to look into this is creating the custom part bins for sets.

Now why can I not run Trevor's version of the jar? Does it need additional files?
I see the original created a folder and made some files and downloaded a lot of stuff.
And why does the exe nothing?


Re: Generate LDCad parts bin custom list. - Jetro de Château - 2016-02-21

Not sure why it won't work on your system. I installed it on Windows 10 and on Windows 7 without trouble.
It did take quite some time to download files before the program was ready the first time and some of the window it opened were extremely well hidden behind other applications that were open at the time.


Re: Generate LDCad parts bin custom list. - Jaco van der Molen - 2016-02-21

OK, so I closed all other programs. I have shotcut icon to the original version of brickutils jar file on my desktop.
When I click that a small popup shows the logo and Starting.... this takes a few seconds.
Then another pop up says checking Update site, takes a few sconds more en the brickutils starts up nice in a new window.

When I do this with the jar file Trevor made nothing happens. This file is in the same folder that the original is, so it could find all databases and stuff.

So I took a look in the taskmanager. When the original is loaden a process called javaw.exe is active.
When I start Trevors version with the taskmanager visible I briefly see this process being started and then it closes again.
It seems that a full startup is not working. I does something, but no errors show.

Any ideas?
I would love to be able to make a custom part bins for LDCad.... :-)


Re: Generate LDCad parts bin custom list. - Jetro de Château - 2016-02-26

I ran into another curious issue:

I opened a new working list, imported an XML from the 45544-1 set and named it as per the pop-up dialogue.
I then modified the list to include missing elements and change a colour.
I then tried to export as LDCad Parts-bin set and get a pop-up window saying:

"Please add ste/lot/moc description"

No matter what changes I make I cannot get the set/lot/moc information to stick - each time I change the description I get the same error and each time I open the window to change it that window has no previous data.
Also, I cannot use the search function next to the Official set id field as the next window to open will not run the search (the top field never shows anything to choose from)

What am I missing?


Re: Generate LDCad parts bin custom list. - Jaco van der Molen - 2016-02-26

Does anyone have a clue as to why Trevors version won't work on my system?


Re: Generate LDCad parts bin custom list. - Jetro de Château - 2016-02-26

On a related note, would it make sense to create a repository of .pbg files for sets?


Re: Generate LDCad parts bin custom list. - Jetro de Château - 2016-02-26

Do you have Java installed?


Re: Generate LDCad parts bin custom list. - Jaco van der Molen - 2016-02-26

Jetro de Château Wrote:Do you have Java installed?

Sure. The original BrickUtils runs fine.


Re: Generate LDCad parts bin custom list. - Jaco van der Molen - 2016-02-26

Would there be another way to create a pbg file?
The inventories are on Bricklink or Rebrickable, right?
Can we not create it another way?


Re: Generate LDCad parts bin custom list. - Jetro de Château - 2016-02-26

Installed it on a different system and works fine. Maybe I should simply delete it entirely and start afresh...


Re: Generate LDCad parts bin custom list. - Jetro de Château - 2016-02-26

You can do it manually, following the file specs, but that's tedious work.


Re: Generate LDCad parts bin custom list. - Jaco van der Molen - 2016-02-26

Trevor Sandy Wrote:[attachment=1456]

Hmm, looking at this I think it would be possible to create a pbg file manually using a dump from Bricklink or Rebrickable and with some Excel work perhaps. I'll try some things...


Re: Generate LDCad parts bin custom list. - Jetro de Château - 2016-02-26

I've found that Brickutils will not apply the correct colour for some elements. I applied metallic silver for the castor ball in the EV3 set and when I checked the file the number that came out was -1
I also cannot set rubber colours in Brickutils so I did that manually


Re: Generate LDCad parts bin custom list. - Jaco van der Molen - 2016-02-27

OK, I've succesfully created a pbg of an official set by hand. Using an inventory on Brickset I copied to Excel and create the right format of the text. It was actually not that hard or much work, though I have to add the ribbed hoses and tubes.

Code:
[options]
kind=basic
caption=Set 8246
description=Parts in the 8246 set
picture=8246.png
sortOn=description

<items>
2780.dat:[color=0] [count=2]
2825.dat:[color=0] [count=2]
2905.dat:[color=14] [count=2]
3069bp28.dat:[color=0] [count=1]
32000.dat:[color=71] [count=1]
32013.dat:[color=0] [count=2]
32013.dat:[color=14] [count=2]
32014.dat:[color=0] [count=2]
32039.dat:[color=0] [count=2]
32062.dat:[color=0] [count=1]
32063.dat:[color=0] [count=2]
32068.dat:[color=71] [count=1]
32073.dat:[color=0] [count=3]
32123b.dat:[color=71] [count=3]
32125.dat:[color=4] [count=1]
32138.dat:[color=14] [count=1]
3482.dat:[color=0] [count=3]
3705.dat:[color=0] [count=3]
6558.dat:[color=0] [count=3]
6589.dat:[color=71] [count=2]
85543.dat:[color=15] [count=2]



Re: Generate LDCad parts bin custom list. - Merlijn Wissink - 2016-02-27

Rebrickable has a lot of export options for inventories and parts lists. Maybe they'd like to include LDCad's pbg format too. I'll ask Nathan (from Rebrickable) to see what he thinks Smile


Re: Generate LDCad parts bin custom list. - Jaco van der Molen - 2016-02-27

Merlijn Wissink Wrote:Rebrickable has a lot of export options for inventories and parts lists. Maybe they'd like to include LDCad's pbg format too. I'll ask Nathan (from Rebrickable) to see what he thinks Smile
Oh, that would be nice :-)


Re: Generate LDCad parts bin custom list. - Jaco van der Molen - 2016-02-27

Don't know if this has been posted before, but would it be nice to have a PBG repository too?


Re: Generate LDCad parts bin custom list. - Roland Melkert - 2016-02-27

"though I have to add the ribbed hoses and tubes."

You can add templates to pbg's too. See for example the 8071.pbg in the sets folder:

-------

[options]
kind=basic
caption=Set 8071
description=Parts in the 8071 set
picture=8071.png
sortOn=description


<items>
path\rigid3mmHose.ldr:[sourceInv=templates] [color=0]
3623.dat:[color=0] [count=2]
2444.dat:[color=0] [count=4]
61409.dat:[color=0] [count=2]

-------


Ps: disabled bbcode as it messes with the [ ] properties.


Re: Generate LDCad parts bin custom list. - Jetro de Château - 2016-02-27

See above Big Grin

Jetro de Château Wrote:On a related note, would it make sense to create a repository of .pbg files for sets?



Re: Generate LDCad parts bin custom list. - Merlijn Wissink - 2016-02-28

In my opinion: no.

I mean, it's just a bunch of set inventories structured in such a way LDCad can use it. We don't have any repositories for .xml inventories, .bsx inventories or whatever other format because it's all the same; just another format with the same data.

With the right program, it's as easy as choosing a set and pressing a button to get a .pbg file. We don't need a repository for that imho.


Re: Generate LDCad parts bin custom list. - Philippe Hurbain - 2016-02-28

I agree that a good export function from any inventory website would be much better! Remains the problem of matching database nomenclature between both systems (LDraw vs. inventory website)


Re: Generate LDCad parts bin custom list. - Merlijn Wissink - 2016-02-28

That's true. Although Rebrickable (which I mentioned earlier) already has a pretty good Lego part # > LDraw part # database in place, including a lot of patterned parts. It's probably not complete and fully up to date (yet?), but it's a pretty good start nonetheless.


Re: Generate LDCad parts bin custom list. - Jetro de Château - 2016-02-28

Merlijn Wissink Wrote:We don't have any repositories for .xml inventories, .bsx inventories or whatever other format because it's all the same; just another format with the same data.

With the right program, it's as easy as choosing a set and pressing a button to get a .pbg file. We don't need a repository for that imho.
If only Big Grin
There are XML repositories (like Bricklink and ReBrickable), but the conversion process is far from "easy".

Philippe Hurbain Wrote:I agree that a good export function from any inventory website would be much better! Remains the problem of matching database nomenclature between both systems (LDraw vs. inventory website)
And that's exactly my point. There are a lot of mismatches, but that's not the only ting.
Yesterday I tried to create a .pbg file for the 45544-a EV3 Core set and I ran into a number of more or less important issues:
  • I tried both Bricklink and ReBrickable. Bricklink turned out to have the most complete information - there were more gaps in the LDraw conversion list with ReBrickable than with Bricklink
  • A considerable number of elements do not have any mapping to their LDraw counterparts. For the most part conversion is straightforward and the Bricklink number can be used adding .dat. However, you need to check case by case since it doesn't always work and sometimes there are surprising mismatches. (e.g. the 25cm EV3 wire is BL ID bb601, LDraw ID 11145.dat
  • Colours information is not reliable either. All the EV3 electronics were referenced as black when they are white and rubber elements were simple black, wires were black, but LDCad knows they are black and requires trans to be set for the connectors...
  • Colour assignment in brickutils is incomplete as it doesn't allow for rubber colours and gave me an error with metallic (256 became -1)
  • Not every part is really a part:
    Roland Melkert Wrote:You can add templates to pbg's too
    This of course also requires tweaking the set. Many Technic sets would benefit from having templates included rather than a part reference to e.g. a Power Functions motor.
  • Ultimately, it would be really cool of LDCad included a feature that allowed for easy access to single set element sets. Not by manually modifying some files in the %appdata% directory, but through a menu in the interface. Imagine the option to load or add a set from a menu so the set is displayed under root/sets/<setnumber>. To make this accessible to the average user (not simply those of us who like to play around with progam settings and are not scared of digging into configuration files) easy access to correctly formatted part lists for specific sets woud be an important asset.



Re: Generate LDCad parts bin custom list. - Roland Melkert - 2016-02-28

Jetro de Château Wrote:Ultimately, it would be really cool of LDCad included a feature that allowed for easy access to single set element sets. Not by manually modifying some files in the %appdata% directory, but through a menu in the interface. Imagine the option to load or add a set from a menu so the set is displayed under root/sets/<setnumber>. To make this accessible to the average user (not simply those of us who like to play around with progam settings and are not scared of digging into configuration files) easy access to correctly formatted part lists for specific sets woud be an important asset.
pbg gui editing is something I have in the pipeline, which should at least make it easier. I could also add a .pbg file drop handler which offers to copy the dropped file to e.g. the sets folder.


Re: Generate LDCad parts bin custom list. - Jaco van der Molen - 2016-02-29

Found it, Roland! My PBG of set 8246 is now complete.
Building it in LDCad now took less then 25 minutes... :-)


Re: Generate LDCad parts bin custom list. - Milan Vančura - 2016-02-29

Brickstock is usually helpful with that. However, it is not 100% perfect either and - even worse - the author does not communicate at all. I tried to contact him on Bricklink (he prefers that according to his own words) and e-mail and he did not reply me a word. Even I asked for such basic things like program sources. De facto, this is a GPL license violation...