I tried to insert the "<-- fill out table here" code (see code below) and it gives me an error ** Error: bad argument type: consp 4 **
Code:
(if l
(progn
(setq hgt (if (zerop (cdr (assoc 40 (setq e (entget (tblobjname "STYLE" "UNIT_COUNT"))))))
(* (getvar 'textsize) 2.0)
(* (cdr (assoc 40 e)) 2.0)))
(setq columns 2)
(setq r 2)
(if (setq ins (list 25.5405 4.12052 0.0))
(progn
(setq tbl (vla-addtable
(vlax-get
(vla-get-activelayout
(vla-get-activedocument (vlax-get-acad-object))) 'BLOCK)
(vlax-3d-point ins)
(+ (length l) 2)
columns
0.05 ;(* hgt 1.5)
0.05 ;(* hgt 1.5)
)
)
(setq inc -1)
(repeat 2
(vla-setcolumnwidth tbl (setq inc (1+ inc)) (* hgt 4.0)))
(vla-setrowheight tbl 0 0.05)
(vla-setrowheight tbl 1 0.05)
(vla-settext tbl 0 0 (strcat "Unit Total"))
(vla-setcolumnwidth tbl 0 (* hgt 5.0))
(vla-setcolumnwidth tbl 1 (* hgt 5.0))
(vla-settext tbl 1 0 "Unit")
(vla-settext tbl 1 1 "QTY")))
(defun WriteAndSet (col row string)
(vla-settext tbl row col string)
(vla-setcellalignment tbl row col acMiddleCenter))
(foreach x l
(WriteAndSet 0 r (car x))
(WriteAndSet 1 r (cadr x))
(setq r (1+ r)))
)
)
I have attached the drawing which you could use as testing environment, that has the "unit" blocks and the table. If you think it would be relevant for me to include the code I have to create units please let me know.