TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: GDF on September 23, 2015, 01:13:11 PM

Title: Roof Calculator for drawing different roof pitches in plan
Post by: GDF on September 23, 2015, 01:13:11 PM
I'm working on a dialog based calculator  for drawing different roof pitches in plan.


I'm looking for slides or diagrams showing the geometry and calculations for solving the hips and valleys in roof plan view for intersecting different roof pitches. For example a 12/12 to 12/12 roof pitch would result in a 45 degree angle.

Thanks

Gary
Title: Re: Roof Calculator for drawing different roof pitches in plan
Post by: GDF on September 29, 2015, 09:08:22 PM
Got it fixed

Code: [Select]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (defun OVERHANGCALC1  ()
    (mode_tile "overhang" 0)   
    (setvar "insunits" 1)
    (setvar "lunits" 4)
    (if (= pitchval "Select")
      (setq pitchval nil))
    (cond
      ((or (= pitchvalA nil) (= plateghtval nil) (= plateghtval ""))
       (ARCH:MsgBox2
         " Arch Program : Info"
         48
         "
            Roof Calculator Error:
-------------------------------------------------------------------------
     Please fill in the Roof Pitch and Plate height values...and try again.
    "    4))
      ((and (/= pitchvalA "")
            (/= plateghtval ""))
       (cond ((= horzvert "Horizontal")
              (setq overhangval (* (/ pitchvalA 12) (distof plateghtval))))
             ((= horzvert "Vertical")
              (setq overhangval (* (/ 12 pitchvalA) (distof plateghtval)))))
       (set_tile "overhang" (rtos overhangval 4 2))))
    (princ))
;;;
  (defun OVERHANGCALC2  ()
    (mode_tile "overhang" 0)   
    (setvar "insunits" 1)
    (setvar "lunits" 4)
    (if (= pitchval "Select")
      (setq pitchval nil))
    (cond
      ((or (= pitchvalA nil) (= plateghtval nil) (= plateghtval ""))
       (ARCH:MsgBox2
         " Arch Program : Info"
         48
         "
            Roof Calculator Error:
-------------------------------------------------------------------------
     Please fill in the Roof Pitch and Plate height values...and try again.
    "    4))
      ((and (/= pitchvalA "")
            (/= plateghtval ""))
       (cond ((= horzvert "Horizontal")
              (setq overhangval (* (/ pitchvalA 12) (distof plateghtval))))
             ((= horzvert "Vertical")
              (setq overhangval (* (/ 12 pitchvalA) (distof plateghtval)))))
       (set_tile "overhang" (rtos overhangval 4 2))))
    (princ))
;;;DISTANCE = (KNOW WIDTH / 2) (SLOPE A)  /  (SLOPE B)
  (defun OVERHANGCALC3  ()
    (setq distanceA "20'")
    (mode_tile "plateght" 1)
    (set_tile "plateght" "")
    (mode_tile "distanceB" 0)
    (setvar "insunits" 1)
    (setvar "lunits" 4)
   (if (= pitchval "Select")
      (setq pitchval nil))
    (cond
      ((or (= pitchvalA nil) (= pitchvalB nil) (= plateghtval ""))
       (ARCH:MsgBox2
         " Arch Program : Info"
         48
         "
            Roof Calculator Error:
-------------------------------------------------------------------------
     Please fill in the Roof Pitch and Plate height values...and try again.
    "    4))
      ((and (/= pitchvalA "")
            (/= plateghtval ""))
       (cond ((= horzvert "Plan")
              (setq distanceB (* (/ (/ pitchvalA 12) (/ pitchvalB 12)) (/ (distof distanceA) 2))))             
             )
       (set_tile "distanceB" (rtos distanceB 4 2))))
   
    (princ))
;;;
  (defun CALCULATE  ()
    (cond ((= horzvert "Horizontal") (OVERHANGCALC1))
          ((= horzvert "Vertical") (OVERHANGCALC2))
          ((= horzvert "Plan") (OVERHANGCALC3))))
Title: Re: Roof Calculator for drawing different roof pitches in plan
Post by: HasanCAD on September 30, 2015, 02:02:14 AM
More than excellent