Thread: Simple O-ring calculator.
so I wanted to make a calculator that works out the size of a box needed before radius-ing the corners
so if I have an 85mm ID oring, and i want a corner radius of 10mm for example it will tell me that the box size is 70mm x 70mm.
so I've written a bit of code that works to the mm. but as I'm storing numbers in "int" I'm not able to get sub mm accuracy.
any idea on what I can use instead of int?
printf("enter O-ring ID");
scanf("%d", &oringid); //inputs value
printf("enter corner Radius");
scanf("%d", &cornerrad); //inputs value
//inner oring id converted to circumfrence
oringCir = oringid * 3.14159265359;
//corner radius is converted into diameter
cornerdie = cornerrad * 2;
//then converted in circumfrence
cornerCir = cornerdie * 3.14159265359;
//take away corner circumfrence from oring circumfrence
val1 = oringCir - cornerCir;
val2 = val1 / 4;
boxSize = val2 + cornerdie;
printf("with %d radius the box needed is: %d", cornerrad, boxSize );
Scale everything up so working in um, ie 1mm = 1000
the depth of an o-ring groove has to be spot on with quite tight tolerances, there are charts available for o-ring sizes.
By Wal in forum Linear & Rotary MotionReplies: 23Last Post: 13-05-2014, 10:49 PM
By mekanik in forum General ElectronicsReplies: 1Last Post: 15-10-2013, 04:50 PM
By RockandGrohl in forum Projects, Jobs & RequestsReplies: 15Last Post: 20-04-2013, 12:23 AM
By crimsonred in forum Probing, Digitizing & ScaningReplies: 4Last Post: 27-09-2010, 01:47 PM
By Pmac in forum Tool & Tooling TechnologyReplies: 4Last Post: 28-01-2010, 06:55 PM