Customization of AutoCAD for architectural application
#7

In Custom.CAD following files are used.



1. Acad.lsp
2. addwall.lsp
3. bimage.lsp
4. cc_cal.lsp
5. cc_com.lsp
6. custom.lsp
7. default.lsp
8. door.lsp
9. drprop.lsp
10. stair.lsp
11. walk.lsp
12. wall.lsp
13. window.lsp
14. wlprop.lsp
15. addwall.dcl
16. bimage.dcl
17. defaults.dcl
18. door.dcl
19. drprop.dcl
20. error.dcl
21. getpass.dscl
22. stair.dcl
23. walk.dcl
24. wall.dcl
25. window.dcl
26. wlprop.dcl
27. applian.mns
28. bath.mns
29. construc.mns
30. custom.mns
31. landscap.mns
32. plumb.mns
33. furnit.mns


Resource file used in custom.CAD.

34. housedsn.slb
35. kitchen.slb
36. landscap.slb
37. office.slb
38. spaceplan.slb
39. clend.sld
40. crwall.sld
41. e_in_l.sld
42. n_in_l.sld
43. s_in_l.sld
44. w_in_l.sld
45. e_in_r.sld
46. n_in_r.sld
47. s_in_r.sld
48. w_in_rsld
49. e_out_l.sld
50. n_out _l.sld
51. s_out _l.sld
52. w_ out _l.sld
53. e_ out _r.sld
54. n_ out _r.sld
55. s_ out _r.sld
56. w_ out _rsld
57. twall.sld
58. custom.svf
59. defaults.bmp
60. door. bmp
61. drprop. bmp
62. stair. bmp
63. walk. bmp
64. wall. bmp
65. window. bmp
66. wlprop. Bmp
67. custom.dwg
68. custom.dwt





Source Code of Custom CAD application


1. wall.lsp


(defun clcorner ()    
   (cclayer "wall2d")
   (command "line" a1 a2 ""
             "line" b1 b2 ""
   )
)  
(defun clwall ()
  (joinwall whand whand1)
  (hightwall whand wh)
  (hightwall whand1 wh)
)

(defun getcud()
 (if (= "1" (get_tile "cen"))(setq cud c))
 (if (= "1" (get_tile "up"))(setq cud u))
 (if (= "1" (get_tile "dn"))(setq cud d))
 (if (= cud "")(setq cud c))
)


(defun getthk (value)    
  (setq wt (distof value))
    (if (null wt)
       (err_tile "thickness is not entered correctly")    
       (set_tile "thk" (rtos wt))
    )
)

(defun gethight (value)
  (setq wh (distof value))
    (if (null wh)
      (err_tile "hight is not entered correctly")
      (set_tile "hight" (rtos wh))
    )
)
(defun joinwall(wl1 wl2)
 (setq w1list (cdr (assoc wl1 hand_dat)))
 (setq w2list (cdr (assoc wl2 hand_dat)))
 (setq w1ln1 (cdr (assoc "ln1" w1list))
       w1ln2 (cdr (assoc "ln2" w1list))
       w2ln1 (cdr (assoc "ln1" w2list))
       w2ln2 (cdr (assoc "ln2" w2list))
 )  
 
 (addline w1ln1 w2ln1)
 (addline w1ln2 w2ln2)
   
)

(defun c:wall (/ )
 (include "custom")
 (include "cc_com")
 (include "cc_cal")
 (setq old (getvar "cmdecho"))
 (setvar "cmdecho" 0)
 (setq id (load_dialog "wall"))
 (new_dialog "wall" id)
 (set_tile "thk" (setq wt (ccgetvar "wthick")))
 (set_tile "hight" (setq wh (ccgetvar "whight")))
 (action_tile "thk" "(getthk $value)")
 (action_tile "hight" "(gethight $value)")
 (action_tile "accept" "(getcud)(done_dialog)")
 (action_tile "clw" "(setq clw $value)")
 (action_tile "clc" "(setq clc $value)")
 (start_dialog)
 (setq a (getpoint "\nstarting point of wall: "))
 (setq b (getpoint a "\nPick next point: "))
 (if (null wt) (setq wt (distof gwt)))
 (if (null wh) (setq wt (distof gwh)))
 (cond ((= cud c) (setq dx (/ wt 2) dy (/ wt 2)))
       ((= cud u) (setq dx 0 dy wt))
       ((= cud d) (setq dx wt dy 0))
 )
  (setq a1 (polar a (- (angle a b) 1.57079) dx))
  (setq b1 (polar b (- (angle a b) 1.57079) dx))
  (setq a2 (polar a (+ (angle a b) 1.57079) dy))
  (setq b2 (polar b (+ (angle a b) 1.57079) dy))
  (cclayer "wall2d")
  (setq whand1 (wallhandle))
  (command "line" a1 b1 "")
  (sethand whand1 (entlast) "ln1")
  (command "line" a2 b2 "")
  (sethand whand1 (entlast) "ln2")
  (setq a b)  
  (setq bgn 0)
    (while (/= (setq b (getpoint a "\nPick next point: ")) nil)
         (setq whand (wallhandle))            
         (setq len (- (strlen whand) 2))
         (setq onum (1- (atoi (substr whand 3 len))))
         (setq ohand (strcat "wl" (itoa onum)))
         (setq a1 (polar a (- (angle a b) 1.57079) dx))
         (setq b1 (polar b (- (angle a b) 1.57079) dx))
         (setq a2 (polar a (+ (angle a b) 1.57079) dy))
         (setq b2 (polar b (+ (angle a b) 1.57079) dy))
         (cclayer "wall2d")
         (command "line" a1 b1 "")
         (sethand whand (entlast) "ln1")
         (command "line" a2 b2 "")
         (sethand whand (entlast) "ln2")
         (setprop whand "wthick" wt)
         (setprop whand "hight" wh)
         (joinwall whand ohand)
         (hightwall ohand wh)
         (setq a b)          
      )
  (hightwall whand wh)
  (setprop whand "wthick" wt)
  (setprop whand "hight" wh)
   (cond
     ((= "1" clw)(clwall))
     ((= "1" clc)(clcorner))
  )
  (cclayer "0")
  (setvar "cmdecho" old)
)





2. wall.dcl


wall  : dialog {
            label = "wall constructor";
     : edit_box {
            label = " thickness of wall:" ;
             key = "thk";
                }
     : boxed_row {
           : radio_button {
label = "center";
               key = "cen";
                      }
           : radio_button {
               label = "up";
               key = "up";
                      }
           : radio_button {
               label = "down";
                key = "dn";
                      }
                  }
     : edit_box {
           label = "hight of wall:";
            key = "hight";  
                 }
     : boxed_column {
           : radio_button {
               label = "close the end of wall";
                 key = "clw";
                          }
           : radio_button {
                 label = "close last corner";
                  key = "clc";
                           }
                   }
      ok_cancel;
}

3. door.lsp



(defun calpoint (u n)
 (setq wln1 (cdr (assoc "ln1" listwall)))
 (setq wln2 (cdr (assoc "ln2" listwall)))
 (cond
    ((poln  pnt wln1)    
       (setq per2 (perpoint pnt wln2))
       (setq per1 pnt)
    )
    ((poln  pnt wln2)
       (setq per2 pnt)
       (setq per1 (perpoint pnt wln1))
    )
    (t
       (setq per2 (perpoint pnt wln2))
       (setq per1 (perpoint pnt wln1))
    )
 )
 (setq vel (vel1 wln1))
 (cal "u1=u*vel")
 (cal "v1=dw*u1")
 (cal "p12=per1+v1")
 (cal "p22=per2+v1")
 (setq nr (nor wln1))
 (cal "norm=n*nr")
 (cal "vd1=dw*norm")
 (setq arcang (* u n -90))
 (cond
   ((and (= 1 u) (= 1 n)) (setq dri "_out_r"))
   ((and (= 1 u) (= -1 n)) (setq dri "_in_r"))
   ((and (= -1 u) (= 1 n)) (setq dri "_out_l"))
   ((and (= -1 u) (= -1 n)) (setq dri "_in_l"))
 )
)

