Results 1 to 2 of 2

Thread: Block Generation (CSV/TXT Input)

  1. #1
    Member
    Join Date
    2013-04
    Location
    Northern, IL
    Posts
    10
    Login to Give a bone
    0

    Default Block Generation (CSV/TXT Input)

    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

    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
    Any ideas?

    :grumble: this forum is confusing to find sub-forums, can a mod move this to http://forums.augi.com/forumdisplay.php?91-AutoLISP ?
    Last edited by ccarlson376355; 2013-07-01 at 02:42 PM.

  2. #2
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Block Generation (CSV/TXT Input)

    At first glance and without testing, change:

    Code:
    	(if (eq (type partnumber) 'STR)
    	((entmake
    To:
    Code:
      (if (eq (type partnumber) 'STR)
        (progn (entmake

Similar Threads

  1. 2014: Unable to input angles in lookup table - Dynamic Block
    By sandeep_koodal in forum Dynamic Blocks - Technical
    Replies: 0
    Last Post: 2014-12-31, 11:30 AM
  2. Relation between value input in screen and dimensions of dynamic block
    By borgimongi in forum Dynamic Blocks - Technical
    Replies: 4
    Last Post: 2010-03-06, 11:10 AM
  3. Filling in a title block from dialog box input?
    By aaron.bentley in forum AutoLISP
    Replies: 9
    Last Post: 2008-12-02, 01:00 PM
  4. Replies: 5
    Last Post: 2007-05-08, 09:59 PM
  5. Replies: 8
    Last Post: 2004-11-10, 10:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •