Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing to Attributes

Status
Not open for further replies.

Adrian2

Mechanical
Mar 13, 2002
303
Dear Folks;

Is it possible to write text fields to exiting attributes in a bill of material line item block ?

I have old bills of material which I would like to write into new bills of material which use blocks with attributes for each line item.

Best Regards

Adrian Dunevein
 
Replies continue below

Recommended for you

It is possible but not inherently in AutoCAD. You can write LISP or VB routines to do it.

"Everybody is ignorant, only on different subjects." — Will Rogers
 
Here'e a quick and dirty way to do what you want. Works on a single text entry and attribute.

(defun C:XferTextToAtt (/ ATT SS1 SS2 TXT)
(princ "Select Text:")
(setq SS1 (ssget ":S" '((0 . "TEXT")))) ;Get text entity
(setq TXT (cdr (assoc 1 (entget (ssname SS1 0)))));Return text field of text
;(princ "Select Block Att To Transfer To:")
(setq ATT (entget
(car (nentsel "\nSelect Attribute To Transfer To: "))
)
)
(setq ATT (subst (cons 1 TXT) (assoc 1 ATT) ATT))
(entmod ATT)
(command "_REGEN")
)

"Everybody is ignorant, only on different subjects." — Will Rogers
 
Thanks Borgunit;

That code does exactly what I wanted !

Best Regards

Adrian Dunevein

 
Made a little change to include MTEXT...

(defun C:XferTextToAtt (/ ATT SS1 SS2 TXT)
(princ "Select Text:")
(setq SS1 (ssget ":S" '((-4 . "<OR")(0 . "TEXT")(0 . "MTEXT")(-4 . "OR>")))) ;Get text entity
(setq TXT (cdr (assoc 1 (entget (ssname SS1 0)))));Return text field of text
(setq ATT (entget(car(nentsel "\nSelect Attribute To Transfer To: "))))
(setq ATT (subst (cons 1 TXT) (assoc 1 ATT) ATT))
(entmod ATT)
(command "_REGEN")
)

"Everybody is ignorant, only on different subjects." — Will Rogers
 
Borgunit

Smokin !

You read my mind

Adrian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor