Download the LDraw partlist as .csv or .xml


Download the LDraw partlist as .csv or .xml
#1
Hello!  I've worked with several of you in the past because I use LDraw models to create the crisp part images for my LEGO Brick Labels and Most Common LEGO Parts guides at brickarchitect.com website.

I am getting ready to launch a significant new feature on my website that allows users to browse through the most common / important LEGO parts in a friendly user experience that helps people organize their parts better — and understand how LEGO works so they can become better builders!

[Image: 2024-01-29-SNOT-Category-with-mouse-cursor-720x591.png]
The galleries are a beautiful showcase of many of the parts included in the LDraw collection.

(I shared some more photos of this experience here: https://brickarchitect.com/2024/january-...s-roundup/)

[Image: 2024-01-29-Part-Page-1x2-Jumper-720x538.png]
Page to learn more about each part.  This is an older screenshot - it now shows the part names from Rebrickable, BrickLink, and Brickset.


I am still designing the experience which appears when you click on each part, but one of the most useful features so far is the ability to find links to learn more about that part on many different LEGO websites including ldraw.org.


ASK: Is there a way to download the list of parts in an easily-imported format such as a CSV or XML file?  I would like to show the LDRAW Part Names right next to each entry, just like I am already showing for Rebrickable, Brickset, and BrickLink?



P.S. I am not ready to share the preview link broadly, but if you want to play with the new experience and give feedback, PM me or email me at [email protected] - thanks!
Reply
RE: Download the LDraw partlist as .csv or .xml
#2
Does this fit what you want:
https://library.ldraw.org/library.csv

Rebrickable uses it so I can't alter it, but I can make a link file with the info you want.
Reply
RE: Download the LDraw partlist as .csv or .xml
#3
(2024-02-05, 20:56)Orion Pobursky Wrote: Does this fit what you want:
https://library.ldraw.org/library.csv

Rebrickable uses it so I can't alter it, but I can make a link file with the info you want.

That looks great - I will import it this evening and confirm that it works fine as-is... (I think it will be fine!)

I am not doing it right away, but is it OK to create a scheduled task to download it automatically once a day from my server to ensure it is up-to-date?
Reply
RE: Download the LDraw partlist as .csv or .xml
#4
(2024-02-05, 21:27)tom alphin Wrote: I am not doing it right away, but is it OK to create a scheduled task to download it automatically once a day from my server to ensure it is up-to-date?

I think this is what Rebrickable does. Note this file is live updated from the DB every time the link is called so don't hit it too hard but once a day is totally fine.
Reply
RE: Download the LDraw partlist as .csv or .xml
#5
(2024-02-05, 22:08)Orion Pobursky Wrote: I think this is what Rebrickable does. Note this file is live updated from the DB every time the link is called so don't hit it too hard but once a day is totally fine.

Does the database keep track of the last time that a given file was updated? That would be a useful thing to add to the CSV file, although I do not need it anytime soon.

Since you have only one (now two) known callers, you can see if rebrickable is resilient to adding another column instead of making a new table :-)
Reply
RE: Download the LDraw partlist as .csv or .xml
#6
(2024-02-05, 22:33)tom alphin Wrote: Does the database keep track of the last time that a given file was updated?

The answer is kinda. The DB does have a created at and updated at timestamp for every part. However, the earliest timestamp would be January of last year since that's when the new PT was put into place and the data imported from the old PT which didn't track this information. The work around would be to have official parts give the date of the last associated release for updated at and unofficial part give the update at timestamp.
Reply
RE: Download the LDraw partlist as .csv or .xml
#7
(2024-02-05, 22:41)Orion Pobursky Wrote: The answer is kinda. The DB does have a created at and updated at timestamp for every part. However, the earliest timestamp would be January of last year since that's when the new PT was put into place and the data imported from the old PT which didn't track this information. The work around would be to have official parts give the date of the last associated release for updated at and unofficial part give the update at timestamp.

That is probably good enough since my goal would be to know when I need to update the part image because the underlying 3d model had changed.  No need to add this right now - i'm not ready to use it yet.

---tom
Reply
RE: Download the LDraw partlist as .csv or .xml
#8
I discovered an issue with the CSV output, since I was only able to import 15999 lines out of 17489.
The output does not escape commas, which doesn't work since it is a comma-separated format.


Here's an example of a row that breaks the input:
Code:
6092.dat,Baseplate 32 x 32 Raised with Ramp, Pit and Stairs,https://library.ldraw.org/library/official/parts/6092.dat,https://library.ldraw.org/images/library/official/parts/6092.png
Reply
RE: Download the LDraw partlist as .csv or .xml
#9
I've modified the file to encase the description in double quotes and escape the quotes in the description. I also added a Image Last Modified stamp.
Reply
RE: Download the LDraw partlist as .csv or .xml
#10
(2024-02-06, 2:40)Orion Pobursky Wrote: I've modified the file to encase the description in double quotes and escape the quotes in the description. I also added a Image Last Modified stamp.


❤️ - Thank You!

I have imported the entire file into my website and can now see the LDraw part names in my website.  This is fantastic!

---tom

P.S. I did not investigate further, but there are 190 duplicate rows in that table (assuming that part number is a primary key).  Just thought you should know in case this is a data integrity concern.
Reply
RE: Download the LDraw partlist as .csv or .xml
#11
Perhaps this could be it's own thread, but it's closely related so I'll ask here:

Is there a similar source (CSV or db) which includes a mapping between the ldraw and bricklink/studio/rebrickable part numbers?


Reply
RE: Download the LDraw partlist as .csv or .xml
#12
(2024-02-09, 9:21)CJ H. Wrote: Perhaps this could be it's own thread, but it's closely related so I'll ask here:

Is there a similar source (CSV or db) which includes a mapping between the ldraw and bricklink/studio/rebrickable part numbers?

For Studio/BL, you can use StudioPartDefinition2.txt (TSV) in Studio’s files (folder data).
Reply
RE: Download the LDraw partlist as .csv or .xml
#13
(2024-02-12, 7:37)Sylvain Sauvage Wrote: For Studio/BL, you can use StudioPartDefinition2.txt (TSV) in Studio’s files (folder data).

Thanks. I'll try that.


Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 3 Guest(s)