mi1delebecq Posted November 8, 2010 Posted November 8, 2010 Good evening, I started in Autolisp, I try to tailor a program jefferyp Sanders (http://www.jefferypsanders.com/autolispexp_enti.html). The goal is to use AutoLISP to change the attributes of a block. This block contains various attributes (including "COMMUNE"). But it always return nil. I fit into the loop "(If (= (cdr (assoc 2 enlist2)) "COMMON") " but the attribute is not changed .. It must be simple but I have no idea ... Thank you for your help I leave my code: (defun c:ModifAtt () (if (setq ent(entsel "\n Select a Block: ")) ;- Let the user select a block (progn (setq en(car ent)) ;- Get the entity name of the block (setq enlist(entget en)) ;- Get the DXF group codes (setq blkType(cdr(assoc 0 enlist))) ;- Save the type of entity (if (= blkType "INSERT") ;- If the entity type is an Insert entity (progn (if(= (cdr(assoc 66 enlist)) 1) ;- See if the attribute flag equals one (if so, attributes follow) (progn (setq en2(entnext en)) ;- Get the next sub-entity (setq enlist2(entget en2)) ;- Get the DXF group codes (while (/= (cdr(assoc 0 enlist2)) "SEQEND") ;- Start the while loop and keep ;- looping until SEQEND is found. (if(= (cdr(assoc 2 enlist2)) "COMMUNE") (setq newVal (getstring "\n New Attribute value: ")) (setq enlist2 (subst (cons 1 newVal) (assoc 1 enlist2) enlist2)) (entmod enlist2) ) (setq en2(entnext en2)) ;- Get the next sub-entity (setq enlist2(entget en2)) ;- Get the DXF group codes ) ) ) ;- Close the if group code 66 = 1 statement ) ) ;- Close the if block type = "ATTRIB" statement ) ) ;- Close the if an Entity is selected statement ) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.