LEGO 2 LDraw 2 BL


LEGO 2 LDraw 2 BL
#1
I'd like to discuss the argument opened here:

The LDD ldraw.xml file has this structure:

<!-- Arch  3 x  6 x  5  30613.dat -->
<!-- PAVILION 6X3X5  19063 -->
<Brick ldraw="30613.dat" lego="19063"/>
<!-- PAVILION 6X3X5  30613 -->
<Brick ldraw="30613.dat" lego="30613"/>

<!-- Animal Dolphin  6228b.dat -->
<!-- DOLPHIN 9M  6228 -->
<Brick ldraw="6228b.dat" lego="6228"/>

How does it look like in Studio?

How would an information like this treated in an editor? Would it show also the alternate number or just jump to the right part is an element number is entered say in a search?

w.
LEGO ergo sum
Reply
RE: LEGO 2 LDraw 2 BL
#2
(2019-04-07, 12:05)Willy Tschager Wrote: How would an information like this treated in an editor? Would it show also the alternate number or just jump to the right part is an element number is entered say in a search?

Could be as simple as XML:
Code:
<items>
 <item src="6228b" dst="6228"/>
</items>

or JSON:
Code:
[{src: '6228b', dst: '6228'}]

or even CSV
Code:
6228b,6228

An editor would use it as a translation table.

Any format could be generated if the 3rd party names would be stored in the parts tracker as metadata.

We could also introduce a new LDraw meta for this, and add it to the parts themselves. Eliminating the need for an index file altogether.
Reply
RE: LEGO 2 LDraw 2 BL
#3
(2019-04-07, 18:40)Roland Melkert Wrote: Could be as simple as XML:
Code:
<items>
 <item src="6228b" dst="6228"/>
</items>

or JSON:
Code:
[{src: '6228b', dst: '6228'}]

or even CSV
Code:
6228b,6228

An editor would use it as a translation table.

Any format could be generated if the 3rd party names would be stored in the parts tracker as metadata.

We could also introduce a new LDraw meta for this, and add it to the parts themselves. Eliminating the need for an index file altogether.

Hi all,

I think the two of you are talking about two different aspects. Roland is talking about how to store the information in files. One important aspect is whether to store the reference system of a part number explicitly. In the ldraw.xml file that Willy quoted the attribute names encode explicitly which is the lego number and which is the ldraw number. In my opinion this is preferable over src/dest. In the latter case you need meta information on the file in order to know how to use it. For example you need to know that this is an ldraw to lego translation file and not the other way around or ldraw to bricklink or whatever. In the former case, this information is stored in the content of the file itself. You could even have something like

Code:
<item ldraw="foo" lego="bar" bricklink="baz" />

in one go. Whether the file format is XML or JSON is not that important I think, but CSV might be too limited.

I think the last idea is interesting to store the information in the files themselves and eliminate the need for a translation file altogether. Roland, could you elaborate on that idea? Do you think of something like
0 ALIAS LEGO 6228
or what is the idea?

On the other hand, if I understand correctly, Willy is talking about how to expose this information (no matter how it is stored) to the user in an editor. I think from a model author's point of view there are several aspects. If I want to add a part to my model it would be most convenient if I can find it under any of its part numbers. Maybe I have found the part in a Lego model or on Bricklink or wherever and now I want to use it. On the other hand, in some situations I might want to use its number in a specific reference system. For example, I might want to look up on Bricklink how expensive the part is. Or I want to export a Bricklink XML file. It just happened to me that I exported such a file from LeoCAD and could not import it to Bricklink before I manually translated some of the part numbers. Ideally, this is to be avoided by an editor if such translation information is available.

Cheers,
Lutz
Reply
RE: LEGO 2 LDraw 2 BL
#4
(2019-04-07, 18:40)Roland Melkert Wrote: We could also introduce a new LDraw meta for this, and add it to the parts themselves. Eliminating the need for an index file altogether.

If I'm understanding this correctly, this suggestion would be to specify the part mapping within the individual part files. Given that BrickLink's part number change over time, wouldn't the implication of doing this be that then the individual LDraw part files would need to be updated? If so, I think an index file would be more preferable.

Also, if something along these lines sees the light of day, it might be worth liaising with rebrickable.com. They have a pretty good database mapping between LDraw, LEGO, BrickLink and BrickOwl part ids and a published API which might simplify the generation of any mapping file.

