LEGO 2 LDraw 2 BL


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
« Next Oldest | Next Newest »



Messages In This Thread
LEGO 2 LDraw 2 BL - by Willy Tschager - 2019-04-07, 12:05
RE: LEGO 2 LDraw 2 BL - by Roland Melkert - 2019-04-07, 18:40
RE: LEGO 2 LDraw 2 BL - by Lutz Gehlen - 2019-04-08, 8:19
RE: LEGO 2 LDraw 2 BL - by David Manley - 2019-04-08, 8:41
RE: LEGO 2 LDraw 2 BL - by Milan Vančura - 2019-04-08, 10:22
RE: LEGO 2 LDraw 2 BL - by Magnus Forsberg - 2019-04-08, 22:24
RE: LEGO 2 LDraw 2 BL - by Philippe Hurbain - 2019-04-09, 5:58
RE: LEGO 2 LDraw 2 BL - by Willy Tschager - 2019-04-09, 9:38
RE: LEGO 2 LDraw 2 BL - by Johann Eisner - 2019-04-09, 19:15
RE: LEGO 2 LDraw 2 BL - by Jaco van der Molen - 2019-04-09, 20:50
RE: LEGO 2 LDraw 2 BL - by Orion Pobursky - 2019-04-09, 21:53
RE: LEGO 2 LDraw 2 BL - by Willy Tschager - 2019-04-11, 7:17
RE: LEGO 2 LDraw 2 BL - by David Manley - 2019-04-12, 12:34
RE: LEGO 2 LDraw 2 BL - by Orion Pobursky - 2019-04-12, 15:29
RE: LEGO 2 LDraw 2 BL - by David Manley - 2019-04-16, 5:50
RE: LEGO 2 LDraw 2 BL - by Willy Tschager - 2019-04-16, 6:40
RE: LEGO 2 LDraw 2 BL - by Orion Pobursky - 2019-04-16, 15:27
RE: LEGO 2 LDraw 2 BL - by David Manley - 2019-04-18, 23:57
RE: LEGO 2 LDraw 2 BL - by Orion Pobursky - 2019-04-19, 0:24
RE: LEGO 2 LDraw 2 BL - by Willy Tschager - 2019-05-06, 14:31
RE: LEGO 2 LDraw 2 BL - by Orion Pobursky - 2019-05-06, 14:37
RE: LEGO 2 LDraw 2 BL - by David Manley - 2019-04-13, 8:05
RE: LEGO 2 LDraw 2 BL - by David Manley - 2019-04-14, 10:47
RE: LEGO 2 LDraw 2 BL - by Jaco van der Molen - 2019-04-12, 15:36

Forum Jump:


Users browsing this thread: 1 Guest(s)