Board Foot Calculator Script
Webb - all rights reserved - ©2004
spacer
Author - James Cook
Email: James_Cook@ieee.org
Webpage:

Summary: Calculate lumber volume and pricing in board-feet

Binary: Yrpn_Board_Foot_Calc.pdb

Instructions: If you've ever needed to calculate the price of a beautiful piece of hardwood at your local lumberyard, this program will come in handy.  Even if you have no use for this, take a look at the code for techniques you can use in your own programs.

One board-foot is defined as the volume of a 1 inch thick, 12 inch wide piece of lumber 1 foot long.  Thus, a 1/2 inch thick board 6 inches wide and 4 feet long is also one board-foot.  Lumber in the US is usually priced in dollars per board-foot.

The variable buttons in my programs usually work just like the buttons on an HP-48 calculator.  Enter the variable on the stack and tap the button to store.  Tap [Rcl] and then the variable name to recall the value stored.  Tap [Slv] and the unknown variable to solve.  [Clr] clears all variables.

The [x\4] takes the number of "quarters" from the stack and coverts it to decimal inches and stores in the thickness variable.  Some lumber is sold as "five quarter" or 1 1/4" thick, etc.  [T_in] stores the thickness in decimal inches.  [W_in] stores the width in decimal inches.  [L_in] stores the length in inches.

[$@] stores the price per board-foot. [bdft] is the number of board-feet.  [$tot] is the total price of the lumber.

Example:

How much is a board of 5/4 Maple 6.5" wide and 3.5' long that costs $40 a board foot?

[Clr]
5 [X/4] or 1.25 [T_in]
6.5 [W_in]
42 [L_in]
40 [$@]
[Slv] [$tot] 94.79 dollars
[Rcl] [bdft] 2.37 board feet

Code:

RPN.2.i+3\Board Foot\
{o}Cc;
[a]xaxbxc**#'12'/;
[c]0Xa0Xb0Xc0Xd0Xe0Xf0Xg;
\a=thickness, b=width, c=length, d=menu, e=cost per bft, f=board foot, g=cost\
"Board Foot Calc"
"Board Foot Calc" D'Calculates the cost of lumber\ based on price per board foot.'d1;
~
"_x/4:thickness of board in quarter inches" xdc(4/Xa:xa4*)0Xd;
"_T_in:thickness of board (in inches)" xdc(Xa:xa)0Xd;
"_W_in:width of board (in inches)" xdc(Xb:xb)0Xd;
"_L_in:length of board (in inches)"
xdc(#'12'/Xc:xc)0Xd;
~
"_$@:cost per board foot"
xdc(Xe:xe)0Xd;
"_bdft:board foot"
xdc(Xf:xf:CaXfxf)0Xd;
"_$tot:total cost of lumber"xdc(Xg:xg:xf0=0(Ca:xf)xe*Xgxg)0Xd;
~
"Rcl:Recall stored variable"1Xd;
"Slv:Solve for unknown variable"2Xd;
"Clr:Clear all variables" Cc;
"Abt:About" D'Board Foot Calculator\Written by Jim Cook\James_Cook@ieee.org'd1;