David
Reply
RE: LEGO 2 LDraw 2 BL
#5
(2019-04-08, 8:41)David Manley Wrote: If I'm understanding this correctly, this suggestion would be to specify the part mapping within the individual part files. Given that BrickLink's part number change over time, wouldn't the implication of doing this be that then the individual LDraw part files would need to be updated? If so, I think an index file would be more preferable.
The index file has more advantages:
* any utility can read just one file than thousands of files
* any standard format (JSON, YAML, XML...) allows us to use standard libraries immediately and easily
* there is a room for extensions (I'd like to have a database of existing colors for each part, one day in future... - I know, I know. It's hard to get and maintain. But let me dream, OK? Wink )
* any change is a problem of this index file, not a certification of the part
Reply
RE: LEGO 2 LDraw 2 BL
#6
I think we have to have this information outside the individual dat-files. The same dat-file would be referenced in many different ElementID. The same dat-file would be used in a red brick as in a blue brick, but have different ElementID.

ElementID = DesignID(shape of the brick) + colour of the brick.


And to make it even worse, sometimes the DesignID mean the shape of the brick, and sometimes it means the design of the print on the brick. The same DesignID could be printed on both a 3626c.dat and on 3626b.dat. But they would have uniqe ElementID numbers.

I think it would quickly become a nightmare to sort all this info correct.

And why do we want our own database when all of this is already at Rebrickable or Brickset?
Lets use what is already done and build on that.
Reply
RE: LEGO 2 LDraw 2 BL
#7
Fully agree with Magnus !
Reply
RE: LEGO 2 LDraw 2 BL
#8
Last time we recycled all parts through the PT to add the licence we had a stilstood of almost two years so adding this kind of information to the single parts is a no-go.

w.
LEGO ergo sum
Reply
RE: LEGO 2 LDraw 2 BL
#9
(2019-04-08, 22:24)Magnus Forsberg Wrote: I think we have to have this information outside the individual dat-files. The same dat-file would be referenced in many different ElementID. The same dat-file would be used in a red brick as in a blue brick, but have different ElementID.

ElementID = DesignID(shape of the brick) + colour of the brick.


And to make it even worse, sometimes the DesignID mean the shape of the brick, and sometimes it means the design of the print on the brick. The same DesignID could be printed on both a 3626c.dat and on 3626b.dat. But they would have uniqe ElementID numbers.

I think it would quickly become a nightmare to sort all this info correct.

And why do we want our own database when all of this is already at Rebrickable or Brickset?
Lets use what is already done and build on that.

I followed this article with great excitement and did not understand anything at the beginning.
Now that I know what is meant, I also think that we do not have to reinvent the wheel.
If nothing goes right, go left.
Reply
RE: LEGO 2 LDraw 2 BL
#10
(2019-04-07, 12:05)Willy Tschager Wrote: I'd like to discuss the argument opened here:

The LDD ldraw.xml file has this structure:

<!-- Arch  3 x  6 x  5  30613.dat -->
<!-- PAVILION 6X3X5  19063 -->
<Brick ldraw="30613.dat" lego="19063"/>
<!-- PAVILION 6X3X5  30613 -->
<Brick ldraw="30613.dat" lego="30613"/>

<!-- Animal Dolphin  6228b.dat -->
<!-- DOLPHIN 9M  6228 -->
<Brick ldraw="6228b.dat" lego="6228"/>

How does it look like in Studio?

How would an information like this treated in an editor? Would it show also the alternate number or just jump to the right part is an element number is entered say in a search?

w.

Following the discussion... have to think about contributing.
After all it was kind of "my idea..."  Blush
Jaco van der Molen
lpub.binarybricks.nl
Reply
RE: LEGO 2 LDraw 2 BL
#11
(2019-04-07, 12:05)Willy Tschager Wrote: I'd like to discuss the argument opened here:

The LDD ldraw.xml file has this structure:

<!-- Arch  3 x  6 x  5  30613.dat -->
<!-- PAVILION 6X3X5  19063 -->
<Brick ldraw="30613.dat" lego="19063"/>
<!-- PAVILION 6X3X5  30613 -->
<Brick ldraw="30613.dat" lego="30613"/>

<!-- Animal Dolphin  6228b.dat -->
<!-- DOLPHIN 9M  6228 -->
<Brick ldraw="6228b.dat" lego="6228"/>

How does it look like in Studio?

