My subsequent pastime undertaking – dare I say known as it a “vibe undertaking”? – shall be a instrument to assist me cut up color-assorted piles of LEGO components into their constituting units. Earlier than I get began there are some philosophical issues to make.
First lets have a look at the issue. I purchased 2 used LEGO collections previously and loved the detective means of discovering out which units these components got here from. I developed a technique to first wash the components after which cut up them by colour. From stickers, minifigures or distinctive components you’ll be able to make a listing of units. I created a listing for every such assortment on BrickEconomy, as a result of this additionally provides me a present worth of the gathering. Granted it’s for brand spanking new and sealed units, however sometimes the used and full worth could be one thing like half of that.
The primary assortment is bought had 31 units, the second was supposed simply to be a Associates Lodge, however nonetheless contained 7 different units. Now this newest one I counted 76 units. For the final one I additionally bought a giant stack of unique directions which made the identification course of a lot faster. Definitely there are additionally a number of extra hidden units that I might solely uncover in a while.
After washing and color-splitting essentially the most time-consuming set is to get a listing of components for every set from BrickLink and choose the constituent components in the proper quantities from the colour piles. The issue right here is that some colours have big quantities of components, specifically white, black and the grays. So that you see that you simply may want 4 of a sure half and you need to go dig round for these.
When you can’t discover all it is best to make an observation someplace to order the lacking half on BrickLink. Or possibly you’ll stumble accross them because the piles bought smaller. It’s a really tedious and time consuming course of.
One factor that already confirmed nice promise is the BrickScan app which you’ll level at particular person components or entire mini figures and it could discover them of their database. That may then let you know which units this half occurred in. If it’s a distinctive half (like a minifigure or a stickered/printed half) you’ll discover the precise set that is alleged to be from. With out a subscription BrickScan limits you to a few scans per day, so I sprang for the subscription as quickly as I had verified that it’s fulfilling its promise admirably.
I’ve a separate field of stickered/printed components and minifigures and I might undergo them one after the other after which at all times drop them into the zip lock baggage for the units they belong to. The problem right here although is that this: I’d need to put up 76 baggage subsequent to one another – possibly sorted by LEGO set quantity – after which for each scanned half I’ve to go the the proper again for it.
And that is solely a small a part of the general drawback. What do I do with generic components which have dozens of units they is perhaps from?
There needs to be an app for that
So I’ve been considering if I couldn’t construct an app for myself to assist me with this. So right here’s my ideas on what I would like:
I might need an iPad App, the place I can add various lists of units. Then for every set I might get the listing of components from BrickLink. The variety of components I’ve already within the set’s bag I might depend and retailer.
In a manner that is the reverse of the needed listing function obtainable in BrickLink. There you may make lists of components for particular colour after which within the notes I might write for which set I would wish them. Previously I might then order lacking components and as soon as I acquired the order I might go to the needed listing and discover my remark to know which set’s bag I ought to drop it into. A workable however lengthy winded course of to make certain.
As an alternative I think about with the ability to say pick all 2×4 plates from the white pile. Then I might enter their BrickLink ID plus colour into my app and I might get a listing of units the place these are lacking and what number of. And since I don’t have a component scanner to place into my app – boy that will be useful – I’d have to make use of BrickScan for that.
So with the essential premise for this app described the following query now’s how would I make it? Construct it within the open – like an exhibitionist. Or construct it in personal for less than myself. In fact I might begin in personal and if someone else is occupied with it then share it. Or might it even be on the app retailer?
It will be beautiful to seek out some pals with comparable pursuits (LEGO, Swift, SwiftUI, AI) after which geek out with them collectively. However then once more, I is perhaps the one one so loopy as to need to dedicate some display screen time to constructing such an app. And since most likely no person will take care of what I’m proposing right here anyway, I ought to possibly simply attempt to make myself completely happy. What do you assume?
Getting the Components
There are doubtlessly a number of methods how I can get the listing of components for a set, right here’s the listing of components of the LEGO Titanic for instance – in printing mode – from BrickLink. The issue is that BrickLink itself solely has an API for sellers. Different choice Rebrickable has an API however it’s only for hobbyists and has some charge limiting. Additionally it appears to make use of totally different IDs for components than BrickLink I see as hindrance down the highway.
This brings me to the scraping strategy. For AgentCorp I put collectively a technique to parse the HTML DOM of an online web page and convert it into markdown. I made a number of minor changes and now the above components listing from BrickLink converts right into a markdown file which I might simply retailer right into a SwiftData DB.
The issue right here is that AgentCorp is presently not open supply as a result of there are fairly a number of issues in there that I don’t need to “give away without cost” so simply. So I can’t have it as dependency in an open supply undertaking.
I might extract the scraping code into an open supply element after which reference that as an alternative. Or simply plain copy the code into the open supply undertaking. However such code duplication makes me cringe. However the path of least resistance could be to first simply vibe code an MVP.
Make it exist first. Make it good later.
Name to Motion
Usually I might have written “Conclusion” right here, however we haven’t even began but. What do you assume? Or really feel about such a undertaking? Wouldn’t it be fascinating to witness its progress? Would you could have a use case for that as properly?
I believe I’ll simply go forward with a public SwiftLEGO undertaking on GitHub and see the place this leads me.
Associated
Classes: Enjoyable