entmod fails to update attrib

entmod fails to update attrib

mmitchellH6TRW
Enthusiast Enthusiast
215 Views
1 Reply
Message 1 of 2

entmod fails to update attrib

mmitchellH6TRW
Enthusiast
Enthusiast

From my debug console:

 

 

 

(setq elist (subst (cons 1 newvalue) (assoc 1 elist) elist))
((-1 . <Entity name: 1cb26a6d640>) (0 . "ATTRIB") (330 . <Entity name: 1cb26a6d560>) (5 . "32BBDDC") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (62 . 0) (100 . "AcDbText") (10 1.52114e+06 1.68236e+07 0.0) (40 . 9.99616) (1 . "MP 26.44") (50 . 0.606835) (41 . 1.0) (51 . 0.0) (7 . "Standard") (71 . 0) (72 . 0) (11 1.52114e+06 1.68236e+07 0.0) (210 0.0 0.0 1.0) (100 . "AcDbAttribute") (280 . 0) (2 . "SRMP") (70 . 0) (73 . 0) (74 . 2) (280 . 1))
(entmod elist)
nil

Why?
From a different debug:

 

(assoc 1 elist)
(1 . "26.909999847412109")
(cons 1 newvalue)
(1 . "MP 26.91")
(subst (cons 1 newvalue) (assoc 1 elist) elist)
((-1 . <Entity name: 1cb26a7e8c0>) (0 . "ATTRIB") (330 . <Entity name: 1cb26a6d760>) (5 . "32BBDFC") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (62 . 0) (100 . "AcDbText") (10 1.52234e+06 1.68215e+07 0.0) (40 . 9.99616) (1 . "MP 26.91") (50 . 0.358863) (41 . 1.0) (51 . 0.0) (7 . "Standard") (71 . 0) (72 . 0) (11 1.52233e+06 1.68215e+07 0.0) (210 0.0 0.0 1.0) (100 . "AcDbAttribute") (280 . 0) (2 . "SRMP") (70 . 0) (73 . 0) (74 . 2) (280 . 1))
(entmod  (subst (cons 1 newvalue) (assoc 1 elist) elist))
nil

Full code:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;  (replacetagvalue tag newvalue ent)		
;; tag - the attibute name
;; newvalue - the new value for that attribute
;; ent - the ent name of the entity
;; returns T if change is made 
;; else returns nil
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun replacetagvalue (tag newvalue ent / elist) 
  (if (and (assoc 66 (setq elist (entget ent)))) 
    (progn 
      (setq ent   (entnext ent)
            elist (entget ent)
      )
      (while 
        (not 
          (or 
            (= (cdr (assoc 0 elist)) "SEQEND")
            (= (cdr (assoc 2 elist)) tag)
          )
        )
        (setq ent   (entnext ent)
              elist (entget ent)
        )
      )
    )
  )
  (if (= (cdr (assoc 0 elist)) "SEQEND") 
    nil
    (entmod (subst (cons 1 newvalue) (assoc 1 elist) elist))
  )
)

 

 

0 Likes
Accepted solutions (1)
216 Views
1 Reply
Reply (1)
Message 2 of 2

mmitchellH6TRW
Enthusiast
Enthusiast
Accepted solution

Unlock the layer that the attribute is on.
Solved it.

0 Likes