Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Esoteric formatting for millimeters

Featured Replies

I have a cabinet shop.

We build our cabinets in millimeters but need to communicate in inches & fractions.

A lot of times a customer wants to know if a particular pot will fit inside a drawer box. I would like to develop a solution that answers this question.

I need to be able to start with a drawer face dimension in millimeters, subtract drawer bottom thickness and inform the customer how much useable height they have in inches & fractions.

I am using the following formula in my calculation:

Let ( [

fraction = Mod ( decimal ; 1 ) ;

sixteenths = Round ( fraction * 16 ; 0 )

] ;

Case ( Int ( decimal ) ; Int ( decimal) )

&

Case ( Int ( decimal ) and sixteenths ; "-" )

&

Case (

sixteenths ; Choose ( Mod ( sixteenths ; 4 ) ;

sixteenths / 4 & "/4" ;

sixteenths & "/16" ;

sixteenths / 2 & "/8" ;

sixteenths & "/16" )

)

)

For the most part this approach works pretty good,

It breaks, however, whenever the denominator in the fraction should be "1/2" and sometimes during rounding errors at millimeter equivalents of whole integers.

For example: 1/2 reads as 2/4 and when the answer gets close to a whole integer the formatting gets stupid.

For example: Subtracting a 1 inch drawer bottom from a 152mm drawer face yields an answer of 4 4/4.

If you are interested, you can see examples of this on the attached file.

I got this formula from another question that was answered about four years ago on this forum by Comment.

http://fmforums.com/forum/showtopic.php?tid/152662/fromactivity/myposts/

Can anybody tell me how to recode this formatting to keep the integers cooperating?

Thanks,

Jarvis

convert_drawers.fp7.zip

Hm. Try it this way:

Let ( [

n = Round ( decimal * 16 ; 0 ) / 16 ;

sixteenths = 16 * Mod ( n ; 1 )

] ;

Case ( Int ( n ) ; Int ( n ) )

&

Case ( Int ( n ) and sixteenths ; "-" )

&

Case ( sixteenths ; Choose ( Mod ( sixteenths ; 4 ) ;

sixteenths / 4 & "/4" ;

sixteenths & "/16" ;

sixteenths / 2 & "/8" ;

sixteenths & "/16" )

)

)

  • Author

Thanks Comment,

I can sense we are closer but not quite there.

The fraction 1/2 is still displaying as 2/4.

I have rebuilt the file in case you might have time to look at it.

Jarvis

Convert_fractions.fp7.zip

Edited by Guest

The fraction 1/2 is still displaying as 2/4.

Of course it is - because that was the requirement then. You started with eights or sixteenths only, and later the quarters were tacked on as a patch. I can only repeat what I said then: "when you make something for a specific purpose, then adapt it, it may end up being less efficient than making it for a general purpose to begin with."

I am not sure what your current requirement is, but perhaps this example of a general formula might suit you:

http://fmforums.com/forum/showpost.php?post/187542/

  • Author

Comment,

In 2004 you stated:

"when you make something for a specific purpose, then adapt it, it may end up being less efficient than making it for a general purpose to begin with."

Your advice is durable.

Thank you so much.

Jarvis

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.