(defun draw_door()
 (cclayer "door2d")
 (setq dhand (doorhandle))
 (pvec p12 vd1)
 (setq ld1 (entlast))
 (sethand dhand ld1 "dl1")
 (setq d1 (epln ld1))
 (command "offset" "3" ld1 per1 "")
 (sethand dhand (entlast) "dl2")
 (setq d2 (epln (entlast)))
 (setq d3 (spln (entlast)))
 (command "arc" per1 "e" d2 "a" arcang)
 (sethand dhand (entlast) "da")
 (command "line" d1 d2 "")
 (sethand dhand (entlast) "dl3")
 (command "line" p12 d3 "")
 (sethand dhand (entlast) "dl4")
 (setq whand (wallhandle))
 (command "break" wln1  per1 p12)
 (sethand whand (entlast) "ln1")
 (command "break" wln2  per2 p22)
 (sethand whand (entlast) "ln2")
 (command "line" per1 per2 "")
 (command "line" p12 p22 "")
 (door3d dh)
)
(defun door3d (h)
 (cclayer "door3d")
 (sethand dhand (ext3df p12 d1 h) "d3df1")
 (sethand dhand (ext3df d1 d2 h) "d3df2")
 (sethand dhand (ext3df d2 d3 h) "d3df3")
 (sethand dhand (ext3df d3 p12 h) "d3df4")
 (ext3df per1 per2 h)
 (ext3df p12 p22 h)
 (ext3df p12 per1 h)
 (setq face1 (entlast))
 (ext3df per2 p22 h)
 (setq face2 (entlast))
 (command "region" face2 "")
 (setq reg2 (entlast))
 (command "region" face1 "")
 (setq reg1 (entlast))
 (setq w3df1 (cdr (assoc "3df1" listwall)))
 (setq w3df2 (cdr (assoc "3df2" listwall)))
 (command "region" w3df1 "")
 (setq 3dr1 (entlast))
 (command "region" w3df2 "")
 (setq 3dr2 (entlast))
 (cclayer "wall3dr")
 (command "subtract" 3dr1 "" reg1 "")
 (command "subtract" 3dr2 "" reg2 "")
)
 
(defun dirtest()
 (setq dir (get_wdir whan))
 (cond
    ((= "n" dir) (setq dir (list "n")))
    ((= "e" dir) (setq dir (list "e")))
    ((= "w" dir) (setq dir (list "w")))
    ((= "s" dir) (setq dir (list "s")))
 )
 (do_dir)
)
(defun do_dir ()
 (new_dialog "dimage" fileid)
 (setq dir_list (append dir (list "out" "r")))(do_image dir_list)
 (setq dir_list (append dir (list "out" "l")))(do_image dir_list)
 (setq dir_list (append dir (list "in" "r")))(do_image dir_list)
 (setq dir_list (append dir (list "in" "l")))(do_image dir_list)
 (action_tile "out_r" "(calpoint 1 1)(done_dialog)")
 (action_tile "in_r" "(calpoint 1 -1)(done_dialog)")
 (action_tile "out_l" "(calpoint -1 1)(done_dialog)")
 (action_tile "in_l" "(calpoint -1 -1)(done_dialog)")
 (action_tile "accept" "(Done_dialog)")
 (start_dialog)  
)


(defun do_image (dir_list)
 (setq tname (strcat (car dir_list) "_" (cadr dir_list) "_" (caddr dir_list)))
 (setq kname (strcat (cadr dir_list) "_" (caddr dir_list)))
 (setq x(dimx_tile kname) y(dimy_tile kname))
 (start_image kname)
 (fill_image 0 0 x y 0)
 (slide_image 0 0 x y tname)
 (end_image)
)
(defun getwidth (value)    
  (setq dw (distof value))
    (if (null dw)
       (err_tile "width is not entered")    
       (set_tile "dwidth" (rtos dw))
    )
)

