;;; -*-lisp-*- ;;; ;;; Compute rectangular-section wire sizes ;;; ;;; (c) 2007 Mark Wooding ;;; ;;;----- Licensing notice --------------------------------------------------- ;;; ;;; This program is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 2 of the License, or ;;; (at your option) any later version. ;;; ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with this program; if not, write to the Free Software Foundation, ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. (install-dep-syntax) (defwindow rolling-window () ("Rolling") (let* ((width (make-dep)) (thick (make-dep)) (length (make-dep)) (stock-type (make-dep :round)) (stock-size (make-dep)) (volume #[(* ?width ?thick ?length)]) (stock-length #[(/ ?volume (case ?stock-type (:round (* 1/4 pi (expt ?stock-size 2))) (:square (expt ?stock-size 2)) (t (dep-bad))))]) (sq-size #[(expt (* (expt ?width 2) ?thick) 1/3)]) (rnd-diam #[(/ (* 2 ?sq-size) (sqrt pi))]) (start-length #[(/ ?volume (expt ?sq-size 2))])) (within-group ("Required size") (make-input "Width:" width) (make-input "Thickness:" thick) (make-input "Length:" length)) (within-group ("You should start with") (make-output "Square side:" sq-size) (make-output "Round diameter:" rnd-diam) (make-output "Length:" start-length)) (within-group ("Initial stock") (make-radio-dep stock-type '(:round "Round section" :square "Square section")) (make-input "Stock size:" stock-size) (make-output "Stock length:" stock-length)) #+ no (within-group ("Other data") (make-output "Volume:" volume)))) (rolling-window) ;;;----- That's all, folks --------------------------------------------------