Author Topic: Field to Attrib with lisp?  (Read 3059 times)

0 Members and 1 Guest are viewing this topic.

Amsterdammed

  • Guest
Field to Attrib with lisp?
« on: September 19, 2012, 10:04:39 AM »
Hello everybody,

I never did anything with fields, so this is new to me.

I have a drawing with several layouts. in all layouts there are title blocks. i managed to link the name and date  contained in a xref block to an attribute in the title. works great, but can do this with lisp for all the title blocks in existing dwgs, so i can't just copy the title block trough all the layouts, i would loose the other attribs information.

Question is, can i set the attrib's value with a field (containing a the info of a lisp variable)  by lisp?

Thanks,

Bernd

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Field to Attrib with lisp?
« Reply #1 on: September 19, 2012, 10:09:31 AM »
Question is, can i set the attrib's value with a field (containing a the info of a lisp variable)  by lisp?

Yes.  :-)

Amsterdammed

  • Guest
Re: Field to Attrib with lisp?
« Reply #2 on: September 19, 2012, 10:38:54 AM »
Lee

well, that is good news  :-D

leads me to the next question, how???

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Field to Attrib with lisp?
« Reply #3 on: September 20, 2012, 05:14:53 AM »
  • Create a field manually through the normal Field dialog box.
  • Then copy the text displayed in the bottom "Field expression" to clipboard (Select by draaging the mouse & Ctrl+C).
  • Exit the field dialog & exit editing the text/attribute.
  • Type (getstring t) at the command-line.
  • Paste the expression (Ctrl+V) and press Enter.
  • Select the result (notice all double-quotes & back-slashes are escaped, so it can now be used directly as a lisp string) & copy to clipboard again (Ctrl+C).
  • Go to your lisp editor and paste the escaped expression in there - in a position where you assign it to the Text/Attribute's contents (e.g. entmod / vla-put-TextString).
  • You might have to run the UpdateField or Regen command to have the field display properly.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Field to Attrib with lisp?
« Reply #4 on: September 20, 2012, 05:29:51 AM »
If you want to calculate a field-expression which points to some property of another object, you'll need to find the other object's ObjectID number and then replace into the new expression. E.g. see this thread: http://www.theswamp.org/index.php?topic=38092.15
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Amsterdammed

  • Guest
Re: Field to Attrib with lisp?
« Reply #5 on: September 20, 2012, 06:07:44 AM »
Perfect!!! :lol:

Thanks!