(defun gethight (value)
  (setq dh (distof value))
    (if (null dh)
      (err_tile "hight is not entered")
      (set_tile "dhight" (rtos dh))
    )
)
(defun getwall (/ wln1 wln2 w3df1 w3df2)
 (while (null (setq wsel (entsel "\npick point on wall : ")))
        (setq wsel (entsel "\npick point on wall : "))
 )
 (setq pnt (cadr wsel))
 (setq whan (gethand (car wsel)))
 (setq listwall (cdr (assoc whan hand_dat)))
)

(defun c:door()
 (include "cc_cal")
 (include "cc_com")
 (getwall)
 (setvar "cmdecho" 0)
 (setq fileid (load_dialog "door"))
 (setq dir nil)
 (setq mdr nil)
 (new_dialog "door" fileid)
 (set_tile "dwidth" (ccgetvar "dwidth"))
 (set_tile "dhight" (ccgetvar "dhight"))
 (action_tile "dwidth" "(getwidth $value)")
 (action_tile "dhight" "(gethight $value)")
 (action_tile "ddir" "(dirtest)")
 (action_tile "accept" "(if (null dir)(dirtest))(setq mdr 1)(Done_dialog)")
 (start_dialog)
 (if (= 1 mdr)
 (draw_door)
 )
 (if (null dw) (err_tile "sorry ! width of door \nis not enterd"))
 (unload_dialog fileid)
 (setprop dhand "dwidth" dw)
 (setprop dhand "dhight" dh)
 (setprop dhand "drimage" (strcat (get_wdir whan) dri))
 (setvar "cmdecho" 1)
 (cclayer "0")
)




 

4. door.dcl  


door : dialog {
             label = "door constructor";
             
     : edit_box  {
            label = "door width";
            key = "dwidth";
                }
    : edit_box  {
            label = "door hight";
            key = "dhight";
                }
   : button {
            label = "select the door direction";
            key = "ddir";
            }
   ok_cancel;
}

dimage : dialog {
             label = "select the orientation of door";
           
    :column{
      :row {
         : image_button {
           key = "out_r";
           height = 6;
           width = 20;
           fixed_height = true;
           fixed_width = true;
           alignment = top;
           color = dialog_background;
            }
        : image_button {
           key = "out_l";
            height = 6;
           width = 20;
           fixed_height = true;
           fixed_width = true;
           alignment = top;
           color = dialog_background;
           }
        }
    :row {
         : image_button {
           key = "in_r";
           height = 6;
           width = 20;
           fixed_height = true;
           fixed_width = true;
           alignment = top;
           color = dialog_background;
            }
        : image_button {
           key = "in_l";
           height = 6;          
           width = 20;
           fixed_height = true;
           fixed_width = true;
           alignment = top;
           color = dialog_background;
            }
      }
   }
   ok_cancel;
}

5.window.lsp

(defun calpoint ()
 (setq wln1 (cdr (assoc "ln1" listwall)))
 (setq wln2 (cdr (assoc "ln2" listwall)))
 (cond
    ((poln  pnt wln1)    
       (setq per2 (perpoint pnt wln2))
       (setq per1 pnt)
    )
    ((poln  pnt wln2)
       (setq per2 pnt)
       (setq per1 (perpoint pnt wln1))
    )
    (t
       (setq per2 (perpoint pnt wln2))
       (setq per1 (perpoint pnt wln1))
    )
 )
 (setq vecl (vel1 wln1))
 (cal "v1=ww*vecl")
 (cal "p12=per1+v1")
 (cal "p22=per2+v1")
 (setq mp1 (mid per1 per2))
 (setq mp2 (mid p12 p22))
 (cal "flv=3*vecl")
 (cal "mep1=mp1+flv")
 (cal "mep2=mp2-flv")
 (cal "fw1p1=pld(mp1,per1,1.5)")
 (cal "fw1p2=pld(mp1,per2,1.5)")
 (cal "fw1p3=fw1p1+flv")
 (cal "fw1p4=fw1p2+flv")
)

