Update Fields once

Update Fields once

Anonymous
Not applicable
611 Views
7 Replies
Message 1 of 8

Update Fields once

Anonymous
Not applicable

I am currently using fields within a block to get the date and revision number from the computer and file name. I only need the fields to pull this info once when the block is inserted, I dont need it to constantly update. At the moment when the attribute editor is open we just select the field and convert it to text but is there a way to automate this process?

0 Likes
612 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable

I have a similar request.  I have a block that I want to convert one attribute to a text.  Block name is Format and attribute is DWGNO.

 

Any help is appreciated.  I could not get other lisp routines that were posted to work on my application.

0 Likes
Message 3 of 8

hmsilva
Mentor
Mentor

@Anonymous wrote:

I have a similar request.  I have a block that I want to convert one attribute to a text.  Block name is Format and attribute is DWGNO.

 

Any help is appreciated.  I could not get other lisp routines that were posted to work on my application.


Hi ckauffman,

did you try to do a search in 'Search this Board'...

>>> one from pbejse <<<

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 4 of 8

Anonymous
Not applicable

I have tried that one and had no success.  I changed "Mode_A3" to "Format" and I changed "Tag1" to "DWGNO" and deleted "Tag2" and "Tag3"

0 Likes
Message 5 of 8

hmsilva
Mentor
Mentor

@Anonymous wrote:

I have tried that one and had no success.  I changed "Mode_A3" to "Format" and I changed "Tag1" to "DWGNO" and deleted "Tag2" and "Tag3"


Can you please attach a dwg with the INSERT in it?

 

EDIT:Have you made a 'regen' after run the pBe's code?

 

Henrique

EESignature

0 Likes
Message 6 of 8

Anonymous
Not applicable

I have attached my test file

0 Likes
Message 7 of 8

Anonymous
Not applicable

regen was the fix

 

 

thanks!

0 Likes
Message 8 of 8

hmsilva
Mentor
Mentor

The regen....

 

;; original from pBe
;; http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/convert-fields-into-text-only-in-specific-attribute-tags/m-p/4732427#M318288
(defun c:f2t (/ ss cnt e ent dicti)
    (if (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1) (2 . "FORMAT")))
        )
        (repeat (setq i (sslength ss))
            (setq cnt 0
                  e   (ssname ss (setq i (1- i)))
            )
            (while (and (< cnt 4)
                        (= (cdr (assoc 0 (setq ent (entget (setq e (entnext e)))))) "ATTRIB")
                   )
                (if (and (member (strcase (cdr (assoc 2 (entget e)))) '("DWGNO"))
                         (setq dicti (cdr (assoc 360 ent)))
                         (dictsearch dicti "ACAD_FIELD")
                    )
                    (progn
                        (dictremove dicti "ACAD_FIELD")
                        (setq cnt (1+ cnt))
                    )
                )
            )
        )
    )
    (command "_.regen")
    (princ)
)

 

Hope this helps,
Henrique

EESignature

0 Likes