ChatGPT - is there a use within RAFAC?

Where I think Ai (vs just code) would help is to suggest the best fit and next best fit based on the garment sizes.

It would need to know that PCS has more leeway than No2 dress too.

I’m using Forms to collect the sizing so in either Ai or Python the data capture is automated.

I mean, use AI to write the code that does the work.

I’m currently trying to get it to give me a spreadsheet where on one sheet you put in all the cadets and size, and it spits out the appropriate nato sizes that need ordering. In my case, going for a normally round up approach.

I think it’s doable without any macros, just some well written excel formula!

1 Like

Chat GPT could probably write the code to do it. If you provide a reference table

1 Like

Already on it :wink:

If I get it working I’ll send it over, but need to cook dinner first!

RAF Uniform NSN Finder

Based on British Army size chart from Johnsons of Leeds

Step 1: Define NSN data for uniform items

This is an example – you would replace with the actual mapping from the chart

uniform_data = {
“beret”: [
{“size_cm”: 54, “nsn”: “8405-99-123-4567”},
{“size_cm”: 55, “nsn”: “8405-99-123-4568”},
{“size_cm”: 56, “nsn”: “8405-99-123-4569”},
],
“shirt”: [
{“collar_in”: 14, “nsn”: “8405-99-234-5678”},
{“collar_in”: 15, “nsn”: “8405-99-234-5679”},
{“collar_in”: 16, “nsn”: “8405-99-234-5680”},
],
“trousers”: [
{“waist_in”: 30, “leg_in”: 30, “nsn”: “8405-99-345-6789”},
{“waist_in”: 32, “leg_in”: 32, “nsn”: “8405-99-345-6790”},
{“waist_in”: 34, “leg_in”: 32, “nsn”: “8405-99-345-6791”},
]
}

Step 2: Function to find best match based on closest measurement

def find_best_match(item_list, criteria):
best_match = None
smallest_diff = float(“inf”)
for item in item_list:
diff = 0
for key, value in criteria.items():
if key in item:
diff += abs(item[key] - value)
if diff < smallest_diff:
smallest_diff = diff
best_match = item
return best_match

Step 3: Get user measurements

print(“Enter your measurements:”)
height = int(input("Height (cm): "))
head_size = int(input("Head size (cm): "))
collar_size = float(input("Collar size (inches): "))
chest_size = int(input("Chest size (inches): "))
waist_size = int(input("Waist size (inches): "))
seat_size = int(input("Seat size (inches): "))
leg_size = int(input("Leg length (inches): "))

Step 4: Match NSNs

beret_match = find_best_match(uniform_data[“beret”], {“size_cm”: head_size})
shirt_match = find_best_match(uniform_data[“shirt”], {“collar_in”: collar_size})
trousers_match = find_best_match(uniform_data[“trousers”], {“waist_in”: waist_size, “leg_in”: leg_size})

Step 5: Output recommendations

print(“\nBest NSN recommendations for your measurements:”)
print(f"Beret: {beret_match[‘nsn’]} (Size {beret_match[‘size_cm’]} cm)“)
print(f"Shirt: {shirt_match[‘nsn’]} (Collar {shirt_match[‘collar_in’]} in)”)
print(f"Trousers: {trousers_match[‘nsn’]} (Waist {trousers_match[‘waist_in’]} in, Leg {trousers_match[‘leg_in’]} in)")

Chat GPT gives the structure to build a tool

1 Like

I’m basing sizes on an old version of Logs Form 202. Although socks being on there has thrown a few problems :joy:

No one ever ends up actually recieving them. So bin it off

4 Likes

I did - I received 3 pairs; they were so nice to wear that 2 pairs still have the lables on after 23 years…

1 Like

We now have piles of them in squadron stores, because they did deliver for cadets.

I occasionally dish some out when cadets wear odd colour socks.

As a proof of concept I’d use greens as there’s not as many items of kit to allow for

If i get a few days of freedom at somepoint. I might just try and build this into a webpage with python running behind the scenes

That would be good. It’s functionality that should be in myRAFAC really. Put in measurements along with NOK details and ID photo. Back end sends the Sqn a link to a consolidated spreadsheet with line items and quantities.

Data validation so I don’t get cadets with 30cm legs :grinning:

1 Like

Id hand over the code too cause im nice like that.

Again im quite time poor atm though

1 Like

I had a decent go before I made dinner last night. It did get a bit tricky when I input actual data, though, as always. Needed to come up with a sensible way of rounding. Always rounding up didn’t actually give good answers.

I have a solution for you :wink:

1 Like

My work GPT project is working brilliantly, though. I have a script which I point to a folder. It opens all the PDFs in that folder and looks for the longest dimension, the part name, and the quantity. The drawings look like this:

The screenshot is just the middle, they contain loads of other info around it, but can’t share that.

It goes through all of them and spits out a lits of parts, lengths and quantities. This:

I then have that sheet automatically apply a bin packing algorithm based on stock bar length to work out the number of bars to buy, and where to cut them. It also creates a PDF for this.

This has taken only a few hours to create. It handles different drawing types, as no drawings are ever the same layout. It has a settings page for things like stock bar lengths, kerf etc.

It has produced a metric butt load of python and VBA code. I’ve fixed a couple of minor bugs. But all in, bloody impressive for a few hours work.

And all this processing is now done locally too, so not actually uploading the drawings anywhere.

1 Like

looks like a great use of AI to improve efficiency in the manufacturing process and make the most use of available material

We did! Lots of them.

Please share once refined. This would be amazing.