How would an information like this treated in an editor? Would it show also the alternate number or just jump to the right part is an element number is entered say in a search?

w.

I think this a fairly trivial problem to solve as long as the APIs to Rebrickable and Bricklink are robust. A simple script that runs every so often to update a database and then another script to pull info from the database to auto-generate a file in the format of choice (I think JSON is appropriate). Manual entries to the database would also be available to suppliment the API data. We could even do an initial population of the data by scraping already available KEYWORD data. Maybe a front end to allow searching. I'm super worried about it being 100% accuarate, just "good enough".
Reply
RE: LEGO 2 LDraw 2 BL
#12
(2019-04-09, 21:53)Orion Pobursky Wrote: I think this a fairly trivial problem to solve as long as the APIs to Rebrickable and Bricklink are robust. A simple script that runs every so often to update a database and then another script to pull info from the database to auto-generate a file in the format of choice (I think JSON is appropriate). Manual entries to the database would also be available to suppliment the API data. We could even do an initial population of the data by scraping already available KEYWORD data. Maybe a front end to allow searching. I'm super worried about it being 100% accuarate, just "good enough".

Could you find out if this is doable? As for 100% accuracy - we are working on this project for ... some 25 years ... and are still far from perfection ;-)

w.
LEGO ergo sum
Reply
RE: LEGO 2 LDraw 2 BL
#13
(2019-04-11, 7:17)Willy Tschager Wrote: Could you find out if this is doable? As for 100% accuracy - we are working on this project for ... some 25 years ... and are still far from perfection ;-)

w.

It is do-able. I've just knocked something together to process the rebrickable data using their published API. My attempt at producing a reasonable output is visible here.

There are a couple of rough edges to remove from my solution but I'll post my approach and scripts on here in the morning, should there be any interest.

David
Reply
RE: LEGO 2 LDraw 2 BL
#14
(2019-04-12, 12:34)David Manley Wrote: It is do-able. I've just knocked something together to process the rebrickable data using their published API. My attempt at producing a reasonable output is visible here.

There are a couple of rough edges to remove from my solution but I'll post my approach and scripts on here in the morning, should there be any interest.

David

Very nice. I think maybe we should seek a closer partnership with Rebrickable since they seem to be very LDraw friendly.
Reply
RE: LEGO 2 LDraw 2 BL
#15
(2019-04-09, 21:53)Orion Pobursky Wrote: I think this a fairly trivial problem to solve as long as the APIs to Rebrickable and Bricklink are robust. A simple script that runs every so often to update a database and then another script to pull info from the database to auto-generate a file in the format of choice (I think JSON is appropriate). Manual entries to the database would also be available to suppliment the API data. We could even do an initial population of the data by scraping already available KEYWORD data. Maybe a front end to allow searching. I'm super worried about it being 100% accuarate, just "good enough".
Jaco van der Molen
lpub.binarybricks.nl
Reply
RE: LEGO 2 LDraw 2 BL
#16
(2019-04-12, 12:34)David Manley Wrote: It is do-able. I've just knocked something together to process the rebrickable data using their published API. My attempt at producing a reasonable output is visible here.

There are a couple of rough edges to remove from my solution but I'll post my approach and scripts on here in the morning, should there be any interest.

David

If anyone wants to tutu with this, this zip file contains the necessary scripts. The requirements are; Comments:
  1. I have been running this on Windows 10, using PowerShell 5. It should run on earlier versions of Windows, depending on which version of PowerShell is installed on the OS. Try it and see.
  2. I'd suggest you alter the PowerShell script part_mapping_generate.ps1 on line 48 and update it with the path to your installation of saxon. You can pass this value in as a command line parameter if you so wish but I suggest this will quickly become tiresome
  3. While the output format appears to be okay, I need to do some checks on whether all the parts have been output. According to Rebrickable's website, they have 32 000+ parts in their database. The generated XML file currently contains 5 000+ parts. I'll to a bit of digging into this.
  4. Some rebrickable part ids map to multiple part ids in other systems. For example this part lists two LDraw part numbers. This can occur for systems other than just LDraw. My unconfirmed suspicion is that the first part number listed when there are multiple matches should be taken as the "best" match.
  5. I don't know whether rebrickable differentiates between the part id being the same between two systems (e.g. rebrickable and LDraw) and a part being only in rebrickable but not in LDraw. When the part id is the same, I think it does not explicitly identify the LDraw part id but is it doing the same thing when there is no equivalent LDraw part? Something I shall be digging in to.
  6. I keep forgetting how much I dislike PowerShell scripting.
