Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Changing attribute from unfixed to fixed

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
gcsjlewis
664 Views, 6 Replies

Changing attribute from unfixed to fixed

I am looking for a simple way to make sure my TAG1 attribute is "FIXED".  I am looking at the properties & methods of the attribute, but i do not know what to change and what to change it to, to force it to "fixed"

6 REPLIES 6
Message 2 of 7
hmsilva
in reply to: gcsjlewis


@gcsjlewis wrote:

I am looking for a simple way to make sure my TAG1 attribute is "FIXED".  I am looking at the properties & methods of the attribute, but i do not know what to change and what to change it to, to force it to "fixed"


As a "demo"

(if (setq ss (ssget "_+.:E:S:L" '((0 . "INSERT") (66 . 1))))
  (progn
    (setq ent (ssname ss 0))
    (while
      (and
	(setq ent (entnext ent))
	(setq entdata (entget ent))
	(= (cdr (assoc 0 entdata)) "ATTRIB")
      )
       (if (= (cdr (assoc 2 entdata)) "TAG1")
	 (entmod (subst (cons 70 2) (assoc 70 entdata) entdata))
       )
    )
  )
)

 

HTH
Henrique

EESignature

Message 3 of 7
gcsjlewis
in reply to: hmsilva

Sorry that's not working. It changes the dxf code but not marking the attribute as fixed.
I see that changing dxf code 70 to 2 sets the attribute flag to constant.
I may have not specified enough, I am working with Autocad Electrical 2011. And what fixing this attribute does, is it prevents a "retag" of the TAG1 attribute.

I do not know if that's what constant is supposed to do.

________________________________
The information contained in this message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately, and delete the original message.
Message 4 of 7
hmsilva
in reply to: gcsjlewis


@gcsjlewis wrote:
Sorry that's not working. It changes the dxf code but not marking the attribute as fixed.
...
I do not know if that's what constant is supposed to do.

When we change the attribute to constant, the ability to enter a new tag value, will be disabled and the attribute existing value becomes fixed...

 

Henrique

EESignature

Message 5 of 7
gcsjlewis
in reply to: hmsilva

Looking some info up I changed your code a little and it works

(defun c:fix_tag ()
(if (setq ss (ssget "_+.:E:S:L" '((0 . "INSERT") (66 . 1))))
(progn
(setq ent (ssname ss 0))
(while (and (setq ent (entnext ent)) (setq entdata (entget ent)) (= (cdr (assoc 0 entdata)) "ATTRIB") )
(if (= (cdr (assoc 2 entdata)) "TAG1")
(progn
(entmod (subst (cons 8 "WIREFIXED") (assoc 8 entdata) entdata))
(entmod (subst (cons 2 "TAG1F") (assoc 2 entdata) entdata))
); end progn
); end if
); end while
);end progn
);end if
); end defun

For future reference, All I needed to do was change "TAG1"to "TAG1F". . . Must be something internal that it looks for when I run the retag command.

I also changed the layer per our company standards.

But thanks for your help.

________________________________
The information contained in this message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately, and delete the original message.
Message 6 of 7
gcsjlewis
in reply to: hmsilva

Looking some info up I changed your code a little and it works

(defun c:fix_tag ()
(if (setq ss (ssget "_+.:E:S:L" '((0 . "INSERT") (66 . 1))))
(progn
(setq ent (ssname ss 0))
(while (and (setq ent (entnext ent)) (setq entdata (entget ent)) (= (cdr (assoc 0 entdata)) "ATTRIB") )
(if (= (cdr (assoc 2 entdata)) "TAG1")
(progn
(entmod (subst (cons 8 "WIREFIXED") (assoc 8 entdata) entdata))
(entmod (subst (cons 2 "TAG1F") (assoc 2 entdata) entdata))
); end progn
); end if
); end while
);end progn
);end if
); end defun

For future reference, All I needed to do was change "TAG1"to "TAG1F". . . Must be something internal that it looks for when I run the retag command.

I also changed the layer per our company standards.

But thanks for your help.

________________________________
The information contained in this message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately, and delete the original message.
Message 7 of 7
hmsilva
in reply to: gcsjlewis

You're welcome, manamalewis
Glad you got a solution.

Henrique

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

”Boost