Insert a block that was created with attributes in LISP

Insert a block that was created with attributes in LISP

Anonymous
Not applicable
1,760 Views
1 Reply
Message 1 of 2

Insert a block that was created with attributes in LISP

Anonymous
Not applicable

Hi,
; I need to create a block with attributes and insert it, in addition to creating a function to read the value of these attributes to display on the screen. I created the block and would like to know how to insert it to read the values. I've seen some examples of how to insert blocks with attributes, but in the case I would have to create with attributes and insert to then read.

 

(defun makeblock()
(entmake '((0 . "BLOCK")     
       (2 . "block_name") 
       (8 . "0")             
       (10 0.0 0.0 0.0)      
       (70 . 2)            
      ))

(entmake '((0 . "LINE")
       (8 . "0")
       (10 0.0 0.0 0.0)
       (11 10.0 0.0 0.0)
      )
)

(entmake '((0 . "ATTDEF") 
       (8 . "0")                  
       (10 1.0 1.0 0.0)           
       (40 . 2)                   
       (1 . "defval")             
       (50 . 0)                   
       (7 . "standard")           
       (72 . 1)                   
       (11 1.0 1.0 0.0)
       (3 . "Enter the value")  
       (2 . "tag_name")        
       (70 . 0)                   
       (74 . 0)                   
      )
)

(entmake '((0 . "ENDBLK")))
)    
0 Likes
1,761 Views
1 Reply
Reply (1)
Message 2 of 2

john.uhden
Mentor
Mentor

Adding an attribute value to a block insertion (that contains an ATTDEF) is just another response to the -INSERT command.

 

Run the -INSERT command yourself (notice the hyphen prefix which invokes the command line version), and you will see the required responses...

BName, Point, Xscale, Yscale, rotation, attribute1, attribute2, etc.

 

That knowledge enables you to programmaticaly supply all the responses using.

 

(command "_.-insert" "BlockName" pt 1.0 1.0 (/ pi 2) "Att1_Value") in the correct order, of course.

John F. Uhden

0 Likes