Usage:
  1. The command is invoked from the Powershell command line thusly;
    .\part_mapping_generate.ps1 your-api-key xml-output-file-name json-output-file-name
  2. The parameter values influence its behaviour
  • .\part_mapping_generate.ps1 your-api-key
    Queries rebrickable and output XML to standard output
  • .\part_mapping_generate.ps1 your-api-key abc.xml
    Queries rebrickable and output XML to the file abc.xml
  • .\part_mapping_generate.ps1 your-api-key abc.xml abc.jsn
    Queries rebrickable, output XML to the file abc.xml and JSON interim output to abc.jsn
  • .\part_mapping_generate.ps1 "" abc.xml abc.jsn
    Takes its JSON input from abc.jsn rather than querying rebrickable and output XML to the file abc.xml
  • .\part_mapping_generate.ps1 "" "" abc.jsn
    Takes its JSON input from abc.jsn rather than querying rebrickable and output XML to standard output
If you have issues with getting this to run, please drop me a line.

Regards,

David
Reply
RE: LEGO 2 LDraw 2 BL
#17
The PowerShell script in the zip file has been updated. It is a bit "gentler" when querying Rebrickable and the shortage of parts being retrieved has been resolved.

Comments:
2. I suggest you alter the PowerShell script part_mapping_generate.ps1 on line 48 69 and update it with the path to your installation of saxon. You can pass this value in as a command line parameter if you so wish but I suggest this will quickly become tiresome.
Do something similar for the curl executable location on line 68.
3. While the output format appears to be okay, I need to do some checks on whether all the parts have been output. According to Rebrickable's website, they have 32 000+ parts in their database. The generated XML file currently contains 5 000+ parts. I'll to a bit of digging into this.
This has been resolved. I believe all parts are now being retrieved.

Usage:
  1. The command is invoked from the Powershell command line thusly;
    .\part_mapping_generate.ps1 your-api-key xml-output-file-name json-output-file-name
  2. The parameter values influence its behaviour
  • .\part_mapping_generate.ps1 your-api-key
    Queries rebrickable and output XML to standard output
  • .\part_mapping_generate.ps1 your-api-key abc.xml -output_progress 1
    Queries rebrickable and output XML to the file abc.xml and displays progress when querying Rebrickable.
  • .\part_mapping_generate.ps1 your-api-key abc.xml abc.jsn -output_progress 1
    Queries rebrickable, output XML to the file abc.xml and JSON interim output to abc.jsn and displays progress when querying Rebrickable.
  • .\part_mapping_generate.ps1 "" abc.xml abc.jsn
    Takes its JSON input from abc.jsn rather than querying rebrickable and output XML to the file abc.xml
  • .\part_mapping_generate.ps1 "" "" abc.jsn
    Takes its JSON input from abc.jsn rather than querying rebrickable and output XML to standard output
Regards,

David
Reply
RE: LEGO 2 LDraw 2 BL
#18
(2019-04-12, 15:29)Orion Pobursky Wrote: Very nice. I think maybe we should seek a closer partnership with Rebrickable since they seem to be very LDraw friendly.

I made a couple of posts over in the Rebrickable forum regarding the mapping of part ids.  The potential implications of the replies is that it would be beneficial to be running some form of confirmatory query of the existence of a LDraw part id as part of the process of creating a mapping file.

Is there (he wrote optimistically) any form of API available to query the LDraw parts database e.g. to obtain a list of the part ids? This could be used as part of the transformational process of Rebrickable's data to create better matching part ids.

Regards,

David
Reply
RE: LEGO 2 LDraw 2 BL
#19
(2019-04-16, 5:50)David Manley Wrote: I made a couple of posts over in the Rebrickable forum regarding the mapping of part ids.  The potential implications of the replies is that it would be beneficial to be running some form of confirmatory query of the existence of a LDraw part id as part of the process of creating a mapping file.

Is there (he wrote optimistically) any form of API available to query the LDraw parts database e.g. to obtain a list of the part ids? This could be used as part of the transformational process of Rebrickable's data to create better matching part ids.

Regards,

David

I guess the only person who can gives a proper answer is Chris. Beside that I'd like to hear from the code-gods how the drawn information can be used in their progs?

