Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / [SOLVED] Question about measuring in inches

Author
Message
Vladimuffin
7
Years of Service
User Offline
Joined: 27th Nov 2016
Location:
Posted: 13th Dec 2018 03:06
Hi guys. I've been programming by night, but do construction by day (like Batman but not as cool). Some of the new hires struggle with reading a tape measure, so I thought it would be a good idea to make an app to help. I was shocked at how quickly I hit a rut. Im not sure what the best way to collect and use the data would be, because each mark on the tape reads as a different fraction, and I've never dealt with fractions in AGK.

Should I make the lines as an array
Inches as integer[11, 15]
with the first field as inches and the second field as the 16ths of inches?

I could build my ruler fairly simple with the above array and some nested for loops but I'm not sure how I would get the program to see [3,12] as 3 and 3/4 inches
For example, if I said:

Setspritecolor(inches[random(0,6), random(0,15)], 255, 0, 0, 255)
And it picked inches[0, 8] that would make the mark at 1/2" red, but how would I check against what the player punched in with a keypad without physically typing a value for every individual tick on the ruler?

Thanks in advance for any suggestions. I know it's a little vague and I'm sorry for that, but I'm not sure what approach to take.
One smart fellow, he felt smart. Two smart fellows, both felt smart. Three smart fellows all felt smart...

The author of this post has marked a post as an answer.

Go to answer

PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 13th Dec 2018 07:24
I am also in construction I have run my own company for a number of years and first rule for new starts is: cant read a tape measure, get off my site! lol

Can I ask, why use imperial measurements?

if your teaching people to read a tape IMO it would be best to teach them metric, its far more accurate, is industry standard and would probably be easier to program a helper app.

I am about to leave for work but this got my interest and I am wrapping up for xmas after today so would be glad to help later on.
Vladimuffin
7
Years of Service
User Offline
Joined: 27th Nov 2016
Location:
Posted: 13th Dec 2018 11:13
I agree completely, but unfortunately I don't get to do the hiring. Trying to convert the entire company to metric would be a nightmare, although I agree that metric is a more logical unit.
One smart fellow, he felt smart. Two smart fellows, both felt smart. Three smart fellows all felt smart...
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 14th Dec 2018 15:27 Edited at: 14th Dec 2018 15:34
This post has been marked by the post author as the answer.
Wow, I didn't think anyone used imperial anymore unless there like 100 years old, but alas I feel your pain on the lack of readability on the tape measure front, I have a number of large contracts that require me to employ the use of agency staff from time to time and even some CSCS credited laborers have a fundamental lack of skill pertaining to the construction industry most don't even own a tape measure let alone know how to read one.

Anyhow, the only way I see you setting up a system to read the users input and output the imperial fraction is to set up a "lookup" array for the indices of the inch, first what minimum micro measurement are you using (64's, 32's, or 16's)? as most tapes dont show 64's and only show 32's for the first foot I would say use 16's which from a programming prospective makes things a whole lot easier but a contractors perspective makes a lot of things not fit quite right lol

for 16's I would do something like:


and for visual feedback via a sprite change the array to a type array and add in the sprite id, and of course you can expand the array to 32's or 64's

I would recommend adding a metric conversion, I think the math is correct here for 16's


I hope that gives you some ideas
Vladimuffin
7
Years of Service
User Offline
Joined: 27th Nov 2016
Location:
Posted: 17th Dec 2018 10:46
Thanks for the suggestions, Part-Timer. This definitely gives me a starting direction and some useful tools. I will keep you posted on the progress. Unfortunately, I have some crazy deadlines to meet currently, so I ended up working all weekend instead of programming (Boooo!), but patience is a virtue right?
One smart fellow, he felt smart. Two smart fellows, both felt smart. Three smart fellows all felt smart...
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 19th Dec 2018 16:09
First of all, metric is not the industry standard, imperial is! (depending where you live) If his construction company measures with inches then he's either in the US, like me, or in one of the other few countries that use imperial. Nothing in the US army is metric, it's all imperial. I was a machinist, it's all imperial. Yes, I measure to a thousandth of an inch. I've also done construction, it's imperial as well.

I will agree metric makes a lot more sense, but I don't see America ever going to it. It would take more than a generation probably to transition.


Why don't you store your values as floats? A ruler has no odd fraction markings, you could easily store 4.625 and have another function format that number to a string for the screen in the form of a fraction 4 5/8.

Quote: "I would recommend adding a metric conversion,"

Honestly, I probably wouldn't. Nothing to do with metric itself, but if these folks are struggling to read a tape measure they don't need the added confusion.

Here's a ruler demo
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 19th Dec 2018 18:39 Edited at: 19th Dec 2018 18:40
Quote: "First of all, metric is not the industry standard, imperial is!"


metric is an international standard and I think you'll find even in the US metric is the standard as set out by the Metric Conversion Act 1975 but it fell on its arse for various reasons and was reborn as Omnibus Trade and Competitiveness Act of 1988 that forced federal agencies to use metric but was not mandated for the public sector so its a standard that everyone chooses to ignore.
Vladimuffin
7
Years of Service
User Offline
Joined: 27th Nov 2016
Location:
Posted: 30th Dec 2018 14:09
Every contractor i've worked with in my 15 years in construction has used Imperial, so I would say its still prevalent here in the states, although I agree that the metric system makes a whole lot more sense. I put this together on the AppGameKit mobile app, so pardon the lack of indents. I also finished most of it before I saw Phaelax's much more efficient method x_x Thanks for sharing guys and thanks PartTime for the starting point!

It runs without any media.



Let me know what you think!
One smart fellow, he felt smart. Two smart fellows, both felt smart. Three smart fellows all felt smart...

Login to post a reply

Server time is: 2024-04-26 12:48:22
Your offset time is: 2024-04-26 12:48:22