Customization of AutoCAD for architectural application
#1

Customization of AutoCAD for architectural application
Dissertation by Ar. Manish Jain , Dept. of Architecture , Malviya Regional Engg. College (Now MNIT) Jaipur , Year 1997 


New commands are added in Autocad to make it more compatible with the users which are more interested in the designing & drafting of buildings especially of a residential. These command saves times of an user by reducing the steps involved in certain repetitive tasks such as construction of an wall, placement of an door & window etc.

1.1 wall

We could able to draw an wall with wall command
1. We can access it at command prompt by typing it
2. We pick following icon  from the construct toolbar

3.   By selecting it in construct popup menu



After selecting the wall from menu we get an dialog box for construction of wall . The dialog  contains the value of thickness and height of wall  automatically from the file Custom.svf thus reducing the inputting work in drawing wall . The wall drawn by the software custom.CAD are automatically trimmed at corner therefore reduces the boring work of  trimming & filleting.
In dialog box we have three option for creating an wall from point we specify viz.
1. center     draw wall from points we specify taking them in center
2. up     draw wall from points we specify taking them up points of wall
3. down     draw wall from points we specify taking them in down points of wall

[Image: attachment.php?aid=342]

The value input in any one of  input box it will automatically converted into the current format of system  here for example if we enter the value of thickness 4.5 it will automatically converted into 4’-1/2” . After giving the value of thickness and height of wall  we have choice between
1. close the end of wall This will close the wall and form an closed room
2. close last corner This will close the end of wall to form open ended wall.

The advantage of  custom.CAD wall  is that we get an both type of wall representation in 2Dwall and 3Dwall.
• Wall in 2D are constructed in layer “wall2d”
• Wall in 3D are constructed in layer “wall3d”


Most useful  concept custom.CAD  wall  is the concept of database association list hand_dat , this list save the name handle given to each entity drawn with wall at the time of construction. Hand_dat is an association list contain handle of all the wall created from start  of  drawing, handle is the name given to an entity which constituted a wall  for example “wl1” is handle given to first wall constructed with Custom.CAD wall command.

[Image: attachment.php?aid=343]

Wall command help the end user to construct a wall  without going in long process of drawing an line then offsetting it , then drawing an next line and offsetting it ,after that filleting it, then drawing an 3dface over the and so on .

1.2   Door

We could able to draw an door with door command
1. We can access it at command prompt by typing it
2. We pick following icon  from the construct toolbar
3.   By selecting it in construct popup menu



As we select the door from menu we following prompt
pick point on wall :  (we will select an point on wall where we want to put an door)
after selection of point on wall we have door constructor  dialog box on screen  by which we could input the value of door width and height of an door.
[Image: attachment.php?aid=344]

after giving the value of door width and height we select the “select the door direction” button to give the orientation to door. As we press this button we see an dialog box this dialog is depend on the orientation of the wall we have selected  it consist of four image buttons representing four possible orientation of an door. We can see four different dialog box one by one
1. North  & south wall :  this type of dialog come when we select an north wall.
[Image: attachment.php?aid=345]


2. East & West wall : This type of dialog box appear when we select the east wall.

[Image: attachment.php?aid=346]

 After selecting the orientation of door , the door is constructed in the wall we have selected. The custom.cad  door automatically cut the wall both in 2D and 3D. therefore we doesn’t  have to worry about trimming of an wall which will become headache in conventional method of putting door by insetting a block , other advantage of the door command is that we get door in 2d and 3d are in different layer.

• door in 2D are constructed in layer “door 2d”
• door in 3D are constructed in layer “door 3d”
• wall region in 3d are constructed in layer “wall3dr”
We get following result on screen after pressing ok of  door dialog box.
1.If we turn off the layer wall3d , wall3dr and door3d :


2. If we turn off layer wall2d and door2d :


The door constructed with door command have door handle “dr” similar to that of wall. Handle is the name given to each entities which constituted a door for example “dr” is handle given to first door constructed with Custom.CAD door command. All handle are kept in association list hand_dat.

You have to register as member and login to see above images [img] attached in the forum post


Attached Files Thumbnail(s)
                   

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

1.3 Window 

We could able to draw an window with window command 
1. We can access it at command prompt by typing it 
2. We pick following icon  from the construct toolbar 

3.   By selecting it in construct popup menu


As we select the window from popup menu section we get following dialog box on screen . The dialog box contains an input box for width and height of window.  

[Image: attachment.php?aid=347]
Dialog  box contain these areas
window width : We type the width of window here.
window height : We type the highs of window here.
window sill height : We type the sill level of window here.
window lintel height : We type the lintel level of window here.

After putting values of various parameter we get following  prompt on screen
 pick point on wall : (select any point on wall where we want to put an window)
After selecting the point on wall we get an window constructed in wall . The window automatically cut the wall to form an opening for window thus saving the time to cut wall 3dface.
Window constructed with this command are simple casement window having a 3” frame.

[Image: attachment.php?aid=348]

Advantage of the window command is that we get window in 2d and 3d are in different layer. 
• window in 2D are constructed in layer “win2d” 
• window in 3D are constructed in layer “win3d”
• wall region in 3d are constructed in layer “wall3dr”
When we turn off the layer win3d and wall3dr layer then seeing the window in NW isometric view

[Image: attachment.php?aid=349]


The window constructed with window command have window handle “win” similar to that of wall. Handle is the name given to each entities which constituted a window for example “win” is handle given to first window constructed with custom.CAD window command. All handle are kept in association list hand_dat.


You have to register as member and login to see above images [img] attached in the forum post


Attached Files Thumbnail(s)
           

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

1.4  Staircase

With staircase command we could able to draw an staircase,
1. We can access it at command prompt by typing it 
2. We pick following icon  from the construct toolbar 
3.   By selecting it in construct popup menu



As we select the staircase from menu we get following prompt on screen

 pick first corner of staircase :  (we pick starting  point  of staircase )

 pick second corner of staircase :  (we pick end point of staircase)

After pointing these points we get following dialog box for constructing a staircase. 
[Image: attachment.php?aid=350]



This dialog box have following areas for input of values :
 width of staircase :  We type here the width of staircase 
 hight  of staircase : We type here the hight of staircase 
: We select the method of calculating  tread and riser of staircase either maximum riser method or  minimum   tread method is employed.
 minimum tread of staircase : We type here the minimum tread of staircase.
 maximum riser of staircase : We type here the maximum riser of staircase
 Here  we have three way of putting the a staircase either the selected  points are in center of staircase  or at the left end or at right end of staircase 

After putting various values and selecting the method we want , staircase is constructed in drawing . Therefore we don’t required any calculation of tread and riser and escape from making each steps repeatedly one after one.
The other advantage of making an staircase from custom.CAD staircase command that the staircase in 2d and 3d are drawn in different layers.
• staircase in 2D are constructed in layer “stair2d” 
• staircase in 3D are constructed in layer “stair3d”
Our drawn staircase should now resemble to this figure :
[Image: attachment.php?aid=351]


When we turn off the layer stair2d  layer then seeing the window in NW isometric view ,our drawn staircase look something like this figure :



[Image: attachment.php?aid=352]


Attached Files Thumbnail(s)
           

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

1.5  Addwall 


We could  edit the crossing  of two walls , intersecting at any angle or apper to intersect ,with addwall command.
1. We can access it at command prompt by typing it 
2. We pick following icon  from the construct toolbar 
3. By selecting it in construct popup menu


As we select the addwall from menu we get following prompt on screen:
 Select the first wall : ( We select the first wall to be edit if we editing an “tee” we should select the smaller wall.)
 Select the second wall : ( We select the second wall to be edit if we editing an “tee” we should select the bigger wall. )
After selecting the these two wall we get an wall editor dialog box . In this dialog we have four option for edition of intersecting wall & appear to intersect wall 




• Crossing walls                       
                                       
Before the addwall’s After the addwall’s crossing option is applied crossing option is used.

 Tee walls                       
                                       
Before the addwall’s After the addwall’s   tee wall option is applied tee wall option is used.

 al walls                       
                                       
Before the addwall’s After the addwall’s   al wall option is applied al  wall option is used.

 parallel walls                       
                                       
Before the addwall’s After the addwall’s   parallel wall option is applied parallel wall option is used.


Walls are edited in both 2d and 3d therefore saving the time in trimming and filleting in convention editing of two parallel lines in AutoCAD. The other advantage of using addwall command is that new handles is given to the additional walls generated in this operation. thus making new walls understandable to custom.CAD database system..


The wall editor dialog box resemble to this figure:


[Image: attachment.php?aid=353]


Attached Files Thumbnail(s)
   

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

1.6  Wlprop 


With wlprop command we get property of an wall, this give us complete information about wall like its thickness , height, direction etc. 
1. We can access it at command prompt by typing it 
2. We pick following icon  from the construct toolbar 
3.   By selecting it in construct popup menu


As we select wall property from menu or type wlprop on command prompt, we get following prompt on screen
 select the wall :  (Here we select the wall for which we want to find the property )

After selecting the wall we want to find property we get following dialog box descripting the property of wall we have selected.

 wall height : Describe the height of the wall 
 wall thickness : Describe the thickness of the wall
 wall length : Describe the length  of the wall
 wall angle : Describe the angle of the wall with X axis taking anticlockwise direction.
 wall handle : Handle of an wall is describe in this section.
 wall direction : Describe the direction  of the wall taking up as an north direction.
 startp of line 1 : A group box contain the co-ordinate of  starting point a line constituting the wall we have selected.
 endp of line 1 : A group box contain the co-ordinate of  end point a line constituting the wall we have selected.
 startp of line 2 : A group box contain the co-ordinate of  starting point second line constituting  the wall we have selected.
 endp of line 2 : A group box contain the co-ordinate of end point second line constituting the wall we have selected.




If we by any fault select an entity other then the wall we get an error reporting dialog box, like this:



This command is useful if want to get the direction or angle or other property of an wall we have drawn using custom.CAD wall command.

[Image: attachment.php?aid=354]

1.7  Drprop


With drprop command we get property of an door, this give us complete information about door like its width  , height and direction of an door. 
1. We can access it at command prompt by typing it 
2. We pick following icon  from the construct toolbar 
3.  By selecting it in construct popup menu

As we select door property from menu or type drprop on command prompt, we get following prompt on screen
 select the door :  (Here we select the door for which we want to find the property )
After selecting the door we want to find property we get following dialog box descripting the property of door we have selected.
 door height : Describe the height of the door.
 door width : Describe the width of the door.
 Image of door direction  : This image show the image of  door orientation in wall.
The door property dialog box resemble to this figure

[Image: attachment.php?aid=355]

The drprop command is useful if we are interested in knowing the height or width of door we have drawn earlier in drawing.

1.8 Default

With default command we get default values comes in all the dialog box comes with custom.CAD commands, this give us complete information about all defaults values like wall thickness, wall height, door or window width etc. We could change the default value with this command. 
1. We can access it at command prompt by typing it 
2. We pick following icon  from the construct toolbar 
3.   By selecting it in construct popup menu

As we select defaults from menu we get an defaults value dialog  box describing the defaults values. We could change the values just by typing it in corresponding box after the value we have typed is remain defaults in all coming commands. 

[Image: attachment.php?aid=356]


The dialog box have following areas of inputs:
 wall thickness : We could edit here default value of  thickness of wall comes with wall command.
 wall height : We could edit here default value of height of wall comes with wall command.
 door width : We could edit here default value of width of door comes with door command.
 door height : We could edit here default value of height of door comes with door command.
 window width : We could edit here default value of width of window comes with window 
command.
 window height :We could edit here default value of height of window comes with window
command.
 window sill : We could edit here default value of sill level of window comes with window 
    command.

After putting the defaults value we required press ok .then the values inputted becomes defaults in all custom.CAD commands.

You have to register as member and login to see above images [img] attached in the forum post


Attached Files Thumbnail(s)
           

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

1.9 walk


With walk command we could walk through from an building block we have drawn using its movement arrow signs. 
1. We can access it at command prompt by typing it 
2. We pick following icon  from the construct toolbar 


3.   By selecting it in construct popup menu



As we select the command we get following prompt on screen:
 camera position :  ( We select the camera position point on screen. )
 target position :    ( We select the target position point on screen. )
After picking the position  of camera and target on screen we get perspective controller dialog box on screen. The dialog box have following areas of input.
 camera elevation  : We type the elevation of camera here.
 target elevation  : We type the elevation of target  here.



After inputting the values of camera and target elevation , we press ok and we get the perspective of object with camera point we have specified earlier , also we have a walk through dialog box at upper left corner of screen from which we control the movement of the viewer. The walk through dialog box have one step input box and four direction image tile. 
 steps :  distance by which we move in pressing of movement arrows.

  camera  move in  left direction  with value of step
  camera  move in  right direction  with value of step
  camera  move in forward direction  with value of step
  camera  move in  backward direction  with value of step





As we press these image the camera is moved in corresponding direction  and we get the from changed camera position thus we could move in the building easily in any direction  without going in exhausting method of AutoCAD.

Manish Jain Luhadia 
B.Arch (hons.), M.Plan
Email: manish@frontdesk.co.in
Tel: +91 141 6693948
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)