(defun draw_win()
 (getwall)
 (calpoint)
 (cclayer "win2d")
 (command "line" mep1 mep2 "")
 (setq midl (entlast))
 (command "offset" "0.25" midl per1 "")
 (setq wi1 (entlast))
 (command "offset" "0.25" midl per2 "")
 (setq wi2 (entlast))
 (command "offset" "1.5" midl per1 "")
 (setq wi3 (entlast))
 (command "offset" "1.5" midl per2 "")
 (setq wi4 (entlast))
 (command "line" fw1p1 fw1p2 "")
 (setq fw1 (entlast))
 (command "line" fw1p2 fw1p4 "")
 (setq fw2 (entlast))
 (command "line" fw1p4 fw1p3 "")
 (setq fw3 (entlast))
 (command "line" fw1p3 fw1p1 "")
 (setq fw4 (entlast))
 (command "mirror" fw1 fw2 fw3 fw4 "" (plt wi3 0.5) (plt wi4 0.5) "n")
 (command "line" per1 per2 "")
 (command "line" p12 p22 "")
 (command "erase" midl "")
)
(defun win3d (e h)
 (cclayer "win3d")
 (extln wi1 e h)
 (extln wi2 e h)
 (setq wf1 (extln fw1 e h))
 (setq wf2 (extln fw2 e h))
 (setq wf3 (extln fw3 e h))
 (setq wf4 (extln fw4 e h))
 (command "mirror" wf1 wf2 wf3 wf4 "" (plt wi3 0.5) (plt wi4 0.5) "n")  
 (setq hf1 (extln wi3 e 3))
 (ele3df hf1 (- wh 3))
 (setq hf2 (extln wi4 e 3))
 (ele3df hf2 (- wh 3))
 (command "3dface" per1 per2 p22 p12 "")
 (ext3df (extp per1 e) (extp per2 e) h)
 (ext3df (extp p12 e) (extp p22 e) h)
 (ext3df (extp p12 e) (extp per1 e) h)
 (setq face1 (entlast))
 (ext3df (extp per2 e) (extp p22 e) h)
 (setq face2 (entlast))
 (setq w3df1 (cdr (assoc "3df1" listwall)))
 (setq w3df2 (cdr (assoc "3df2" listwall)))
 (cclayer "win3dr")
 (command "region" face2 "")
 (setq reg2 (entlast))
 (command "region" face1 "")
 (setq reg1 (entlast))
 (command "region" w3df1 "")
 (setq 3dr1 (entlast))
 (command "region" w3df2 "")
 (setq 3dr2 (entlast))
 (command "subtract" 3dr1 "" reg1 "")
 (command "subtract" 3dr2 "" reg2 "")
)

(defun do_dir ()
 (new_dialog "dimage" fileid)
 (setq x(dimx_tile "wslide") y(dimy_tile "wslide"))
 (start_image "wslide")
 (fill_image 0 0 x y 0)
 (slide_image 0 0 x y "wslide")
 (end_image)
 (action_tile "accept" "(Done_dialog)")
 (start_dialog)  
)


(defun getwidth (value)    
  (setq ww (distof value))
    (if (null ww)
       (err_tile "width is not entered")    
       (set_tile "wwidth" (rtos ww))
    )
)

(defun gethight (value)
  (setq wh (distof value))
  (if (null wh)
       (progn
           (if (and (null wlh) (null wsh))
               (err_tile "hight is not entered")
               (set_tile "whight" (rtos (- wlh wsh)))
           )
       )
       (progn
           (set_tile "whight" (rtos wh))
           (cond
             ((not (null wsh)) (set_tile "wlintel" (rtos (+ wsh wh))))
             ((not (null wlh)) (set_tile "wsill" (rtos (- wlh wh))))
           )
        )
  )              
)
(defun getsill (value)
  (setq wsh (distof value))
    (if (null wsh)
      (progn
           (if (null wlh)
                (err_tile "hight is not entered")
                (set_tile "wsill" (rtos (- wlh wh)))
           )
      )
      (progn
          (set_tile "wsill" (rtos wsh))
          (set_tile "wlintel" (rtos (+ wsh wh)))
      )      
    )
)
(defun getlintel (value)
  (setq wlh (distof value))
    (if (null wlh)
      (progn
          (if (null wsh)  
               (err_tile "hight is not entered")
               (set_tile "wlintel" (rtos (+ wsh wh)))
          )
      )
      (progn
          (set_tile "wlintel" (rtos wlh))
          (set_tile "wsill" (rtos (- wlh wh)))
      )
         
    )
)

(defun getwall (/ wln1 wln2 w3df1 w3df2)
 (while (null (setq wsel (entsel "\npick point on wall : ")))
        (setq wsel (entsel "\npick point on wall : "))
 )
 (setq pnt (cadr wsel))
 (setq whan (gethand (car wsel)))
 (setq listwall (cdr (assoc whan hand_dat)))
)

(defun c:window()
 (setvar "cmdecho" 0)
 (include "cc_cal")
 (include "cc_com")
  (setq fileid (load_dialog "window"))
 (new_dialog "window" fileid)
 (set_tile "wwidth" (ccgetvar "winwidth"))
 (set_tile "whight" (ccgetvar "winhight"))
 (set_tile "wsill" (ccgetvar "winsill"))
 (set_tile "wlintel" (ccgetvar "lintel"))
 (action_tile "wwidth" "(getwidth $value)")
 (action_tile "whight" "(gethight $value)")
 (action_tile "wsill" "(getsill $value)")
 (action_tile "wlintel" "(getlintel $value)")  
 (action_tile "accept" "(Done_dialog)")
 (start_dialog)
 (draw_win)
 (win3d wsh wh)  
 (unload_dialog fileid)
 (cclayer "0")
 (setvar "cmdecho" 1)
)
 
6. window.dcl  

window : dialog {
             label = "window constructor";
             
     : edit_box  {
            label = "window width";
            key = "wwidth";
                }
    : edit_box  {
            label = "window hight";
            key = "whight";
                }
   : edit_box  {
            label = "window sill hight";
            key = "wsill";
                }
   : edit_box  {
            label = "window lintel hight";
            key = "wlintel";
                }
   
   ok_cancel;
}
7. stair.lsp

(Defun trunc (x)
 (float (fix x))
)
(defun draw_stair()
 (cclayer "stair2d")
 (command "line" hs1 hs2 "")
 (setq sln1 (entlast))
 (setq sln sln1)
 (setq count 1)
 (while (<=  count nt)
   (setq et (* count riser))
   (setq er (* (1- count) riser))
   (cclayer "stair3d")
   (extln sln er riser)
   (setq sp1 (spln sln))
   (setq ep1 (epln sln))
   (cclayer "stair2d")
   (command "offset" tread sln ps2 "")
   (setq sln (entlast))
   (setq sp2 (extp (spln sln) et))
   (setq ep2 (extp (epln sln) et))
   (cclayer "stair3d")
   (command "3dface"  (extp sp1 et) (extp ep1 et) ep2 sp2 "")
   (command "3dface" (extp sp1 er) (extp sp1 et) sp2 "" "")
   (command "3dface" (extp ep1 er) (extp ep1 et) ep2 "" "")
   (setq count (1+ count))
 )
)

(defun getwidth (value)    
  (setq ws (distof value))
    (if (null ws)
       (err_tile "width is not entered correctly")    
       (set_tile "width" (rtos ws))
    )
)
(defun gethight (value)    
  (setq hs (distof value))
    (if (null hs)
       (err_tile "hight is not entered correctly")    
       (set_tile "hight" (rtos hs))
    )
)
(defun getmaxr (value)    
  (setq maxr (distof value))
    (if (null maxr)
       (err_tile "riser is not entered correctly")    
       (set_tile "maxr" (rtos maxr))
    )
)
(defun getmint (value)    
  (setq mint (distof value))
    (if (null mint)
       (err_tile "tread is not entered correctly")    
       (set_tile "mint" (rtos mint))
    )
)

(defun getclr()
 (if (= "1" (get_tile "cen"))(setq clr c))
 (if (= "1" (get_tile "left"))(setq clr l))
 (if (= "1" (get_tile "right"))(setq clr r))
 (if (= clr "")(setq clr c))
)
(defun getmaxmin ()
 (cond
    ((= "1" (get_tile "min"))(setq mami a))
    ((= "1" (get_tile "max"))(setq mami i))
    (t (setq mami i))
 )
)


