CopperMoon Posted March 1 Posted March 1 Hi everyone! Here's some background: There is a website called "archipelago", that allows you to host randomizers for games. So, for example, you'd put in a pokémon game and a mario game, and while playing the pokémon game, you can find mario items that will then go to the mario game. Some people have made a lego version, where you can "receive" the lego bricks you need to build your set, and "send" other games items for pages of instruction. However, they're not perfect, and had to be done manually. I think I can fix this. However, to do so, I would need an API that, when given a set ID, gives the pieces needed for each step. AKA, step 1 needs a red stud and a brown 2x4, step 2 needs a black technic rod... (it could also just be the piece's ID, I don't mind). I am wondering if such a thing exists. Thank you for your attention. Quote
SylvainLS Posted March 2 Posted March 2 Hi, That doesn’t exist. I see 3 possibilities: Find how the LEGO® Builder app stores the 3D instructions. (Only recent sets have 3D instructions, others only have PDFs.) Not easy. Make a tool that read the PDFs. Not easy. Find the sets already built with the steps in LDraw or Studio and extract that info. The extraction would be rather straightforward (unless the author used L(3D)Pub’s buffer exchange because that allows to remove / add parts during the build). Finding the sets built with steps is not easy. Quote
CopperMoon Posted March 2 Author Posted March 2 Sounds like the archipelago sets will have to stay manual for now, then. Thanks for your quick reply. Quote
KittyAshley Posted March 6 Posted March 6 Well, it sorta does exist, but it's limited to 3D instructions in the builder app. We can pretend to be the builder app! If you make a request to https://api.prod.dbix.i.lego.com/api/v1/buildinginstructions?ProductNumber= with the set number on the end you'll get some JSON back. In the JSON is a key of BuildingInstructions, and under that key is the Url key. That is the LFXML file that the app uses to show you the 3D instructions. An LFXML file is just XML with a bit of fun. What you'll need to do in order to work out what's in what bags is best shown with a tiny example: <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <LXFML versionMajor="8" versionMinor="1" versionPatch="0"> <Meta> <UseBags/> <DWFBI identifier="BI;VX1039209;B;"/> </Meta> <Bricks> <Brick designID="6636;M" itemNos="4211549" uuid="92f2b701-b9f8-409e-a4fd-6a59f08730dc"> <Part uuid="7be5fabd-d150-4007-9dc2-fb85c4a0a737" designID="6636;M" partType="rigid" materials="194:0"> <Bone uuid="e706f478-3358-4045-9d6b-d27d2ea9ba34" transformation="0,0,-1,-1,0,0,0,1,0,34.486966947508,7.9984556880277,-45.066111966449"/> </Part> </Brick> </Bricks> <Bags> <NumberedBag uuid="44c451bb-81b5-4487-82d1-a5695339e4df" name=""> <Brick brickRef="92f2b701-b9f8-409e-a4fd-6a59f08730dc"/> </NumberedBag> </Bags> </LXFML> In this VERY tiny example (pulled from an actual LFXML file!), you have a 1x6 tile in LBG. That tile is, in this example, in the first bag. Bags in the LFXML file are not numbered for you, but from deduction are listed in numerical order (so the first <NumberedBag> is Bag 1, the second is Bag 2, etc - bags can have names, but they're not bag numbers, they're just internal naming tags for specific bags, and the name parameter will be absent from older LFXML files). Bricks are identified by their uuid on the <Brick>, and that's the UUID referenced in the brickRef parameter. Thus if you map the NumberedBag to the Brick's UUID, you can construct a mapping of which bricks from a set are in which bags. Again, this'll be limited to the sets that have a 3D instruction in the builder app, but that still is most sets in the past 4-5 years. YMMV. Quote
SylvainLS Posted March 7 Posted March 7 Oh, that’s interesting. That’s simpler than what I envisaged as “possibility 1” (in the sense that I thought it would be more obfuscated than that). Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.