w.
LEGO ergo sum
Reply
RE: LEGO 2 LDraw 2 BL
#20
(2019-04-16, 6:40)Willy Tschager Wrote: I guess the only person who can gives a proper answer is Chris. Beside that I'd like to hear from the code-gods how the drawn information can be used in their progs?

w.

There is no formal API. All the individual parts are accessible online but the expection now is for people to download the library and collate thier own database.
Reply
RE: LEGO 2 LDraw 2 BL
#21
Today I was browsing through my LDraw installation folders and found this one: LdSetsConversion.

I have no idea where this came from (Word document origin looks like Italian)
It still is on http://zaxxonit.altervista.org/ldsetsconversion.htm
Dates from March 2016 (?)

Who made this? I cannot find a name or author.

It sure looks like something we are trying to achieve here?
Jaco van der Molen
lpub.binarybricks.nl
Reply
RE: LEGO 2 LDraw 2 BL
#22
Something worth looking at, I think?

LPub3D has element-ID integration too in the BOM!
See https://github.com/trevorsandy/lpub3d/issues/196
It can get the element-ID based on color too:

[Image: 55840649-6f916900-5b2c-11e9-89d5-76d608b18f79.png]

And, using some LDView features it can create a partslist with Designnumber and Elemen-ID!

[Image: 55269245-70570f00-5291-11e9-8c13-342fe75ea0f9.png]
Jaco van der Molen
lpub.binarybricks.nl
Reply
RE: LEGO 2 LDraw 2 BL
#23
(2019-04-16, 15:27)Orion Pobursky Wrote: There is no formal API. All the individual parts are accessible online but the expection now is for people to download the library and collate thier own database.

In reply to one of the questions I posted on the rebrickable forum, the rebrickable team came up with a question/request which, if we were able to assist with here at LDraw.org, would help them to improve their part id mapping data. This would in turn benefit us as their improved mapping would be exposed via their API and hence any transformation of the rebrickable data to LDraw/LEGO/BrickLink ids would have better information.

Fundamentally, they would like to know if there is a way on the ldraw.org website to see the image associated with an official part? While using the Prts Tracker one can see an image for unofficial parts, the same is not true for official parts. The example they give is http://www.ldraw.org/cgi-bin/ptscan.cgi?...ebrickable, with the image for the unofficial part being visible in the "Details" link. There is no equivalent link for an official part and while the narrative of the approval process for the unofficial part may not be of value, perhaps the file header and imgae information could be displayed for the "detail" of an official part?

A related question (from me, rather than the rebrickable team). Could the parts tracker be enhanced to add an optional parameter meaning list the part exactly matching the lookup value. For example, at the moment the link http://www.ldraw.org/cgi-bin/ptscan.cgi?q=3010 will match multiple parts, which is desirable. But could the interface be enhanced to support something like http://www.ldraw.org/cgi-bin/ptscan.cgi?q=3010.dat&exact, so the tracker would list just the single part?

Regards,

David
Reply
RE: LEGO 2 LDraw 2 BL
#24
I replied to this on Rebrickable.
Reply
RE: LEGO 2 LDraw 2 BL
#25
(2019-04-18, 6:39)Jaco van der Molen Wrote: Something worth looking at, I think?

LPub3D has element-ID integration too in the BOM!
See https://github.com/trevorsandy/lpub3d/issues/196
It can get the element-ID based on color too:


And, using some LDView features it can create a partslist with Designnumber and Elemen-ID!

LPub3D has implemented Rebrickable.com and Brickset.com to HTML Part List lookup sites
See https://github.com/trevorsandy/lpub3d/issues/239

Perhaps we are looking at the same thing here, but only in the other LDraw software.
Jaco van der Molen
lpub.binarybricks.nl
Reply
RE: LEGO 2 LDraw 2 BL
#26
(2019-04-19, 0:24)Orion Pobursky Wrote: I replied to this on Rebrickable.

Is there going on some work in the background I'm not aware of? Could you please update us on the progress?

w.
LEGO ergo sum
Reply
RE: LEGO 2 LDraw 2 BL
#27
(2019-05-06, 14:31)Willy Tschager Wrote: Is there going on some work in the background I'm not aware of? Could you please update us on the progress?

w.

So basically I think Rebrickable has done this work for us already. The added bonus is that they also have a easily usable API as well. Therefore, I don’t think we need to do anything except work with them by finding errors and reporting them via their mechanism for doing so.
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)