I have a pretty simple lisp which prompted for a part number and creates a block with that name. I need to do this for approximately 1500~ part numbers, the easiest thing I could think of is using a txt file or csv file.
I threw this code together however I have a few issues I can't sort out.
1) reading all 1500~ lines
2) Command: CSVBLOCK ; error: bad argument type: lentityp nil
Any ideas?Code:;************************************** ;CREATE PART NUMBER BLOCK ;************************************** (defun C:csvblock (/ pt01) (if (findfile "x:/lisps/csvblock.txt") (progn (setq btable (open "x:/lisps/csvblock.txt" "r")) (setq partnumber (read-line btable)) (close btable) ) ; end progn (alert "FILE NOT FOUND!") ) ; end if (if (eq (type partnumber) 'STR) ((entmake (list (cons 0 "BLOCK") ; entity (cons 2 partnumber) ; block name (cons 70 2) ; block type (list 10 0.0 0.0 0.0) ; base point ) ; end list ) ; end entmake (entmake (list (cons 0 "TEXT") ; entity (cons 8 "SYS-Bom_Part_Numbers") ; layer (list 10 0.0 0.0 0.0) ; base point (cons 40 0.035) ; text height (cons 1 partnumber) ; text string (cons 50 0) ; text rotation ; (cons 7 "STANDARD") ; text style (cons 72 10) ; text justification ) ; end list ) ; end entmake text ;************************************** ;START ANNOTATIVE / NO EXPLODE SEQUENCE ;************************************** (entmake (list (cons 0 "ENDBLK") (cons 8 "0") ) ) (entget (cdr (assoc 330 (entget (tblobjname "BLOCK" partnumber))))) (vl-load-com) (setq BLOCKS (vla-get-Blocks (vla-get-activedocument (vlax-get-acad-object) ) ) BLK (vla-Item BLOCKS partnumber) ) (vla-put-explodable (vla-Item BLOCKS partnumber) :vlax-false) (princ) ) ; end entmake (alert "NO TEXT FOUND") ) ; end if ) ; end function
:grumble: this forum is confusing to find sub-forums, can a mod move this to http://forums.augi.com/forumdisplay.php?91-AutoLISP ?