Taken from
http://www.theswamp.org/index.php?topic=48753.0 , I am trying to put a little spin on this. We use wide flange beams for columns and they are nothing more than a closed lwpolyline (not a block). This routine does work and reports on each column the size of the column in the "X" and "Y" direction. Having the dimensions for the wide flange columns is great but it would be more powerful if it also reported the actual name of the column. For instance, W6x12 or w10x12 etc...
So basically for a W6x12 the dims are (X)4.0 and (Y)6.0
and a W10x12 the dims would be (X)4.0 and (Y)9.875
The routine already reports the (X) and (Y) dimensions of all columns in the drawing, I just want it to also add the name of the column based on the size. I do have the sizes of all of the wide flanged beams that we use. I am just having loads of issues trying to modify this to do what I want.
(defun c:CCS ( / mn mx peditaccept plinecnt pntnX pntxX ss)
(vl-load-com)
(command "-layer" "on" "Defpoints" "thaw" "Defpoints" "")
(if
(setq ss (ssget "_X" '((0 . "Arc,Line,lwpolyline")
(8 . "S-COLS,A-WALL-SHEL-EXST"))))
(progn
(setq peditaccept (getvar 'peditaccept))
(setvar 'peditaccept 1)
(setvar 'peditaccept peditaccept)
)
)
(setq plinecnt 0)
(if (setq ss (ssget "_X" '((0 . "LWPOLYLINE")(8 . "S-COLS,A-WALL-SHEL-EXST"))))
(repeat (sslength ss)
(vla-getboundingbox (vlax-ename->vla-object (ssname ss plinecnt)) 'mn 'mx)
(setq mn (vlax-safearray->list mn))
(setq mx (vlax-safearray->list mx))
(setq pntnX (nth 0 mn)) (setq pntnY (nth 1 mn))
(setq pntxX (nth 0 mx)) (setq pntxY (nth 1 mx))
(setq dvx (- pntxX pntnX));added
(setq dvy (- pntxY pntnY));added
(scheck);added
; (InsText (strcat "Size" " = "(rtos (- pntxX pntnX) 4 16) " x " (rtos (- pntxY pntnY) 4 16)) (list pntxX pntnY 0.0));original code
(InsText (strcat "Size" " = "(rtos (- pntxX pntnX) 4 16) " x " (rtos (- pntxY pntnY) 4 16) " - " dvSize) (list pntxX pntnY 0.0));modified
(setq plinecnt (1+ plinecnt))
)
)
);end defun
(defun InsText ( BlkName pt / )
(entmakex
(list
(cons 0 "TEXT")
(cons 8 "Defpoints")
(cons 1 BlkName)
(cons 10 Pt)
(cons 40 5)
(cons 41 0.8)
)
)
);end defun
The output currently for each column is as follows:
Size = 4" x 6"
Size = 4" x 9 7/8"
I would like it to be...
Size = 4" x 6" - W6x12
Size = 4" x 9 7/8" - W10x12
etc..
Here is a snippet of my column sizes..
(defun scheck ()
(if
(and (= dvx 4.0) (= dvy 4.125)
)
(setq dvSize "W4x13")
(setq dvSize "nil")
)
(if
(and (= dvx 5.0) (= dvy 5.0)
)
(setq dvSize "W5x16")
(setq dvSize "nil")
)
(if
(and (= dvx 5.0) (= dvy 5.125)
)
(setq dvSize "W5x18.5")
(setq dvSize "nil")
)
(if
(and (= dvx 5.0) (= dvy 5.125)
)
(setq dvSize "W5x19")
(setq dvSize "nil")
)
(if
(and (= dvx 4.0) (= dvy 5.875)
)
(setq dvSize "W6x9")
(setq dvSize "nil")
)
)
I hope that I am not asking too much. I am just stuck. Any guidance or help would be great.
Thanks,