(defun maxmin()
 (cond
   ((= mami i)
            (setq nt (1+ (fix (/ fls mint))))
            (setq numr (+ 1 nt))
   )
   ((= mami a)
            (setq numr (fix (/ hs maxr)))
            (setq nt (- 1 numr))            
   )    
 )
)
               
(DEFUN C:STAIR ()
 (include "cc_com")
 (include "cc_cal")  
 (SETQ ps1 (GETPOINT "\nPick first corner of stair: "))
 (SETQ ps2 (GETPOINT ps1"\nPick second corner of stair: "))
 (setq fls (distance ps1 ps2))
 (setvar "cmdecho" 0)
 (setq id (load_dialog "stair"))
 (new_dialog "stair" id)
 (action_tile "width" "(getwidth $value)")
 (action_tile "hight" "(gethight $value)")
 (action_tile "maxr" "(getmaxr $value)")
 (action_tile "mint" "(getmint $value)")
 (action_tile "accept" "(getclr)(getmaxmin)(done_dialog)")
 (start_dialog)
 (cond ((= clr c) (setq dx (/ ws 2) dy (/ ws 2)))
       ((= clr l) (setq dx 0 dy ws))
       ((= clr r) (setq dx ws dy 0))
 )
 (setq hs1 (polar ps1 (- (angle ps1 ps2) 1.57079) dx))
 (setq hs2 (polar ps1 (+ (angle ps1 ps2) 1.57079) dy))
 (setq nt (1+ (fix (/ fls mint))))
 (setq numr (+ 1 nt))
 (setq tread (/ fls nt))
 (setq riser (/ hs numr))
 (draw_stair)
 (setvar "cmdecho" 1)
)
8. stair.dcl

stair :dialog {
        label = "stair constructor";
         : edit_box {
           label = "width of staircase";
           key = "width";
                }
         : edit_box {
           label = "hight of staircase";
           key = "hight";
                }
        : boxed_row {
           : radio_button {
label = "max riser";
               key = "max";
                      }
           : radio_button {
               label = "min tread";
               key = "min";
                      }
              }
         : edit_box {
           label = "minimum tread of stairs";
           key = "mint";
                    }
         : edit_box {
            label = "maximum rise of stairs";
            key = "maxr";
                    }
        : boxed_row {
           : radio_button {
               label = "left";
               key = "left";
                      }
           : radio_button {
label = "center";
               key = "cen";
                      }
         
           : radio_button {
               label = "right";
                key = "right";
                      }
                  }
       
 ok_cancel;
}

9. wlprop.lsp

(defun wcal ()
(setq spw (mid (spln ln1) (spln ln2)))
(setq epw (mid (epln ln1) (epln ln2)))
(if (not cal) (xload "geomcal"))
(setq wlen (rtos (distance spw epw)))
(setq wang (angtos (angle spw epw)))
)

(defun c:wlprop()
(setq ename (car (entsel "\nselect the wall")))
(setq cchand (gethand ename))
(setq wlist (cdr (assoc cchand hand_dat)))
(setq ln1 (cdr (assoc "ln1" wlist)))
(setq ln2 (cdr (assoc "ln2" wlist)))
(setq 3df1 (cdr (if (null (assoc "3df1" wlist))
                       (err_tile "wall face is not present")
                       (assoc "3df1" wlist)
                )
           )
)
(setq 3df2 (cdr (assoc "3df2" wlist)))
(setq id (load_dialog "wlprop"))
(new_dialog "wlprop" id)
(wcal)
(set_tile "whight" (rtos (get_wh cchand)))
(set_tile "wthick" (rtos (get_wt cchand)))
(set_tile "whand" cchand)
(set_tile "wlength" wlen)
(set_tile "wangle" wang)
(set_tile "wdir" (cond
                    ((= "n" (get_wdir cchand)) "north")
                    ((= "e" (get_wdir cchand)) "east")
                    ((= "w" (get_wdir cchand)) "west")
                    ((= "s" (get_wdir cchand)) "south")
                 )
)
(set_tile "sx1" (rtos (splnx ln1)))
(set_tile "sy1" (rtos (splny ln1)))
(set_tile "sz1" (rtos (splnz ln1)))
(set_tile "sx2" (rtos (splnx ln2)))
(set_tile "sy2" (rtos (splny ln2)))
(set_tile "sz2" (rtos (splnz ln2)))
(set_tile "ex1" (rtos (eplnx ln1)))
(set_tile "ey1" (rtos (eplny ln1)))
(set_tile "ez1" (rtos (eplnz ln1)))
(set_tile "ex2" (rtos (eplnx ln2)))
(set_tile "ey2" (rtos (eplny ln2)))
(set_tile "ez2" (rtos (eplnz ln2)))
(action_tile "accept" "(done_dialog)")
(start_dialog)
(unload_dialog id)
)

10. wlprop.dcl


wlprop : dialog {
               label = "property of custom.CAD wall entity ";                
      : row {      
          : column {
            : edit_box {
                 label = "wall hight     ";
                 key = whight;
                 fixed_width = true;
                  }
            : edit_box {
                 label = "wall thickness";
                 key = wthick;
                 fixed_width = true;
                  }
               }
         : column {
              fixed_height = true;
               : concatenation {
                   : text_part {
                       label = "wall Length: ";
                       width = 8;
                   }
                   : text_part {
                       key = "wlength";
                       width = 10;
                   }
               }
               fixed_height = true;
               : concatenation {
                   : text_part {
                       label = "wall Angle: ";
                       width = 8;
                   }
                   : text_part {
                       key = "wangle";
                       width = 10;
                   }
               }
               fixed_height = true;
               : concatenation {
                   : text_part {
                       label = "wall handle:";
                       width = 8;
                   }
                   : text_part {
                       key = "whand";
                       width = 10;
                   }
               }
               fixed_height = true;
               : concatenation {
                   : text_part {
                       label = "wall diection:";
                       width = 8;
                   }
                   : text_part {
                       key = "wdir";
                       width = 10;
                   }
               }
           }
        }
     spacer_1;
     : row {
        : boxed_column {
           label = "startp of line1";
           fixed_width = true;
          : edit_box {
               label = "X:";
               mnemonic = "X";
               edit_width = 10;
               key = "sx1";
                }
         : edit_box {
              edit_width = 10;
              label = "Y:";
              mnemonic = "Y";
              key = "sy1";
               }
          : edit_box {
              edit_width = 10;
              label = "Z:";
              mnemonic = "Z";
              key = "sz1";
               }
       }
       : boxed_column {
           label = "endp of line1";
           fixed_width = true;
           : edit_box {
               label = "X:";
               mnemonic = "X";
               edit_width = 10;
               key = "ex1";
                }
          : edit_box {
               edit_width = 10;
               label = "Y:";
               mnemonic = "Y";
               key = "ey1";
               }
           : edit_box {
               edit_width = 10;
               label = "Z:";
               mnemonic = "Z";
               key = "ez1";
               }
       }
       : boxed_column {
           label = "startp of line2";
           fixed_width = true;
           : edit_box {
               label = "X:";
               mnemonic = "X";
               edit_width = 10;
               key = "sx2";
                }
          : edit_box {
              edit_width = 10;
              label = "Y:";
              mnemonic = "Y";
              key = "sy2";
               }
          : edit_box {
              edit_width = 10;
              label = "Z:";
              mnemonic = "Z";
              key = "sz2";
               }
       }
       : boxed_column {
           label = "endp of line2";
           fixed_width = true;
           : edit_box {
               label = "X:";
               mnemonic = "X";
               edit_width = 10;
               key = "ex2";
                }
          : edit_box {
               edit_width = 10;
               label = "Y:";
               mnemonic = "Y";
               key = "ey2";
               }
           : edit_box {
               edit_width = 10;
               label = "Z:";
               mnemonic = "Z";
               key = "ez2";
               }
       }
   }
   spacer_1;
   ok_cancel;
}

Manish Jain Luhadia 
B.Arch (hons.), M.Plan
Email: manish@frontdesk.co.in
Tel: +91 141 6693948
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)