C. Roberts Posted September 16 Posted September 16 I am trying to modify a text object of a block to say Wind Pressure Diagram instead of Panel Zone: Wind 1 without exploding the block first. I get the entity definition data stored in ttl_txt then try to use the entmod function on it to change the text. ;; --- Modify "Panel Zone: Wind 1" to say "Wind Pressure Diagram" --- ;; (cond ((setq ss5 (tblobjname "BLOCK" "DesCalc")) (setq ent5 (entget ss5)) (while (setq ent5 (entnext (cdar ent5))) (setq ent5 (entget ent5)) (if (eq (cdr (assoc 1 ent5)) "Panel Zone: Wind 1") (setq ttl_txt (cons ent5 ttl_txt)) ) ) ) ) (if ttl_txt (entmod (subst (cons 1 "Wind Pressure Diagram") (assoc 1 ttl_txt) ttl_txt)) ) It returns: ; error: bad DXF group: ((-1 . <Entity name: 2cbc81939e0>) (0 . "TEXT") (330 . <Entity name: 2cc0d83f4b0>) (5 . "100E") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbText") (10 40.363 -45.805 0.0) (40 . 3.346) (1 . "Panel Zone: Wind 1") (50 . 0.0) (41 . 1.0) (51 . 0.0) (7 . "Standard") (71 . 0) (72 . 0) (11 0.0 0.0 0.0) (210 0.0 0.0 1.0) (100 . "AcDbText") (73 . 0)) What am I doing wrong? Quote
Steven P Posted September 16 Posted September 16 Typo: (while (setq ent5 (entnext (cdar ent5))) should be? (while (setq ent5 (entnext (CADR ent5))) Quote
C. Roberts Posted September 16 Author Posted September 16 @Steven P If I change cdar to CADR it gives me a "bad arguement type: lentityp" error. That portion of my code stores this in ttl_tx: Command: !ttl_txt (((-1 . <Entity name: 2cc0d90a9e0>) (0 . "TEXT") (330 . <Entity name: 2cc0d901cb0>) (5 . "100E") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbText") (10 40.363 -45.805 0.0) (40 . 3.346) (1 . "Panel Zone: Wind 1") (50 . 0.0) (41 . 1.0) (51 . 0.0) (7 . "Standard") (71 . 0) (72 . 0) (11 0.0 0.0 0.0) (210 0.0 0.0 1.0) (100 . "AcDbText") (73 . 0))) Which I believe is what I want in that symbol to be able to use entmod to change group 1 from "Panel Zone: Wind 1" to "Wind Pressure Diagram". Quote
Steven P Posted September 16 Posted September 16 How are you wanting to run your LISP by the way? You could do something like: (setq Myent (car (nentsel))) to get the entity name and then your entmod should work - but the user would need to click on the specifc text to change rather than let the LISP find the block etc.. but the code is a bit simpler. For the list you posted above, you might need to use 'car' to go in one item in the list - to get the entity description Quote
Lee Mac Posted September 16 Posted September 16 The issue is because you are collecting each DXF data list into a parent list (ttl_txt), but then performing the substitution on the parent list rather than each of the DXF lists it contains. However, I see no reason to construct the separate list in the first place, simply perform the update on each item as you encounter it: ;; --- Modify "Panel Zone: Wind 1" to say "Wind Pressure Diagram" --- ;; (cond ( (setq ss5 (tblobjname "BLOCK" "DesCalc")) (while (setq ss5 (entnext ss5)) (setq ent5 (entget ss5)) (if (= (cdr (assoc 1 ent5)) "Panel Zone: Wind 1") (entmod (subst '(1 . "Wind Pressure Diagram") (assoc 1 ent5) ent5)) ) ) ) ) 2 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.