parent
425b81671f
commit
9bdeb350aa
@ -1,7 +1,6 @@
|
||||
;; reload all included files
|
||||
|
||||
(defun c:reloadall ()
|
||||
(defun-q c:reloadall ()
|
||||
"Reloads all the files that have been loaded so far"
|
||||
(princ "\nReloading files:\n")
|
||||
(mapcar 'print psc-included-files)
|
||||
(mapcar 'psc-load psc-included-files)
|
||||
(mapcar (compose '(print psc-load)) psc-included-files)
|
||||
(princ))
|
||||
(defun-r 'c:reloadall)
|
||||
|
@ -1,8 +1,8 @@
|
||||
;; command to draw a return between the first two rails selected
|
||||
|
||||
(psc-include '("rail/return.lsp"))
|
||||
|
||||
(defun c:return ( / )
|
||||
(defun-q c:return ( / )
|
||||
"Draws a handgrab return between two stair flights"
|
||||
(setq enames (get-stairland 'stair T))
|
||||
(draw-hg-return (car enames) (cadr enames))
|
||||
(princ))
|
||||
(defun-r 'c:return)
|
||||
|
@ -1,15 +1,15 @@
|
||||
;; update checker initials in fab drawings
|
||||
|
||||
(psc-include '("dialog/dialog.lsp"))
|
||||
|
||||
(defun update-chk--update (initials)
|
||||
(vla-replace-string modelspace "NEC" initials)
|
||||
(vla-Save acaddoc))
|
||||
(defun-q c:update-chk (/ update initials files)
|
||||
"Updates checker initials in fab drawings"
|
||||
(defun update (initials)
|
||||
(vla-replace-string modelspace "NEC" initials)
|
||||
(vla-Save acaddoc))
|
||||
|
||||
(defun c:update-chk (/ initials files)
|
||||
(setq files (get-files-this-dir (vla-get-path acaddoc)))
|
||||
(if files
|
||||
(progn
|
||||
(setq initials (getstring "\nChecker initials: "))
|
||||
(foreach filename files
|
||||
(open-and filename nil 'update-chk--update (list initials))))))
|
||||
(open-and filename nil 'update (list initials))))))
|
||||
(defun-r 'c:update-chk)
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,315 @@
|
||||
(defun draw-land-top-view (data ins /
|
||||
blockOffset
|
||||
blockObj
|
||||
obj
|
||||
clayer
|
||||
textstyle
|
||||
mirror
|
||||
som
|
||||
tv-land-bolt
|
||||
fchany
|
||||
bchany
|
||||
frtexty
|
||||
tmp
|
||||
)
|
||||
(setq blockOffset ((if (= side "Left") + -) center_offset)
|
||||
blocks (vla-get-Blocks acadDoc)
|
||||
blockObj (vla-Add blocks (3dpt 0 blockOffset 0) (p-blk-name (xd-value "assembly" data)))
|
||||
clayer (getvar 'clayer)
|
||||
textstyle (getvar 'textstyle))
|
||||
|
||||
(defun mirror (obj)
|
||||
(if (= side "Left")
|
||||
(progn
|
||||
(vla-mirror-x obj)
|
||||
(vla-mirror-y obj))))
|
||||
;; setq obj, mirror
|
||||
(defun som (new-obj)
|
||||
(setq obj new-obj)
|
||||
(mirror obj))
|
||||
|
||||
;; draw bolt holes
|
||||
(defun tv-land-bolt ( / fl-bolt-cen fr-bolt-cen bl-bolt-cen br-bolt-cen)
|
||||
(if front_l-stair_hbolt
|
||||
(progn
|
||||
(setq fl-bolt-cen (list front_l-stair_hbolt
|
||||
(- front_l-stair_wid front_l-stair_hbolt)))
|
||||
(if front_l-stair_hbolt2
|
||||
(append! 'fl-bolt-cen
|
||||
(mapcar '+
|
||||
fl-bolt-cen
|
||||
(list front_l-stair_hbolt2 (- front_l-stair_hbolt2)))))
|
||||
(mapcar! '(lambda (y)
|
||||
(list (list 0 (- (/ plt_wid 2) y) 0) dir))
|
||||
'fl-bolt-cen)))
|
||||
|
||||
(if front_r-stair_hbolt
|
||||
(progn
|
||||
(setq fr-bolt-cen (list front_r-stair_hbolt
|
||||
(- front_r-stair_wid front_r-stair_hbolt)))
|
||||
(if front_r-stair_hbolt2
|
||||
(append! 'fr-bolt-cen
|
||||
(mapcar '+
|
||||
fr-bolt-cen
|
||||
(list front_r-stair_hbolt2 (- front_r-stair_hbolt2)))))
|
||||
(mapcar! '(lambda (y)
|
||||
(list (list 0 (+ (/ plt_wid -2) y) 0) dir))
|
||||
'fr-bolt-cen)))
|
||||
|
||||
(if back_l-stair_hbolt
|
||||
(progn
|
||||
(setq bl-bolt-cen (list back_l-stair_hbolt
|
||||
(- back_l-stair_wid back_l-stair_hbolt)))
|
||||
(if back_l-stair_hbolt2
|
||||
(append! 'bl-bolt-cen
|
||||
(mapcar '+
|
||||
bl-bolt-cen
|
||||
(list back_l-stair_hbolt2 (- back_l-stair_hbolt2)))))
|
||||
(mapcar! '(lambda (y)
|
||||
(list (list back_chan_loc (- (/ plt_wid 2) y) 0) (- dir)))
|
||||
'bl-bolt-cen)))
|
||||
|
||||
(if back_r-stair_hbolt
|
||||
(progn
|
||||
(setq br-bolt-cen (list back_r-stair_hbolt
|
||||
(- back_r-stair_wid back_r-stair_hbolt)))
|
||||
(if back_r-stair_hbolt2
|
||||
(append! 'br-bolt-cen
|
||||
(mapcar '+
|
||||
br-bolt-cen
|
||||
(list back_r-stair_hbolt2 (- back_r-stair_hbolt2)))))
|
||||
(mapcar! '(lambda (y)
|
||||
(list (list back_chan_loc (+ (/ plt_wid -2) y) 0) (- dir)))
|
||||
'br-bolt-cen)))
|
||||
|
||||
(mapcar '(lambda (v)
|
||||
(som
|
||||
(vla-put-layer-r
|
||||
(add-polyline blockobj
|
||||
(car v)
|
||||
(list '(0 0 0) (list (* dir (cadr v)) 0 0))
|
||||
nil)
|
||||
"center")))
|
||||
(append fl-bolt-cen fr-bolt-cen bl-bolt-cen br-bolt-cen)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;
|
||||
;; landing supports
|
||||
;;;;;;;;;;;;;;;;;;;
|
||||
(draw-land-support 'tv)
|
||||
|
||||
;;;;;;;;;;;;;
|
||||
;; bolt holes
|
||||
;;;;;;;;;;;;;
|
||||
(tv-land-bolt)
|
||||
|
||||
;;;;;;;;;;;;;;;;
|
||||
;; front channel
|
||||
;;;;;;;;;;;;;;;;
|
||||
(setvar 'clayer "OBJ")
|
||||
(setq fchany (- 0
|
||||
(/ plt_wid 2.0)
|
||||
fr_ext
|
||||
(if (and right_chan
|
||||
(<= fr_ext br_ext))
|
||||
(- right_chan_wid)
|
||||
0)))
|
||||
(som (add-rectangle blockObj
|
||||
front_chan_wid
|
||||
front_chan_len
|
||||
(list 0 fchany 0)))
|
||||
(setvar 'clayer "HIDDEN")
|
||||
(som (add-polyline blockObj
|
||||
(list front_chan_web
|
||||
fchany
|
||||
0)
|
||||
(list '(0 0 0)
|
||||
(list 0 front_chan_len 0))
|
||||
nil))
|
||||
(setvar 'textstyle "Calibri")
|
||||
(setvar 'clayer "TEXT")
|
||||
(setq obj (vla-AddText blockObj
|
||||
front_chan
|
||||
(vlax-3d-point 0 0 0)
|
||||
4.0))
|
||||
(vla-put-Rotation obj (dtr 90.0))
|
||||
(vla-put-Alignment obj acAlignmentMiddleCenter)
|
||||
(setq frtexty (- (/ plt_wid 4.0)))
|
||||
(vla-put-TextAlignmentPoint obj
|
||||
(vlax-3d-point (+ front_chan_wid 3)
|
||||
frtexty
|
||||
0))
|
||||
(if (= side "Left") (vla-mirror-y obj))
|
||||
(vla-put-ScaleFactor obj 0.8)
|
||||
;;;;;;;;;;;;;;;
|
||||
;; back channel
|
||||
;;;;;;;;;;;;;;;
|
||||
(setvar 'clayer "OBJ")
|
||||
(setq bchany (- 0
|
||||
(/ plt_wid 2.0)
|
||||
br_ext
|
||||
(if (and right_chan
|
||||
(>= fr_ext br_ext))
|
||||
(- right_chan_wid)
|
||||
0)))
|
||||
(setq obj (add-rectangle blockObj
|
||||
back_chan_wid
|
||||
back_chan_len
|
||||
(list back_chan_loc bchany 0)))
|
||||
;; "mirror" if flipped
|
||||
(if (= flip_back "1") (progn
|
||||
(vla-Move obj
|
||||
(vlax-3d-point 0 0 0)
|
||||
(vlax-3d-point (- back_chan_wid) 0 0))))
|
||||
(mirror obj)
|
||||
(setvar 'clayer "HIDDEN")
|
||||
(setq obj (add-polyline blockObj
|
||||
(list (+ back_chan_loc back_chan_web)
|
||||
bchany
|
||||
0)
|
||||
(list '(0 0 0)
|
||||
(list 0 back_chan_len 0))
|
||||
nil))
|
||||
;; mirror if flipped
|
||||
(if (= flip_back "1") (progn
|
||||
(setq tmp (vla-Mirror obj
|
||||
(vlax-3d-point back_chan_loc 0 0)
|
||||
(vlax-3d-point back_chan_loc 1 0)))
|
||||
(vla-Delete obj)
|
||||
(setq obj tmp)))
|
||||
(mirror obj)
|
||||
(setvar 'clayer "TEXT")
|
||||
(setq obj (vla-AddText blockObj
|
||||
back_chan
|
||||
(vlax-3d-point 0 0 0)
|
||||
4.0))
|
||||
(vla-put-Rotation obj (dtr 90.0))
|
||||
(vla-put-Alignment obj acAlignmentMiddleCenter)
|
||||
(vla-put-TextAlignmentPoint obj
|
||||
(vlax-3d-point (- back_chan_loc 3)
|
||||
frtexty
|
||||
0))
|
||||
(if (= flip_back "1") (vla-Move obj
|
||||
(vlax-3d-point 0 0 0)
|
||||
(vlax-3d-point (- back_chan_wid) 0 0)))
|
||||
(if (= side "Left") (vla-mirror-y obj))
|
||||
(vla-put-ScaleFactor obj 0.8)
|
||||
;;;;;;;;;;;;;;;;
|
||||
;; right channel
|
||||
;;;;;;;;;;;;;;;;
|
||||
(if right_chan (progn
|
||||
(setvar 'clayer "OBJ")
|
||||
(som (add-rectangle blockObj
|
||||
right_chan_len
|
||||
right_chan_wid
|
||||
(list (if (< fchany bchany) front_chan_wid 0)
|
||||
(- (max fchany bchany) right_chan_wid)
|
||||
0)))
|
||||
(setvar 'clayer "HIDDEN")
|
||||
(som (add-polyline blockObj
|
||||
(list (if (< fchany bchany) front_chan_wid 0)
|
||||
(- (max fchany bchany) right_chan_web)
|
||||
0)
|
||||
(list '(0 0 0)
|
||||
(list right_chan_len 0 0))
|
||||
nil))
|
||||
(setvar 'clayer "TEXT")
|
||||
(setq obj (vla-AddText blockObj
|
||||
right_chan
|
||||
(vlax-3d-point 0 0 0)
|
||||
4.0))
|
||||
(vla-put-Alignment obj acAlignmentMiddleCenter)
|
||||
(vla-put-TextAlignmentPoint obj
|
||||
(vlax-3d-point (/ back_chan_loc 2.0)
|
||||
(+ (max fchany bchany) 3)
|
||||
0))
|
||||
(mirror obj)
|
||||
(vla-put-ScaleFactor obj 0.8)))
|
||||
;;;;;;;;;;;;;;;
|
||||
;; left channel
|
||||
;;;;;;;;;;;;;;;
|
||||
(if left_chan (progn
|
||||
(setvar 'clayer "OBJ")
|
||||
(setq fchany (+ fchany front_chan_len)
|
||||
bchany (+ bchany back_chan_len))
|
||||
(som (add-rectangle blockObj
|
||||
left_chan_len
|
||||
left_chan_wid
|
||||
(list (if (>f fchany bchany 0.01) front_chan_wid 0)
|
||||
(min fchany bchany)
|
||||
0)))
|
||||
(setvar 'clayer "HIDDEN")
|
||||
(som (add-polyline blockObj
|
||||
(list (if (>f fchany bchany 0.01) front_chan_wid 0)
|
||||
(+ (min fchany bchany) left_chan_web)
|
||||
0)
|
||||
(list '(0 0 0)
|
||||
(list left_chan_len 0 0))
|
||||
nil))
|
||||
(setvar 'clayer "TEXT")
|
||||
(setq obj (vla-AddText blockObj
|
||||
left_chan
|
||||
(vlax-3d-point 0 0 0)
|
||||
4.0))
|
||||
(vla-put-Alignment obj acAlignmentMiddleCenter)
|
||||
(vla-put-TextAlignmentPoint obj
|
||||
(vlax-3d-point (/ back_chan_loc 2.0)
|
||||
(- (min fchany bchany) 3)
|
||||
0))
|
||||
(mirror obj)
|
||||
(vla-put-ScaleFactor obj 0.8)))
|
||||
;;;;;;;;;;;
|
||||
;; platform
|
||||
;;;;;;;;;;;
|
||||
;; line between stairs
|
||||
(setvar 'clayer "SOLID")
|
||||
(foreach f/b '("front" "back")
|
||||
(if (= "2 Stairs" (eval (read (strcat f/b "_bolt_to"))))
|
||||
(apply
|
||||
'(lambda (l-off l-wid r-wid r-off / x-val)
|
||||
(setq x-val (if (= f/b "front") 0 (* dir plt_dpt)))
|
||||
(add-polyline
|
||||
blockobj
|
||||
(list 0 0)
|
||||
(list
|
||||
(list x-val (- (* plt_wid 0.5) (+ l-off l-wid)))
|
||||
(list x-val (+ (* plt_wid -0.5) (+ r-wid r-off)))
|
||||
) ;_ list
|
||||
nil
|
||||
) ;_ add-polyline
|
||||
) ;_ lambda
|
||||
(mapcar
|
||||
'(lambda (str) (eval (read (strcat f/b str))))
|
||||
'( "_l-stair_offset" "_l-stair_wid"
|
||||
"_r-stair_wid" "_r-stair_offset"
|
||||
) ;_ quote
|
||||
) ;_ mapcar
|
||||
) ;_ apply
|
||||
) ;_ if
|
||||
) ;_ foreach
|
||||
;; outer platform edge
|
||||
(mapcar
|
||||
'(lambda (lst) (add-polyline blockObj (list 0 0 0) lst nil))
|
||||
(mapcar 'cdr
|
||||
(vl-remove-if
|
||||
'(lambda (lst) (null (caar lst)))
|
||||
(break-path)
|
||||
) ;_ vl-remove-if
|
||||
) ;_ cdr
|
||||
) ;_ mapcar
|
||||
;; assembly tag
|
||||
(setvar 'clayer "TEXT")
|
||||
(setq obj (vla-AddText blockObj assembly (vlax-3d-point 0 0 0) 5.5))
|
||||
(vla-put-Alignment obj acAlignmentMiddleCenter)
|
||||
(vla-put-TextAlignmentPoint obj (vlax-3d-point (/ back_chan_loc 2.0)
|
||||
(/ plt_wid 4.0)))
|
||||
(if (= side "Left") (vla-mirror-y obj))
|
||||
(vla-put-ScaleFactor obj 0.8)
|
||||
;; reset and insert block
|
||||
(setvar 'clayer clayer)
|
||||
(setvar 'textstyle textstyle)
|
||||
(setq blockObj (insert-block modelSpace ins blockObj))
|
||||
(assign-xdata blockObj "LandTop" (format-xdata data))
|
||||
(vla-put-Layer blockObj "LAND")
|
||||
(setvar 'cmdecho 0)
|
||||
(command "DRAWORDER" (entlast) "" "b")
|
||||
(setvar 'cmdecho 1))
|
@ -0,0 +1,367 @@
|
||||
;; add pipe handgrab polyline to blockObj
|
||||
(defun add-hg (ins pts / obj)
|
||||
(setq obj (add-polyline blockObj ins
|
||||
pts
|
||||
nil))
|
||||
(mirror obj)
|
||||
(vla-put-Color obj 140)
|
||||
(vla-put-Layer (offset&close obj 0.83 T nil) "NO PLOT")
|
||||
(vla-put-ConstantWidth obj 1.66)
|
||||
obj)
|
||||
|
||||
;; add rounded end for D-loops
|
||||
(defun add-donut (ins / obj)
|
||||
(setq obj (vla-AddCircle blockObj (3dpt ins) 0.83))
|
||||
(vla-put-Color obj 140)
|
||||
(mirror obj)
|
||||
(vla-put-Layer obj "NO PLOT")
|
||||
(setq obj (add-polyline blockObj
|
||||
ins
|
||||
'((-0.415 0 1)
|
||||
(0.415 0 1))
|
||||
t))
|
||||
(mirror obj)
|
||||
(vla-put-Color obj 140)
|
||||
(vla-put-ConstantWidth obj 0.83)
|
||||
obj)
|
||||
|
||||
;; add rail tag to blockObj
|
||||
(defun add-rail-tag (ins alignment str / obj tmp)
|
||||
(setq obj (add-mtext blockObj
|
||||
ins
|
||||
(strcat "{\\W0.5;" str "}")
|
||||
1
|
||||
alignment))
|
||||
(mirror obj)
|
||||
(vla-put-Height obj 5.5)
|
||||
(vla-put-BackgroundFill obj :vlax-true)
|
||||
(vla-put-LineSpacingDistance obj 8.0)
|
||||
(vla-put-StyleName obj "Calibri")
|
||||
;; no way to access in vlisp
|
||||
(setq tmp (entget (handent (vla-get-Handle obj)))
|
||||
;; scale factor of background mask
|
||||
tmp (entmod (subst (cons 45 1.2) (assoc 45 tmp) tmp))
|
||||
;; text frame
|
||||
tmp (entmod (subst (cons 90 19) (assoc 90 tmp) tmp))))
|
||||
|
||||
;; insert handgrab return block
|
||||
(defun draw-hg-rtrn (s1
|
||||
s2
|
||||
/
|
||||
assembly
|
||||
blockObj
|
||||
ins
|
||||
startx
|
||||
endx
|
||||
halfwid
|
||||
mirror
|
||||
tk2
|
||||
data
|
||||
s1-ndist
|
||||
s2-ndist
|
||||
flip-tag-p
|
||||
ret-type
|
||||
)
|
||||
(defun tk2 (explst) (translate-keys s2 explst))
|
||||
(defun mirror (obj / data)
|
||||
(setq data s1)
|
||||
(if (= (tk 'ascend) "Right")
|
||||
(vla-mirror-x obj))
|
||||
(if (= (tk 'dir) -1)
|
||||
(progn
|
||||
(vla-mirror-y obj)
|
||||
(vla-mirror-x obj))))
|
||||
(if (setq ret-type (rail-return-type s1 s2))
|
||||
(progn
|
||||
(setq assembly (with-data s1 '((stair-hr-assembly)))
|
||||
blockObj (p-blk assembly)
|
||||
data s1
|
||||
s1-ndist (tk '(+ top_cdist top_ext))
|
||||
halfwid (+ (/ (tk 'dist_btwn) 2.0) (if (= (tk 'i-rail_topmnt) "1") 3.83 2.33))
|
||||
startx (- (tk '(+ top_ext 3)))
|
||||
data s2
|
||||
s2-ndist (tk '(+ bot_cdist bot_ext))
|
||||
ins (cadr (assoc "ins" s2))
|
||||
endx (- 0
|
||||
(tk '(+ bot_ext 3))
|
||||
(if (wcmatch (tk 'bot_conn) "*haunch*") (tk '(- tread_depth)) 0))
|
||||
data s1
|
||||
midx 0)
|
||||
(add-hg (list (if (member ret-type '("EH" "HH"))
|
||||
-1.25
|
||||
(- (min s1-ndist s2-ndist)))
|
||||
0 0)
|
||||
(fillet-all-pts
|
||||
(list (list startx (- halfwid) 0)
|
||||
(list midx (- halfwid) 0)
|
||||
(list midx halfwid 0)
|
||||
(list endx halfwid 0))
|
||||
2.83))
|
||||
(add-rail-tag (list 3
|
||||
(+ (- halfwid 2.33) 3)
|
||||
0)
|
||||
(if flip-tag-p 'topleft 'bottomleft)
|
||||
assembly)
|
||||
(vla-put-layer-r (insert-block modelspace ins blockObj) "RAILS"))))
|
||||
|
||||
;; draw all individual top rails for one flight
|
||||
;; returns happen elsewhere
|
||||
(defun draw-top-rails (stair
|
||||
/
|
||||
ins
|
||||
mirror
|
||||
start
|
||||
draw-stair-rail
|
||||
draw-guard-rail
|
||||
draw-guard-rail-btwn
|
||||
draw-wall-rail
|
||||
draw-rails
|
||||
obj
|
||||
)
|
||||
(defun mirror (obj)
|
||||
(progn
|
||||
(if (member quadrant '(2 3))
|
||||
(vla-mirror-y obj))
|
||||
(if (member quadrant '(3 4))
|
||||
(vla-mirror-x obj))
|
||||
(if (= break "top")
|
||||
(vla-mirror-y obj))
|
||||
(if (= side "o")
|
||||
(vla-mirror-x obj))
|
||||
(if *mirror-y* (vla-mirror-y obj))
|
||||
(if *mirror-x* (vla-mirror-x obj))))
|
||||
|
||||
;; return the midpoint between the first nosing and either the last
|
||||
;; nosing or the break line
|
||||
(defun pitch-rail-tag-x ()
|
||||
(+ (if (= break "no") (/ run 2.0) 15)
|
||||
(if (= start "bot")
|
||||
(+ bot_cdist bot_ext)
|
||||
(+ top_cdist top_ext))))
|
||||
|
||||
;; insert the stair rail block
|
||||
(defun draw-stair-rail (ins side / rext x wid blockObj obj tmp draw-stair-rail-inner name)
|
||||
;; rail outline
|
||||
(defun draw-stair-rail-inner ()
|
||||
(mirror (add-rectangle blockObj wid -1.5 (list x 0 0)))
|
||||
(add-rail-tag (list (pitch-rail-tag-x) 5 0) 'bottomcenter name)
|
||||
;; HG geometry
|
||||
(setq x (+ x
|
||||
0.625
|
||||
(if (= start "bot")
|
||||
(if bot-dloop
|
||||
(- (+ tread_depth (if (= rail_lvl-off "1") 18 3)))
|
||||
0)
|
||||
(if top-dloop -18 0)))
|
||||
wid (- wid
|
||||
(if (= start "bot")
|
||||
(if bot-dloop
|
||||
(- (+ tread_depth (if (= rail_lvl-off "1") 17.375 2.375)))
|
||||
0.625)
|
||||
0)
|
||||
(if (not (= break "bot"))
|
||||
(if top-dloop
|
||||
-17.375
|
||||
0.625)
|
||||
0)))
|
||||
(add-hg (list x 2.33 0)
|
||||
(list '(0 0 0)
|
||||
(list wid 0 0)))
|
||||
(if (and bot-dloop
|
||||
(not (= start "top")))
|
||||
(add-donut (list x 2.33 0)))
|
||||
(if (and top-dloop
|
||||
(not (= break "bot")))
|
||||
(add-donut (list (if (= start "top") x (+ x wid)) 2.33 0))))
|
||||
|
||||
(setq name (stair-rail-assembly side)
|
||||
blockObj (p-blk name)
|
||||
rext (vl-symbol-value (read (strcat side "-rail_" start "_ext")))
|
||||
x (if (= start "top")
|
||||
(if (<= top_ext (/ tread_depth 2.0))
|
||||
(- 3.625 rext)
|
||||
(+ top_cdist top_ext 2.375 (- rext)))
|
||||
(if (wcmatch bot_conn "*haunch*")
|
||||
(- bot_ext rext 7.375)
|
||||
(- 3.625 rext)))
|
||||
wid (if (= break "no")
|
||||
(- (+ bot_cdist
|
||||
bot_ext
|
||||
run
|
||||
(if (wcmatch (sidekey-rail "type") "Chop*")
|
||||
(- (/ (sidekey-rail "cutoff")
|
||||
(tan (dtr pitch))))
|
||||
(+ -2.375
|
||||
(sidekey-rail "top_ext")))
|
||||
(if (and (wcmatch top_conn "*ext*")
|
||||
(<= top_ext (/ tread_depth 2.0)))
|
||||
top_ext
|
||||
0))
|
||||
x)
|
||||
(- (+ (if (= break "top")
|
||||
(+ top_ext top_cdist)
|
||||
(+ bot_ext bot_cdist))
|
||||
30)
|
||||
x)))
|
||||
(if (> wid 0)
|
||||
(progn
|
||||
(draw-stair-rail-inner)
|
||||
(vla-put-Layer (insert-block modelSpace ins blockObj) "RAILS"))))
|
||||
|
||||
|
||||
;; insert a guard rail block
|
||||
(defun draw-guard-rail (ins side tb / name blockObj wid *mirror-y*)
|
||||
(setq name (stair-guard-assembly (strcat side tb))
|
||||
blockObj (p-blk name)
|
||||
ext (vl-symbol-value (read (strcat tb "_ext")))
|
||||
wid (- (+ ext 1.5) 3.625 (if (= tb "bot") tread_depth 0))
|
||||
*mirror-y* (and (= break "no")
|
||||
(= tb "top")))
|
||||
(mirror (add-rectangle blockObj wid -1.5 (list 3.625 0 0)))
|
||||
(add-rail-tag (list (+ 3.625 (/ wid 2.0)) 5 0) 'bottomcenter name)
|
||||
(vla-put-Layer (insert-block modelSpace ins blockObj) "RAILS"))
|
||||
|
||||
;; insert a guard rail block between stairs
|
||||
(defun draw-guard-rail-btwn (ins / name blockObj *mirror-y* wid)
|
||||
(setq name (stair-guard-assembly "btwn")
|
||||
blockObj (p-blk name)
|
||||
*mirror-y* (= break "top")
|
||||
wid (- dist_btwn (if (= i-rail_topmnt "1") 0.125 3.125)))
|
||||
(if (> wid 7.125)
|
||||
;; normal
|
||||
(mirror
|
||||
(add-rectangle blockObj -1.5
|
||||
(- wid)
|
||||
'(-3.625 -1.5625 0)))
|
||||
;; post w/ tabs
|
||||
(progn
|
||||
(setq wid (/ (- wid 1.5) 2.0))
|
||||
(mirror
|
||||
(add-rectangle blockObj
|
||||
-0.25
|
||||
(- wid)
|
||||
'(-4.25 -1.5625 0)))
|
||||
(mirror
|
||||
(add-rectangle blockObj
|
||||
-1.5
|
||||
-1.5
|
||||
(list -3.625 (- 0 1.5625 wid) 0)))
|
||||
(mirror
|
||||
(add-rectangle blockObj
|
||||
-0.25
|
||||
(- wid)
|
||||
(list -4.25 (- 0 3.0625 wid) 0)))))
|
||||
(add-rail-tag '(3 3 0) 'bottomleft name)
|
||||
(vla-put-Layer (insert-block modelspace ins blockObj) "RAILS"))
|
||||
|
||||
;; insert a wall rail block
|
||||
(defun draw-wall-rail (ins
|
||||
side
|
||||
/
|
||||
blockObj
|
||||
startx
|
||||
endx
|
||||
ndist
|
||||
pts
|
||||
)
|
||||
(setq blockObj (p-blk (stair-rail-assembly side))
|
||||
ndist (+ (symcat '(#start "_cdist"))
|
||||
(symcat '(#start "_ext")))
|
||||
startx (- ndist
|
||||
(if (= start "bot")
|
||||
(+ tread_depth (if (= rail_lvl-off "1") 15 0))
|
||||
15))
|
||||
endx (if (= break "no")
|
||||
(+ ndist run 15)
|
||||
(+ ndist 30))
|
||||
;; A-B
|
||||
pts (list (list startx 2.33 0)
|
||||
(list endx 2.33 0)))
|
||||
;; bends and D-loops
|
||||
(if bot-dloop
|
||||
(if (= start "bot")
|
||||
(add-donut (list startx 1.33 0)))
|
||||
(if (= start "bot")
|
||||
(setq pts (cons (list startx 0 0) pts))))
|
||||
(if top-dloop
|
||||
(cond ((= start "top")
|
||||
(add-donut (list startx 1.33 0)))
|
||||
((= break "no")
|
||||
(add-donut (list endx 1.33 0))))
|
||||
(cond ((= start "top")
|
||||
(setq pts (cons (list startx 0 0) pts)))
|
||||
((= break "no")
|
||||
(setq pts (append pts (list (list endx 0 0)))))))
|
||||
;; fillet
|
||||
(if (> (length pts) 2)
|
||||
(setq pts (fillet-all-pts pts 2.3)))
|
||||
(add-hg '(0 -1 0) pts)
|
||||
(add-rail-tag (list (pitch-rail-tag-x) 5 0)
|
||||
'bottomcenter
|
||||
(strcat "WR"
|
||||
number
|
||||
"-"
|
||||
level
|
||||
sequence
|
||||
(if (= (symcat '(#(if (= side "i") "o" "i") "-rail_type"))
|
||||
"Wall Rail")
|
||||
(if (or (and (= ascend "Left")
|
||||
(= side "i"))
|
||||
(and (= ascend "Right")
|
||||
(= side "o")))
|
||||
"-L"
|
||||
"-R")
|
||||
"")))
|
||||
(vla-put-Layer (insert-block modelSpace ins blockObj) "RAILS"))
|
||||
|
||||
;; draw all rails for one side of a stair
|
||||
(defun draw-rails (side ins / rtype top-dloop bot-dloop)
|
||||
(if (= side "o")
|
||||
(setq offset (+ offset width)))
|
||||
(setq rtype (sidekey-rail "type")
|
||||
ins (list (car ins)
|
||||
((if (= z_pos "Far") + -) (cadr ins) offset)
|
||||
0)
|
||||
top-dloop (= (sidekey-rail "top_dloop") "1")
|
||||
bot-dloop (= (sidekey-rail "bot_dloop") "1"))
|
||||
(set-active-layer "RAILS")
|
||||
(if (wcmatch rtype "*Stair*")
|
||||
(progn
|
||||
(if (= (sidekey-rail "topmnt") "1")
|
||||
(setq ins (list (car ins)
|
||||
((if (or (and (= z_pos "Far")
|
||||
(= side "i"))
|
||||
(and (= z_pos "Near")
|
||||
(= side "o")))
|
||||
+ -)
|
||||
(cadr ins) 1.5)
|
||||
(last ins))))
|
||||
;; stair rail
|
||||
(draw-stair-rail ins side)
|
||||
;; bottom guard
|
||||
(if (and (= start "bot")
|
||||
(wcmatch bot_conn "*haunch*"))
|
||||
(draw-guard-rail ins side "bot"))
|
||||
;; reset ins to top
|
||||
(setq ins (if (= break "no")
|
||||
(cons (+ (* dir (+ bot_cdist bot_ext run top_ext top_cdist))
|
||||
(car ins))
|
||||
(cdr ins))
|
||||
ins))
|
||||
;; top guard
|
||||
(if (and (not (= break "bot"))
|
||||
(or (wcmatch top_conn "*haunch*")
|
||||
(wcmatch top_conn "*ext*"))
|
||||
(> top_ext (/ tread_depth 2.0)))
|
||||
(draw-guard-rail ins side "top"))
|
||||
;; guard between
|
||||
(if (and (= side "i")
|
||||
(not (= break "bot"))
|
||||
(> dist_btwn (if (= i-rail_topmnt "1") 3.875 5.875)))
|
||||
(draw-guard-rail-btwn ins)))
|
||||
;; wall rail
|
||||
(draw-wall-rail ins side)))
|
||||
(with-data stair
|
||||
'((setq start (if (= break "top") "top" "bot"))
|
||||
(draw-rails "i" ins)
|
||||
(draw-rails "o" ins))))
|
@ -0,0 +1,348 @@
|
||||
;; set up for functions which draw full or short views
|
||||
(defun draw-stair-top-view (data ins break offset /
|
||||
blockObj
|
||||
tv-stair-bolt
|
||||
obj
|
||||
quadrant
|
||||
clayer
|
||||
x
|
||||
y
|
||||
tmp
|
||||
ext
|
||||
istrwid
|
||||
istrbex
|
||||
istrxtex
|
||||
istrtex
|
||||
istrxtex
|
||||
ostrwid
|
||||
ostrbex
|
||||
ostrxbex
|
||||
ostrtex
|
||||
ostrxtex
|
||||
som
|
||||
add-tag
|
||||
add-str
|
||||
add-arc
|
||||
)
|
||||
(setq blockObj (p-blk assembly)
|
||||
clayer (getvar 'clayer))
|
||||
|
||||
;; put the obj in the correct quadrant
|
||||
(defun mirror (obj)
|
||||
(if (member quadrant '(2 3))
|
||||
(vla-mirror-y obj))
|
||||
(if (member quadrant '(3 4))
|
||||
(vla-mirror-x obj))
|
||||
(if (= break "Top")
|
||||
(vla-mirror-y obj)))
|
||||
;; "(setq obj ...), (mirror ...)"
|
||||
(defun som (new-obj)
|
||||
(setq obj new-obj)
|
||||
(mirror obj))
|
||||
|
||||
;; add the ID tag
|
||||
(defun add-tag ( / tmp)
|
||||
;; mtext
|
||||
(setvar 'clayer "TEXT")
|
||||
(setq x (+ (if (= break "Top") (max ix ox) ext) bot_cdist)
|
||||
y (+ offset (/ width 2.0)))
|
||||
(setq obj (add-mtext blockObj
|
||||
(list (+ x tread_depth) y 0)
|
||||
(strcat "{\\W0.5;"
|
||||
assembly
|
||||
"\\P"
|
||||
(if (= break "Top")
|
||||
"DN"
|
||||
"UP")
|
||||
"}")
|
||||
(* 2 tread_depth)
|
||||
'MiddleCenter))
|
||||
(vla-put-Height obj 5.5)
|
||||
(vla-put-StyleName obj "Calibri")
|
||||
(mirror obj)
|
||||
(vla-put-BackgroundFill obj :vlax-true)
|
||||
(vla-put-LineSpacingDistance obj 8.0)
|
||||
;; set scale factor of background mask, text frame and defined height
|
||||
;; no way to access in vlisp
|
||||
(setq tmp (entget (handent (vla-get-Handle obj)))
|
||||
tmp (entmod (subst (cons 45 1.0) (assoc 45 tmp) tmp))
|
||||
tmp (entmod (subst (cons 46 16.0) (assoc 46 tmp) tmp))
|
||||
tmp (entmod (subst (cons 90 19) (assoc 90 tmp) tmp)))
|
||||
;; arrow
|
||||
(setvar 'clayer "SOLID")
|
||||
(som (add-polyline blockObj
|
||||
(list x y 0)
|
||||
(list '(0 0 0)
|
||||
(list (* tread_depth 2) 0 0)
|
||||
(list (- (* tread_depth 3) (/ tread_depth 2.0)) 0 0))
|
||||
nil))
|
||||
(vla-SetWidth obj 1 3 0)
|
||||
;; circle
|
||||
(setvar 'clayer "DIM")
|
||||
(som (add-polyline blockObj
|
||||
(list x y 0)
|
||||
(list (list -1 0 (calc-bulge (dtr 180)))
|
||||
(list 1 0 (calc-bulge (dtr 180))))
|
||||
T))
|
||||
(vla-put-ConstantWidth obj 2.0))
|
||||
|
||||
;; add the stringer tags
|
||||
(defun add-str ()
|
||||
(mapcar
|
||||
'(lambda (txt off / txtObj)
|
||||
(setq txtObj (add-text blockObj
|
||||
(list (+ x tread_depth) (+ offset off))
|
||||
txt
|
||||
4.0
|
||||
0.5
|
||||
'MiddleCenter))
|
||||
(vla-put-Layer txtObj "TEXT")
|
||||
(vla-put-StyleName txtObj "Calibri")
|
||||
(mirror txtObj)
|
||||
) ;_ lambda
|
||||
(list l-string_mat r-string_mat)
|
||||
(list
|
||||
(if (= ascend "Left") (+ l-string_wid 3) (- width l-string_wid 3))
|
||||
(if (= ascend "Right") (+ r-string_wid 3) (- width r-string_wid 3))
|
||||
);_ list
|
||||
) ;_ mapcar
|
||||
) ;_ defun add-str
|
||||
|
||||
;; add clearance arc at top or bottom
|
||||
(defun add-arc (tb / topp x pts obj)
|
||||
(setq topp (= tb 't)
|
||||
x (+ (if topp
|
||||
top_cdist
|
||||
bot_cdist)
|
||||
(if (and topp (= break "No")) (+ bot_ext run top_ext) 0))
|
||||
pts (fillet-all-pts
|
||||
(list (list (- width) 0)
|
||||
(list (- width) width)
|
||||
(list 0 width 0))
|
||||
(- width 0.001)))
|
||||
;; add distance between at top
|
||||
(if (and topp
|
||||
(> dist_btwn 0))
|
||||
(setq pts (cons (list (- width) (- dist_btwn) 0)
|
||||
pts)))
|
||||
;; complicated mirror
|
||||
(setq obj (add-polyline blockObj
|
||||
(list x offset 0)
|
||||
pts
|
||||
nil))
|
||||
(if (and topp (= break "No")) (setq obj (mirror&delete obj (list x offset) 'y)))
|
||||
(som obj)
|
||||
(vla-put-Color obj 252)
|
||||
(vla-put-Layer obj "HIDDEN"))
|
||||
|
||||
;;; draw bolt centerlines
|
||||
(defun tv-stair-bolt ( / bot-cen top-cen max-len)
|
||||
(setq max-len (+ bot_ext bot_cdist run top_cdist top_ext))
|
||||
(if (and bot_hbolt bot_vbolt (member break '("No" "Bot")))
|
||||
(progn
|
||||
(setq bot-cen (list bot_hbolt (- width bot_hbolt)))
|
||||
(if bot_hbolt2
|
||||
(append! 'bot-cen
|
||||
(mapcar '+ bot-cen (list bot_hbolt2 (- bot_hbolt2)))
|
||||
) ;_ append!
|
||||
) ;_ if
|
||||
(mapcar!
|
||||
'(lambda (y) (list (list 0 (+ y offset) 0) dir))
|
||||
'bot-cen
|
||||
) ;_ mapcar!
|
||||
) ;_ progn
|
||||
) ;_ if
|
||||
(if (and top_hbolt (member break '("No" "Top")))
|
||||
(progn
|
||||
(setq top-cen (list top_hbolt (- width top_hbolt)))
|
||||
(if top_hbolt2
|
||||
(append! 'top-cen
|
||||
(mapcar '+ top-cen (list top_hbolt2 (- top_hbolt2)))
|
||||
) ;_ append!
|
||||
) ;_ if
|
||||
(mapcar!
|
||||
'(lambda (y)
|
||||
(list
|
||||
(list
|
||||
(if (= break "No") (* dir max-len) 0)
|
||||
(+ y offset)
|
||||
0
|
||||
) ;_ list
|
||||
(if (= break "No") (- dir) dir)
|
||||
) ;_ list
|
||||
) ;_ lambda
|
||||
'top-cen
|
||||
) ;_ mapcar
|
||||
) ;_ progn
|
||||
) ;_ if
|
||||
(mapcar
|
||||
'(lambda (v)
|
||||
(som
|
||||
(vla-put-layer-r
|
||||
(add-polyline
|
||||
blockobj
|
||||
(mapcar '* (list dir 1 0) (car v))
|
||||
(list '(0 0 0) (list (* dir (cadr v)) 0 0))
|
||||
nil
|
||||
) ;_ add-polyline
|
||||
"center"
|
||||
) ;_ vlax-put-property-r
|
||||
) ;_ som
|
||||
) ;_ lambda
|
||||
(append bot-cen top-cen)
|
||||
) ;_ mapcar
|
||||
) ;_ defun tv-stair-bolt
|
||||
|
||||
;; ascertain which quadrant to move to
|
||||
(setq quadrant (if (= ascend "Right")
|
||||
(if (= z_pos "Far")
|
||||
1
|
||||
3)
|
||||
(if (= z_pos "Far")
|
||||
2
|
||||
4)))
|
||||
(add-to-list 'data (list "quadrant" quadrant))
|
||||
;; determine inside/outside stringers
|
||||
(mapcar 'set
|
||||
(if (= ascend "Left")
|
||||
'(istrwid
|
||||
istrtex
|
||||
istrxtex
|
||||
istrbex
|
||||
istrxbex
|
||||
ostrwid
|
||||
ostrtex
|
||||
ostrxtex
|
||||
ostrbex
|
||||
ostrxbex)
|
||||
'(ostrwid
|
||||
ostrtex
|
||||
ostrxtex
|
||||
ostrbex
|
||||
ostrxbex
|
||||
istrwid
|
||||
istrtex
|
||||
istrxtex
|
||||
istrbex
|
||||
istrxbex))
|
||||
(list
|
||||
l-string_wid
|
||||
l-string_tex
|
||||
l-string_xtra_tex
|
||||
l-string_bex
|
||||
l-string_xtra_bex
|
||||
r-string_wid
|
||||
r-string_tex
|
||||
r-string_xtra_tex
|
||||
r-string_bex
|
||||
r-string_xtra_bex))
|
||||
(setq ext (max (- istrbex istrxbex)
|
||||
(- ostrbex ostrxbex)))
|
||||
|
||||
(if (= break "No")
|
||||
(draw-stair-top-view-full)
|
||||
(draw-stair-top-view-short))
|
||||
|
||||
(setvar 'clayer clayer)
|
||||
(setq blockObj (insert-block modelSpace ins blockObj))
|
||||
(add-to-list 'data (list "break" (lowercase break)))
|
||||
(add-to-list 'data (list "offset" offset))
|
||||
(assign-xdata blockObj "StairTop" (format-xdata data))
|
||||
(vla-put-Layer blockObj (strcat z_pos "-stair")))
|
||||
|
||||
(defun draw-stair-top-view-full ( / x y)
|
||||
(setvar 'clayer "SOLID")
|
||||
;; inside stringer
|
||||
(som (add-rectangle blockObj
|
||||
(+ istrbex bot_cdist run top_cdist istrtex)
|
||||
istrwid
|
||||
(list (- 0 istrxbex) offset 0)))
|
||||
;; outside stringer
|
||||
(som (add-rectangle blockObj
|
||||
(+ ostrbex bot_cdist run top_cdist ostrtex)
|
||||
ostrwid
|
||||
(list (- 0 ostrxbex) (+ (- width ostrwid) offset) 0)))
|
||||
;; risers
|
||||
(setq x (+ bot_ext bot_cdist)
|
||||
y (- width istrwid ostrwid))
|
||||
(repeat rise_qty
|
||||
(som (add-polyline blockObj
|
||||
(list x (+ istrwid offset) 0)
|
||||
(list '(0 0 0)
|
||||
(list 0 y 0))
|
||||
nil))
|
||||
(setq x (+ x tread_depth)))
|
||||
;; clear arcs
|
||||
(if (= show_arc "1")
|
||||
(progn
|
||||
(add-arc 'b)
|
||||
(add-arc 't)))
|
||||
(add-tag)
|
||||
(add-str)
|
||||
(tv-stair-bolt)
|
||||
)
|
||||
|
||||
(defun draw-stair-top-view-short ( / end x y ix ox)
|
||||
(mapcar 'set
|
||||
'(ix ox)
|
||||
(if (= break "Top")
|
||||
(list (- istrtex istrxtex)
|
||||
(- ostrtex ostrxtex))
|
||||
(list (- istrbex istrxbex)
|
||||
(- ostrbex ostrxbex))))
|
||||
(setq end (+ (max ix ox) bot_cdist (* 2 tread_depth) (- tread_depth 3)))
|
||||
(setvar 'clayer "SOLID")
|
||||
;; inside stringer
|
||||
(som (add-rectangle blockObj
|
||||
(+ (if (= break "Top") istrxtex istrxbex) end)
|
||||
istrwid
|
||||
(list (- 0 (if (= break "Top") istrxtex istrxbex)) offset 0)))
|
||||
;; outside stringer
|
||||
(som (add-rectangle blockObj
|
||||
(+ (if (= break "Top") ostrxtex ostrxbex) end)
|
||||
ostrwid
|
||||
(list (- 0 (if (= break "Top") ostrxtex ostrxbex)) (+ (- width ostrwid) offset) 0)))
|
||||
;; risers
|
||||
(setq x (if (= break "Top")
|
||||
(+ top_ext top_cdist)
|
||||
(+ bot_ext bot_cdist))
|
||||
y (- width istrwid ostrwid))
|
||||
(repeat 3
|
||||
(som (add-polyline blockObj
|
||||
(list x (+ offset istrwid) 0)
|
||||
(list '(0 0 0)
|
||||
(list 0 y 0))
|
||||
nil))
|
||||
(setq x (+ x tread_depth)))
|
||||
;; breakline
|
||||
(setq y (/ width 2.0))
|
||||
(setvar 'clayer "DIM")
|
||||
(setq obj (add-polyline blockObj
|
||||
(list end offset 0)
|
||||
(list '(0 0 0)
|
||||
(list 0 (- y 1.5) 0)
|
||||
(list (+ 0 2)
|
||||
(- y 0.75)
|
||||
0)
|
||||
(list (- 0 2)
|
||||
(+ y 0.75)
|
||||
0)
|
||||
(list 0 (+ y 1.5) 0)
|
||||
(list 0 width 0))
|
||||
nil))
|
||||
;; clearance arc
|
||||
(if (= show_arc "1")
|
||||
(add-arc (if (= break "Top") 't 'b)))
|
||||
(if (or (member quadrant '(2 3))
|
||||
(= break "Top"))
|
||||
(progn
|
||||
(setq tmp
|
||||
(vla-Mirror obj
|
||||
(vlax-3d-point end 0 0)
|
||||
(vlax-3d-point end 1 0)))
|
||||
(vla-Delete obj)
|
||||
(setq obj tmp)))
|
||||
(mirror obj)
|
||||
(add-tag)
|
||||
(add-str)
|
||||
(tv-stair-bolt))
|
Loading…
Reference in new issue