LISP to change constant attributes to normal

LISP to change constant attributes to normal

ThomasRambach
Advisor Advisor
374 Views
1 Reply
Message 1 of 2

LISP to change constant attributes to normal

ThomasRambach
Advisor
Advisor

I have this LISP which works well at converting all constant attributes to normal:

(defun c:attsnotconstant (/ b n)
  (vl-load-com)
  (while (setq b (tblnext "block" (not b)))
    (setq n (cdr (assoc 2 b)))
    (vlax-for o	(vla-item (vla-get-blocks
			    (vla-get-activedocument
			      (vlax-get-acad-object)
			    )
			  )
			  n
		)
      (if (= (vla-get-objectname o) "AcDbAttributeDefinition")
	(vla-put-constant o :vlax-false)
      )
    )
    (command "attsync" "name" n)
  )
)
(c:attsnotconstant)

 

I want to edit this so that it only changes the attribute to normal if the attribute tag is a specific value. Any ideas on how to do this? I'm definitely not an expert in LISP so any help would be appreciated.

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

Shneuph
Collaborator
Collaborator
Accepted solution

I think this would do it:

 

(defun c:attsnotconstant (/ b n)
(vl-load-com)
(while (setq b (tblnext "block" (not b)))
(setq n (cdr (assoc 2 b)))
(vlax-for o (vla-item (vla-get-blocks
(vla-get-activedocument
(vlax-get-acad-object)
)
)
n
)
(if (= (vla-get-objectname o) "AcDbAttributeDefinition")
(if (= (vla-get-tagstring o) "Detail_Number");<- put tag name of attribute
(vla-put-constant o :vlax-false)
);if
)
)
(command "attsync" "name" n)
)
)

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
0 Likes