- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear All,
Please advise i have .lisp program for export the block name and qty to export new excel .
but i want automatic to write my BOQ Excel sheet based on VLOOKUP condition .
)block name = Reference ID) so i want to fill the QTY value to excel
i want to block data inside of below excel sheet
please help me.
(defun c:blk (/ _doc nm ds b ly f lst fl op)
(vlax-for l (vla-get-layouts
(setq _doc
(vla-get-ActiveDocument (vlax-get-acad-object))))
(vlax-for o (vla-get-block l)
(if (and (eq (vla-get-objectname o) "AcDbBlockReference")
(setq nm (vla-get-effectivename o))
(setq ds
(if (vlax-property-available-p
(setq b (vla-item (vla-get-blocks _doc) nm))
'comments)
(vla-get-comments b)
"")
)
(setq ly (vla-get-layer o))
)
(if (vl-some '(lambda (x)
(and (eq ly (car x))
(eq nm (cadr x))
(setq f x)
)
)
lst)
(setq lst (subst (list ly nm (1+ (caddr f)) ds) f lst))
(setq lst (cons (list ly nm 1 ds) lst))
)
)
)
)
(setq lst (vl-sort lst '(lambda (j k) (< (car j) (car k)))))
(cond ((not lst)
(alert "Couldn't find any block in this drawing !!"))
((and (setq fl (getfiled "Specify new Excel file name" "NewExcel.csv" "csv" 1))
(setq op (open fl "w"))
)
(write-line "Layer Name,Block Name,QTY,Description" op)
(mapcar '(lambda (x)
(write-line
(strcat (car x) ","
(cadr x) ","
(itoa (caddr x)) ","
(nth 3 x))
op))
lst)
(close op)
)
)
(princ)
)(vl-load-com)
Solved! Go to Solution.