×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Writing to Attributes

Writing to Attributes

Writing to Attributes

(OP)
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
www.aaadrafting.com




RE: Writing to Attributes

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

RE: Writing to Attributes

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

RE: Writing to Attributes

(OP)
Thanks Borgunit;

That code does exactly what I wanted !

Best Regards

Adrian Dunevein

RE: Writing to Attributes

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

RE: Writing to Attributes

(OP)
Borgunit

Smokin !

You read my mind

Adrian

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources