pete
/
psc
1
0
Fork 0

Document most of the rest of the commands

checker-starter-anchor-sl
Pete Ley 10 months ago
parent 425b81671f
commit 9bdeb350aa

@ -58,11 +58,12 @@ If the user is a developer, set *dev-mode* to t."
"S:/psc-src/"))
(defun-r 'calc-src-dir)
(defun-q psc-load (*file-name* / job-dir)
(defun-q psc-load (*file-name* / job-dir name)
"Alias for load so that *FILE-NAME* is set automatically for each file
Assumes the file lives in psc-src-dir."
(load (strcat psc-src-dir *file-name*)))
Assumes the file lives in psc-src-dir. Returns the file name as a string."
(load (strcat psc-src-dir *file-name*))
*file-name*)
(defun-r 'psc-load)
(defun-q psc-include (filenames)

@ -18,7 +18,16 @@
conn_opts-keys
chan_bolts-keys
)
"Creates or edits landing blocks"
"Creates or edits landing blocks
To create a new landing from scratch, press ENTER at the selection prompt.
To create a new landing based on the properties of the two stairs that will connect to it,
select both stairs (and nothing else) at the prompt and pess ENTER.
To edit a single landing, select it at the prompt and press ENTER.
To edit multiple landings in bulk, select them all at the prompt and press ENTER."
(defun error-out ()
(error "LANDING: valid selections are: (1) landing, (2) stairs, OR multiple landings"))
(defun all-are (app-id)

@ -1,4 +1,5 @@
(defun c:railcircle (/ pt)
(defun-q c:railcircle (/ pt)
"Draws a donut with an outline, formatted like a top view handgrab"
(setq pt (getpoint "\nCircle centerpoint: "))
(setvar 'cmdecho 0)
(setvar 'cecolor "140")
@ -7,3 +8,4 @@
(setvar 'cecolor "BYLAYER")
(setvar 'cmdecho 1)
pt)
(defun-r 'c:railcircle)

@ -1,20 +1,29 @@
;; command to draw rail blocks at stairs (landings in future)
(psc-include '("rail/stair-rail.lsp"
"rail/guard-rail.lsp"
"rail/wall-rail.lsp"
"rail/return.lsp"
))
(psc-include
'(
"rail/stair-rail.lsp"
"rail/guard-rail.lsp"
"rail/wall-rail.lsp"
"rail/return.lsp"
))
(defun c:rails (/
enames
kword
kwords
i
next
side
dispatch
)
(defun-q c:rails (/
enames
kword
kwords
i
next
side
dispatch
)
"Draws rail blocks at stair main sections
This command will draw stair rails, guard rails, wall rails, and handgrab returns at all
selected stairs. Returns are only drawn between two flights, so the last flight won't have
a return added, even if it should get one.
This command can be used to draw either the inside or outside rails for each flight."
;; call appropriate draw function
(defun dispatch (ename next / ins rail-type)
(with-data (draw-xdata-migrate 'ename "Stair")
@ -38,3 +47,4 @@
(setq enames (get-stairland 'stair T))
(mapcar 'dispatch enames (append (cdr enames) '(nil)))
(princ))
(defun-r 'c:rails)

@ -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,6 +1,5 @@
;; zoom extents, purge blocks, close drawing
(defun c:savequit ()
(defun-q c:savequit ()
"Zooms to extents, purges blocks, and closes the drawing"
(setvar 'cmdecho 0)
(command "zoom" "e")
(command "-purge" "b" "*" "n")
@ -8,4 +7,5 @@
(setvar 'cmdecho 1)
(command "close")
(princ))
(defun-r 'c:savequit)

@ -1,8 +1,9 @@
;; draw a line representing a shape in "schematic" plan view
(setq *shape-line-name* "W10x12")
(defun c:shape-line (/ name pt1 pt2 ang endpts)
(defun-q c:shape-line (/ name pt1 pt2 ang endpts)
"Draws a line representing a beam in 'schematic' plan view
This command draws a 3 inch thick polyline with a label, for use in RO plan views."
(setq name (getstring (strcat "\nName <" *shape-line-name* ">: "))
pt1 (getpoint "\nPoint 1: ")
pt2 (getpoint pt1 "\nPoint 2: ")
@ -32,4 +33,5 @@
(vla-put-Rotation mt ang)
(vla-put-Layer mt "TEXT")))
(princ))
(defun-r 'c:shape-line)

@ -1,6 +1,8 @@
;; insert text labels for drawshape blocks
(defun-q c:shape-text (/ shape shape-ins str obj)
"Draws a text label for a DRAWSHAPE section block
(defun c:shape-text (/ shape shape-ins str obj)
Running this command and selecting a section block that was created using DRAWSHAPE will
put a text label on your cursor for inserting in an RO section view."
(setq shape (car (entsel "\nSelect section block: ")))
(if (not shape) (error "No shape selected"))
(setq shape-ins (cdr (assoc 10 (entget shape)))
@ -12,3 +14,4 @@
(command "move" (entlast) "" shape-ins)
(setvar 'cmdecho 1)
(princ))
(defun-r 'c:shape-text)

@ -1,30 +1,36 @@
;; Command to get stair information via dialog
;; 2021 Peter Ley
(psc-include
'(
"common-data.lsp"
"dialog/dialog.lsp"
"shapes/shape.lsp"
"shapes/pan.lsp"
"stair/dialog.lsp"
"stair/derived.lsp"
"stair/details.lsp"
"stair/migrations.lsp"
"stair/section.lsp"
"3D/3d-stair.lsp"
"stair/stringer.lsp"
"stair/tread.lsp"
))
(psc-include '("common-data.lsp"
"dialog/dialog.lsp"
"shapes/shape.lsp"
"shapes/pan.lsp"
"stair/dialog.lsp"
"stair/derived.lsp"
"stair/details.lsp"
"stair/migrations.lsp"
"stair/section.lsp"
"3D/3d-stair.lsp"
"stair/stringer.lsp"
"stair/tread.lsp"))
(defun-q c:stair ( / stair-data
source
app-id
delta
tread_opts-keys
conn_opts-keys
rail_opts-keys
rail_opts-dist-keys
rail-types
rot)
"Creates or edits stair blocks
;; get a stair definition via dialog and draw it
(defun c:stair ( / stair-data
source
app-id
delta
tread_opts-keys
conn_opts-keys
rail_opts-keys
rail_opts-dist-keys
rail-types
rot)
To create a new stair, press ENTER at the selection prompt.
To edit a single star, select it at the prompt and press ENTER.
To edit multiple stairs in bulk, select them all at the prompt and press ENTER."
(setq source (get-stairland 'stair nil))
(if (= (length source) 1)
@ -64,115 +70,4 @@
) ;_ if
(princ))
(defun stair-multi-edit (source
delta
/
switch-z-pos
process-sd-key
process-rail-opts
update-stair
flights
level
sequence
flights_level
)
(defun switch-z-pos ( / elt val)
(if (= (cadr (assoc "switch_z_pos" delta)) "1")
(progn
(setq elt (assoc "z_pos" stair-data)
val (cadr elt))
(subst! (list "z_pos"
(if (= val "Near") "Far" "Near"))
elt
'stair-data))))
;; substitute sub-dialog options
;; for tread_opts and conn_opts
(defun process-sd-key (key)
(remove! 'stair-data '(= (car x) key))
(if (setq tmp (assoc key delta))
(progn
(remove! 'delta (= x tmp))
(add-to-list 'stair-data tmp))))
;; ensure correct keys for multi-edit rail_opts
(defun process-rail_opts (delta / rtype def sds all)
(foreach side '("i" "o")
(if (setq rtype (assoc (strcat side "-rail_type") delta))
(progn
(setq rtype (cadr rtype)
sds (mapcar 'car stair-data)
all (uniquify (map-append 'cdr rail-types))
all (mapcar '(lambda(x) (strcat side "-rail_" x)) all)
def (cdr (assoc rtype rail-types)))
;; remove all non-members from stair-data
(foreach key sds
(if (and (member key all)
(not (member (substr key 8) def)))
(remove! 'stair-data '(= (car x) key))))
;; add ones that are not present (for subst to work)
;; set them to default values (in case they are not present in delta)
(foreach key def
(setq key (strcat side "-rail_" key))
(if (not (member key sds))
(add-to-list
'stair-data
(list key (if (member key rail_opts-dist-keys) 0.0 "0")))))))))
;; update the data for and redraw one stair block
(defun update-stair (ename
/
app-id
stair-data
ins
tmp
tb
rot
)
(setq app-id (cadr (assoc "app_id" (read-xdata ename "")))
stair-data (vl-sort (draw-xdata-migrate 'ename app-id) sort-data-by-key)
rot (vla-get-rotation (ename>vlobj ename))
ins (get-ins-and-delete ename))
(switch-z-pos)
;; renumber flights
(if level
(progn
(subst-key! "level" (to-string level) 'stair-data)
(subst-key! "sequence" (substr "ABCDEFGH" sequence 1) 'stair-data)
(inc! 'sequence)
(if (> sequence flights_level)
(setq sequence 1
level (1+ level)))))
;; handle sub-dialog keys
(if (vl-some '(lambda(x) (= (car x) "tread_style")) delta)
(mapcar 'process-sd-key tread_opts-keys))
(if (vl-some '(lambda(x) (= (car x) "top_conn")) delta)
(mapcar 'process-sd-key (remove conn_opts-keys '(not (begins-with x "t")))))
(if (vl-some '(lambda(x) (= (car x) "bot_conn")) delta)
(mapcar 'process-sd-key (remove conn_opts-keys '(not (begins-with x "b")))))
(if (vl-some '(lambda(x) (= (car x) "rail_style")) delta)
(process-rail_opts delta))
;; add comment key if not present
(if (and (member "comment" (mapcar 'car delta))
(not (member "comment" (mapcar 'car stair-data))))
(setq stair-data (vl-sort (cons '("comment" "") stair-data)
sort-data-by-key)))
;; rewrite XDATA
(foreach elt delta
(subst! elt (assoc (car elt) stair-data) 'stair-data))
;; recalculate derived keys
(remove! 'stair-data '(member (car x) stair-derived-keys))
((if (= app-id "3D_Stair") draw-3d_stair draw-stair)
(stair-add-derived-keys stair-data)
ins
) ;_ draw-stair -or- draw-3d_stair
) ;; update-stair
(if (setq level (assoc "level" delta))
(setq level (atoi (cadr level))
flights_level (cadr (assoc "flights_level" delta))
sequence 1
delta (vl-remove-if '(lambda(x) (= (car x) "level")) delta)
source (vl-sort source 'sort-stairland)))
(mapcar 'update-stair source))
(defun-r 'c:stair)

@ -1,10 +1,23 @@
;; Command to generate top views of stairs and landings
(psc-include
'("shapes/shape.lsp" "land/land_supp.lsp" "land/util.lsp")
) ;_ psc-include
(defun c:topview ( / enames ename ins tmp data break stairs db pdb stairp)
'(
"land/land_supp.lsp"
"land/topview.lsp"
"land/util.lsp"
"shapes/shape.lsp"
"stair/topview.lsp"
))
(defun-q c:topview ( / enames ename ins tmp data break stairs db pdb stairp)
"Draws plan views of stairs and landings
To draw a plan view, run this command, select up to 3 stairs and 2 landings, press ENTER,
and click to insert. You can have more than 2 landings in a plan view, but they probably
won't be laid out how you want.
Selecting a single stair will prompt to show it as full or broken, and if broken, which
end to show. By default, this command will prefer to show the lower or middle flight as
full. It will show the top flight as full if there are only two flights and the top one
has a zero distance between."
;; load linetypes, layers and textstyles
(setup-env nil)
@ -73,676 +86,4 @@
0)))
(setq pdb dist_btwn))))))))))
(princ))
;;;;;;;;;
;; Stairs
;;;;;;;;;
;; 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)
)
;;;;;;;;;;
;; Landing
;;;;;;;;;;
(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))
(defun-r 'c:topview)

@ -1,4 +1,11 @@
(defun c:topviewhandgrab (/ pline pts)
(defun-q c:topviewhandgrab (/ pline pts)
"Formats a polyline as a pipe handgrab in plan view
To use, draw a polyline, run TOPVIEWHANDGRAB, select the polyline you drew, and press
ENTER. It will be thickened to 1.66 inches, put on RAILS layer, set to color 140, and
given an outline on the NO PLOT layer. A 2.33 inch radius fillet will be applied to all
points, so this command will fail if the fillet cannot be applied because the points are
too close together."
(setq pline (ename>vlobj (car (entsel)))
pts (get-vlist pline))
(if (> (length pts) 1)
@ -13,3 +20,4 @@
(vla-put-Color pline 140)
(vla-put-ConstantWidth pline 0)
(princ))
(defun-r 'c:topviewhandgrab)

@ -1,17 +1,23 @@
;; command to draw rails in plan view
(psc-include '(
"common-data.lsp"
"rail/return.lsp"
"rail/topview.lsp"
"stair/util.lsp"
))
(defun c:topviewrails (/
enames
stairs
clean-ent
strings
)
(defun-q c:topviewrails (/
enames
stairs
clean-ent
strings
)
"Converts an E drawing plan view to R drawing style
To format a plan view for the rail layout, run TOPVIEWRAILS, select all the blocks in the
plan view that were created with TOPVIEW, and press ENTER. Material tags and hole
centerlines will be removed from the block. Landing channels will be put on the NO PLOT
layer. Stair rails, guard rails, wall rails, and handgrab returns will be drawn along with
their tags."
;; remove unnecessary lines from topview
(defun clean-ent (ename / blockdef ents origin bd)
(defun blockdef (name)
@ -60,372 +66,4 @@
(apply-by-twos 'draw-hg-rtrn stairs)
(set-active-layer clayer)
(princ))
;; 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))))
(defun-r 'c:topviewrails)

@ -1,18 +1,28 @@
;; remove trailing empty rows from a fab dwg table
(setq *trimrows-title* "Material"
*trimrows-where* "Before")
(defun c:trimrows ( /
table
title
where
tbls2move
row-ht
lastrow
mt
)
(defun-q c:trimrows ( /
table
title
where
tbls2move
row-ht
lastrow
mt
)
"Trims empty rows from a fab drawing table
A row is considered empty if its first column is blank.
This command works on the material, hardware, and assembly tables. The tables below the
one you choose will be shifted to accommodate the removed rows.
If trimming rows from the material list above an existing standard-prefix part (i.e. not
pans, STN, QT, or NRT), the mark numbers for parts below will be decreased by the number
of rows removed. This carries to the callouts in the drawing as well.
If trimming rows from the assembly table, the quantities in the material table will be
updated."
(setq title (getdkword '(0 "Material Hardware Assembly") '*trimrows-title* "Table?")
table (get-table-by-title (strcat title "*")))
(if (not table) (error "Table not found"))
@ -62,3 +72,4 @@
(vlax-3d-point 0 0 0)
(vlax-3d-point 0 (* row-ht nrows) 0))))
(princ))
(defun-r 'c:trimrows)

@ -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)

@ -1,6 +1,5 @@
;; update a single mark number
(defun c:updatemarkno (/ table row prefix string)
(defun-q c:updatemarkno (/ table row prefix string)
"Updates a single material list mark number in a fab drawing"
(setq table (get-table-by-title "Material"))
(if (not table)
(error "No material table found"))
@ -15,3 +14,4 @@
(vla-SetText table row 0 to))
(vla-replace-string modelspace from to)
(vla-Regen acadDoc acAllViewPorts))
(defun-r 'c:updatemarkno)

@ -1,16 +1,11 @@
;; Command to display xdata
(psc-include '("dialog/dialog.lsp"))
;; view the data list of an element
(defun c:xdatalist ( /
ename
)
(setq ename (car (entsel "Select: ")))
(xdatalist-init ename)
(princ))
(defun xdatalist-init (ename /
(defun-q c:xdatalist ( /
xdatalist-init
ename
)
"Displays the raw XDATA for an object in a list box"
(defun xdatalist-init (ename /
appids
datalsts
datalst
@ -71,6 +66,13 @@
(strsplit (nth (atoi (get_tile "data")) datalst) "\t")))
(done_dialog 0))
(dialog-init "commands/xdatalist.dcl" "xdatalist" source)
(dialog-init "xdatalist.dcl" "xdatalist" source)
ret)
(setq ename (car (entsel "Select: ")))
(xdatalist-init ename)
(princ))
(defun-r 'c:xdatalist)

@ -89,7 +89,7 @@ there. Assumes the file lives in psc-src-dir.</pre>
<h3 id="psc-load" class="funcsig">(<span class="funcname">psc-load</span> *file-name*)</h3>
<pre class="fulldoc">Alias for load so that *FILE-NAME* is set automatically for each file
Assumes the file lives in psc-src-dir.</pre>
Assumes the file lives in psc-src-dir. Returns the file name as a string.</pre>
</section>
<section>

File diff suppressed because one or more lines are too long

@ -5,7 +5,7 @@
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>List of Commands (39)</h1>
<h1>List of Commands (54)</h1>
<div id="content">
<p>Commands with more than one line of documentation have the
full version included below.</p>
@ -152,7 +152,7 @@
</tr>
<tr>
<td>LANDING</td>
<td><a href="#LANDING">LANDING</a></td>
<td>Creates or edits landing blocks</td>
</tr>
@ -186,6 +186,46 @@
<td>Creates and inserts a Quiet Tread takeoff table for stairs and landings</td>
</tr>
<tr>
<td>RAILCIRCLE</td>
<td>Draws a donut with an outline, formatted like a top view handgrab</td>
</tr>
<tr>
<td><a href="#RAILS">RAILS</a></td>
<td>Draws rail blocks at stair main sections</td>
</tr>
<tr>
<td>RELOADALL</td>
<td>Reloads all the files that have been loaded so far</td>
</tr>
<tr>
<td>RETURN</td>
<td>Draws a handgrab return between two stair flights</td>
</tr>
<tr>
<td>SAVEQUIT</td>
<td>Zooms to extents, purges blocks, and closes the drawing</td>
</tr>
<tr>
<td><a href="#SHAPE-LINE">SHAPE-LINE</a></td>
<td>Draws a line representing a beam in 'schematic' plan view</td>
</tr>
<tr>
<td><a href="#SHAPE-TEXT">SHAPE-TEXT</a></td>
<td>Draws a text label for a DRAWSHAPE section block</td>
</tr>
<tr>
<td><a href="#STAIR">STAIR</a></td>
<td>Creates or edits stair blocks</td>
</tr>
<tr>
<td>STAIR-ADD-DET</td>
<td>Adds detail numbers to a stair block</td>
@ -211,6 +251,41 @@
<td>Overwrites a vertical dimension with a rise tag</td>
</tr>
<tr>
<td><a href="#TOPVIEW">TOPVIEW</a></td>
<td>Draws plan views of stairs and landings</td>
</tr>
<tr>
<td><a href="#TOPVIEWHANDGRAB">TOPVIEWHANDGRAB</a></td>
<td>Formats a polyline as a pipe handgrab in plan view</td>
</tr>
<tr>
<td><a href="#TOPVIEWRAILS">TOPVIEWRAILS</a></td>
<td>Converts an E drawing plan view to R drawing style</td>
</tr>
<tr>
<td><a href="#TRIMROWS">TRIMROWS</a></td>
<td>Trims empty rows from a fab drawing table</td>
</tr>
<tr>
<td>UPDATE-CHK</td>
<td>Updates checker initials in fab drawings</td>
</tr>
<tr>
<td>UPDATEMARKNO</td>
<td>Updates a single material list mark number in a fab drawing</td>
</tr>
<tr>
<td>XDATALIST</td>
<td>Displays the raw XDATA for an object in a list box</td>
</tr>
</tbody>
</table>
@ -375,6 +450,20 @@ If inserting rows in the assembly table, the quantities in the material table wi
updated.</pre>
</section>
<section>
<h3 id="LANDING">LANDING</h3>
<pre class="fulldoc">Creates or edits landing blocks
To create a new landing from scratch, press ENTER at the selection prompt.
To create a new landing based on the properties of the two stairs that will connect to it,
select both stairs (and nothing else) at the prompt and pess ENTER.
To edit a single landing, select it at the prompt and press ENTER.
To edit multiple landings in bulk, select them all at the prompt and press ENTER.</pre>
</section>
<section>
<h3 id="LANDING-EMBEDS">LANDING-EMBEDS</h3>
<pre class="fulldoc">Draws EM-4s for landing ledgers in main section
@ -401,6 +490,96 @@ plan views. Usage:
5. Input angle and press ENTER</pre>
</section>
<section>
<h3 id="RAILS">RAILS</h3>
<pre class="fulldoc">Draws rail blocks at stair main sections
This command will draw stair rails, guard rails, wall rails, and handgrab returns at all
selected stairs. Returns are only drawn between two flights, so the last flight won't have
a return added, even if it should get one.
This command can be used to draw either the inside or outside rails for each flight.</pre>
</section>
<section>
<h3 id="SHAPE-LINE">SHAPE-LINE</h3>
<pre class="fulldoc">Draws a line representing a beam in 'schematic' plan view
This command draws a 3 inch thick polyline with a label, for use in RO plan views.</pre>
</section>
<section>
<h3 id="SHAPE-TEXT">SHAPE-TEXT</h3>
<pre class="fulldoc">Draws a text label for a DRAWSHAPE section block
Running this command and selecting a section block that was created using DRAWSHAPE will
put a text label on your cursor for inserting in an RO section view.</pre>
</section>
<section>
<h3 id="STAIR">STAIR</h3>
<pre class="fulldoc">Creates or edits stair blocks
To create a new stair, press ENTER at the selection prompt.
To edit a single star, select it at the prompt and press ENTER.
To edit multiple stairs in bulk, select them all at the prompt and press ENTER.</pre>
</section>
<section>
<h3 id="TOPVIEW">TOPVIEW</h3>
<pre class="fulldoc">Draws plan views of stairs and landings
To draw a plan view, run this command, select up to 3 stairs and 2 landings, press ENTER,
and click to insert. You can have more than 2 landings in a plan view, but they probably
won't be laid out how you want.
Selecting a single stair will prompt to show it as full or broken, and if broken, which
end to show. By default, this command will prefer to show the lower or middle flight as
full. It will show the top flight as full if there are only two flights and the top one
has a zero distance between.</pre>
</section>
<section>
<h3 id="TOPVIEWHANDGRAB">TOPVIEWHANDGRAB</h3>
<pre class="fulldoc">Formats a polyline as a pipe handgrab in plan view
To use, draw a polyline, run TOPVIEWHANDGRAB, select the polyline you drew, and press
ENTER. It will be thickened to 1.66 inches, put on RAILS layer, set to color 140, and
given an outline on the NO PLOT layer. A 2.33 inch radius fillet will be applied to all
points, so this command will fail if the fillet cannot be applied because the points are
too close together.</pre>
</section>
<section>
<h3 id="TOPVIEWRAILS">TOPVIEWRAILS</h3>
<pre class="fulldoc">Converts an E drawing plan view to R drawing style
To format a plan view for the rail layout, run TOPVIEWRAILS, select all the blocks in the
plan view that were created with TOPVIEW, and press ENTER. Material tags and hole
centerlines will be removed from the block. Landing channels will be put on the NO PLOT
layer. Stair rails, guard rails, wall rails, and handgrab returns will be drawn along with
their tags.</pre>
</section>
<section>
<h3 id="TRIMROWS">TRIMROWS</h3>
<pre class="fulldoc">Trims empty rows from a fab drawing table
A row is considered empty if its first column is blank.
This command works on the material, hardware, and assembly tables. The tables below the
one you choose will be shifted to accommodate the removed rows.
If trimming rows from the material list above an existing standard-prefix part (i.e. not
pans, STN, QT, or NRT), the mark numbers for parts below will be decreased by the number
of rows removed. This carries to the callouts in the drawing as well.
If trimming rows from the assembly table, the quantities in the material table will be
updated.</pre>
</section>
</div>
</body>
</html>

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))))

@ -401,3 +401,115 @@
)
)
)
(defun stair-multi-edit (source
delta
/
switch-z-pos
process-sd-key
process-rail-opts
update-stair
flights
level
sequence
flights_level
)
(defun switch-z-pos ( / elt val)
(if (= (cadr (assoc "switch_z_pos" delta)) "1")
(progn
(setq elt (assoc "z_pos" stair-data)
val (cadr elt))
(subst! (list "z_pos"
(if (= val "Near") "Far" "Near"))
elt
'stair-data))))
;; substitute sub-dialog options
;; for tread_opts and conn_opts
(defun process-sd-key (key)
(remove! 'stair-data '(= (car x) key))
(if (setq tmp (assoc key delta))
(progn
(remove! 'delta (= x tmp))
(add-to-list 'stair-data tmp))))
;; ensure correct keys for multi-edit rail_opts
(defun process-rail_opts (delta / rtype def sds all)
(foreach side '("i" "o")
(if (setq rtype (assoc (strcat side "-rail_type") delta))
(progn
(setq rtype (cadr rtype)
sds (mapcar 'car stair-data)
all (uniquify (map-append 'cdr rail-types))
all (mapcar '(lambda(x) (strcat side "-rail_" x)) all)
def (cdr (assoc rtype rail-types)))
;; remove all non-members from stair-data
(foreach key sds
(if (and (member key all)
(not (member (substr key 8) def)))
(remove! 'stair-data '(= (car x) key))))
;; add ones that are not present (for subst to work)
;; set them to default values (in case they are not present in delta)
(foreach key def
(setq key (strcat side "-rail_" key))
(if (not (member key sds))
(add-to-list
'stair-data
(list key (if (member key rail_opts-dist-keys) 0.0 "0")))))))))
;; update the data for and redraw one stair block
(defun update-stair (ename
/
app-id
stair-data
ins
tmp
tb
rot
)
(setq app-id (cadr (assoc "app_id" (read-xdata ename "")))
stair-data (vl-sort (draw-xdata-migrate 'ename app-id) sort-data-by-key)
rot (vla-get-rotation (ename>vlobj ename))
ins (get-ins-and-delete ename))
(switch-z-pos)
;; renumber flights
(if level
(progn
(subst-key! "level" (to-string level) 'stair-data)
(subst-key! "sequence" (substr "ABCDEFGH" sequence 1) 'stair-data)
(inc! 'sequence)
(if (> sequence flights_level)
(setq sequence 1
level (1+ level)))))
;; handle sub-dialog keys
(if (vl-some '(lambda(x) (= (car x) "tread_style")) delta)
(mapcar 'process-sd-key tread_opts-keys))
(if (vl-some '(lambda(x) (= (car x) "top_conn")) delta)
(mapcar 'process-sd-key (remove conn_opts-keys '(not (begins-with x "t")))))
(if (vl-some '(lambda(x) (= (car x) "bot_conn")) delta)
(mapcar 'process-sd-key (remove conn_opts-keys '(not (begins-with x "b")))))
(if (vl-some '(lambda(x) (= (car x) "rail_style")) delta)
(process-rail_opts delta))
;; add comment key if not present
(if (and (member "comment" (mapcar 'car delta))
(not (member "comment" (mapcar 'car stair-data))))
(setq stair-data (vl-sort (cons '("comment" "") stair-data)
sort-data-by-key)))
;; rewrite XDATA
(foreach elt delta
(subst! elt (assoc (car elt) stair-data) 'stair-data))
;; recalculate derived keys
(remove! 'stair-data '(member (car x) stair-derived-keys))
((if (= app-id "3D_Stair") draw-3d_stair draw-stair)
(stair-add-derived-keys stair-data)
ins
) ;_ draw-stair -or- draw-3d_stair
) ;; update-stair
(if (setq level (assoc "level" delta))
(setq level (atoi (cadr level))
flights_level (cadr (assoc "flights_level" delta))
sequence 1
delta (vl-remove-if '(lambda(x) (= (car x) "level")) delta)
source (vl-sort source 'sort-stairland)))
(mapcar 'update-stair source))

@ -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…
Cancel
Save