Message 1 of 3

Not applicable
10-09-2018
10:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I have following code which updates the attribute value to what I want but, apart from updating the value, I want to change the attribute from being 'static text' to 'field'. Plus I want the code to update the value automatically (i.e. does not ask for user intervention)
I would appreciate if someone could help me:
(defun c:TXT2FLD ( / s ) (princ "\nSelect Attribute") (if (setq s (ssget "_+.:E:S:L" '((0 . "INSERT") (66 . 1)))) (LM:setattributevalue (ssname s 0) "drawingno." (strcase (menucmd "M=$(substr, $(getvar, dwgname), 1, $(-, $(strlen, $(getvar, dwgname)), 4))"))) (princ "\nInvalid selection or no selection made!") ) (princ) ) (defun LM:setattributevalue ( blk tag val / end enx ) (while (and (null end) (= "ATTRIB" (cdr (assoc 0 (setq enx (entget (setq blk (entnext blk))))))) ) (if (= (strcase tag) (strcase (cdr (assoc 2 enx)))) (if (entmod (subst (cons 1 val) (assoc 1 enx) enx)) (progn (entupd blk) (setq end val) ) ) ) ) )
Solved! Go to Solution.