Advertisement
Guest User

Draws an elevation component

a guest
Sep 17th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.92 KB | None | 0 0
  1. (defun C:ELEVF ()
  2. (setq ;sets first round of variables
  3. ;stores previous system variables
  4. PSNAP (getvar "OSMODE") ;stores previous snap variable for recall
  5. PLAYER (getvar "CLAYER") ;stores previous layer
  6. ;stores previous function variables
  7. PW W ;sets [P]revious[W]idth as [W]
  8. POH OH ;sets [P]revious[OH] as [OH]
  9. PFH FH ;[P]revious[FH] as [FHH]
  10. PSH SH ;[P]revious[SH] as [SH]
  11. PP P ;[P]revious[P] as [P]
  12. PST ST ;[P]revious[ST] as [ST]
  13. PBP BP ;[P]revious[BP] as [BP]
  14. PX X ;[P]revious[X] as [X]
  15. PY Y ;[P]revious[Y] as [Y]
  16. ;requests and stores variables needed for function
  17. W (getdist "\nLength of the wall:") ;sets W as wall length
  18. OH (getdist "\nEnter overhang length:") ;sets OH as the overhang length
  19. FH (getdist "\nEnter fascia height:") ;sets FH as the fascia height
  20. SH (getdist "\nEnter height of soffit from grade:") ;sets SH as the soffit height from grade
  21. P (getreal "\nEnter roof pitch: \n12/") ;sets the roof pitch in terms of 12:__ pitch
  22. ST (getdist "\nSide Trim Width:") ;Side trim width request
  23. BP (getpoint "Select the point you want the lower left line to start:") ;sets the point from which all variable points are relative
  24. X (car BP) ;sets X as the x coordinate of BP
  25. Y (cadr BP) ;sets Y as the y coordinate of BP
  26. DY (sin ;sets the delta Y constant for offsetting rake trim (will be used later with rake offset values EX: (/ 2.5 DY)
  27. (-
  28. (/ PI 2)
  29. (atan P 12)
  30. )
  31. )
  32. )
  33. (setq
  34. PT1 (list ;starts gable elevation
  35. X
  36. Y
  37. )
  38. PT2 (list ;line up to soffit
  39. X
  40. (+ Y SH)
  41. )
  42. PT3 (list ;line left for overhang
  43. (- X OH)
  44. (+ Y SH)
  45. )
  46. PT4 (list ;line up for fascia
  47. (- X OH)
  48. (+ Y (+ SH FH))
  49. )
  50. PT5 (list ;line from fascia top to ridge
  51. (+ X (/ W 2))
  52. (+ Y (+ SH (+ FH (* (/ (+ (/ W 2) OH) 12) P))))
  53. )
  54. PT6 (list ;line from ridge to right fascia top
  55. (+ X (+ W OH))
  56. (+ Y (+ SH FH))
  57. )
  58. PT7 (list ;line from right fascia top to soffit + overhang
  59. (+ X (+ W OH))
  60. (+ Y SH)
  61. )
  62. PT8 (list ;line from overhang to soffit
  63. (+ X W)
  64. (+ Y SH)
  65. )
  66. PT9 (list ;line from right soffit back to grade
  67. (+ X W)
  68. Y
  69. )
  70. PT1T (list ;sets first point for left side trim
  71. (+ X ST)
  72. (+ Y 8)
  73. )
  74. PT2T (list ;sets second point for left side trim *** NEEDS TO BE CHANGED TO ACCOUNT FOR THE RAKE FASCIA LOCATION
  75. (+ X ST)
  76. (+ (- (cadr PT4) (/ 11 DY)) (/ (* (+ OH ST) P) 12))
  77. )
  78. PT9T (list ;sets first point for right side trim
  79. (+ X (- W ST))
  80. (+ Y 8)
  81. )
  82. PT8T (list ;sets second point for right side trim *** NEEDS TO BE CHANGED TO ACCOUNT FOR THE RAKE FASCIA LOCATION
  83. (+ X (- W ST))
  84. (cadr PT2T)
  85. )
  86. )
  87. (setvar "OSMODE" 0) ;turns off ALL OSNAPS
  88. (setvar "CLAYER" "A-OBJECT-OUTLINE") ;sets layer to A-OBJECT-OUTLINE
  89. (command "LINE" PT1 PT2 PT3 PT4 PT5 PT6 PT7 PT8 PT9 "") ;draw elevation outline
  90. (setvar "CLAYER" "A-OBJECT-MINOR") ;sets layer to A-OBJECT-MINOR
  91. (command "LINE" PT1T PT2T "") ;Draws left side trim
  92. (command "LINE" PT9T PT8T "") ;Draws right side trim
  93. (command "LINE" ;draws foundation line
  94. (list ;sets left foundation line point
  95. X
  96. (+ Y 8)
  97. )
  98. (list ;sets right foundation line point
  99. (+ X W)
  100. (+ Y 8)
  101. )
  102. "" ;ends line command
  103. )
  104. (command "LINE" ;draws first rake trim
  105. (list ;sets the first rake first point
  106. (car PT4) (- (cadr PT4) (/ 2.5 DY)) ;sets the first point in the first rake line
  107. )
  108. (list ;sets the first rake second point
  109. (+ X (/ W 2)) (- (cadr PT5) (/ 2.5 DY)) ;sets the second point in the first rake line
  110. )
  111. (list ;sets the first rake third point
  112. (car PT6) (- (cadr PT6) (/ 2.5 DY)) ;sets the third point in the first rake line
  113. )
  114. "" ;ends line command
  115. )
  116. (setvar "CLAYER" "A-OBJECT-MAJOR") ;changes layer to A-OBJECT-MAJOR
  117. (command "LINE" ;draws second rake trim
  118. (list ;sets the second rake first point
  119. (car PT4) (- (cadr PT4) (/ 5.5 DY)) ;sets the first point in the second rake line
  120. )
  121. (list ;sets the second rake second point
  122. (+ X (/ W 2)) (- (cadr PT5) (/ 5.5 DY)) ;sets the second point in the second rake line
  123. )
  124. (list ;sets the second rake third point
  125. (car PT6) (- (cadr PT6) (/ 5.5 DY)) ;sets the third point in the second rake line
  126. )
  127. "" ;ends line command
  128. )
  129. (setvar "CLAYER" "A-OBJECT-MINOR") ;changes layer to A-OBJECT-MINOR
  130. (command "LINE" ;draws third rake trim
  131. (list ;sets the third rake first point
  132. (+ OH (+ ST (car PT4))) (cadr PT2T) ;sets the first point in the third rake line
  133. )
  134. (list ;sets the third rake second point
  135. (+ X (/ W 2)) (- (cadr PT5) (/ 11 DY)) ;sets the second point in the third rake line
  136. )
  137. (list ;sets the third rake third point
  138. (- (car PT6)(+ ST OH)) (cadr PT8T) ;sets the third point in the third rake line
  139. )
  140. "" ;ends line command
  141. )
  142. (setvar "OSMODE" PSNAP) ;return osmode var to what it was
  143. (setvar "CLAYER" PLAYER) ;return CLAYER var to what it was
  144. (princ) ;clears the command line
  145. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement