Author Topic: Replace text to filename of drawing problem... (need a fresh look)  (Read 955 times)

0 Members and 1 Guest are viewing this topic.

danglar

  • Newt
  • Posts: 161
  • Read My Li(s)(p)
This Aleksandr Smirnov (ASMI) program can copy the filename of drawing to Text, MText, Tables, Dimensions and Attributes in Multiple modes with option to insert file name of drawing as regular text (added by me).
Program working properly but a little “dirty”. I mean we have here at least 2 unnecessary steps. First – insert filename as text into the drawing as regular text entity.. After what we can copy this text and paste it in multiple mode (replace Text, MText, Tables, Dimensions and Attributes to filename of drawing)
and Second unnecessary step – delete inserted text with filename (see attached lisp)
Is it possible to eliminate these two unnecessary steps in order to select Text, MText, Tables, Dimensions and Attributes and replace it immediately to file name?
Any help will be very appreciated
« Last Edit: August 21, 2016, 02:22:45 AM by danglar »

ChrisCarlson

  • Guest
Re: Replace text to filename of drawing problem... (need a fresh look)
« Reply #1 on: August 22, 2016, 10:01:01 AM »
Well...

It all starts with loading visual lisp and some background functions

Code - Auto/Visual Lisp: [Select]

Next gather the file name and set it to a variable

Code - Auto/Visual Lisp: [Select]
  1. (setq dwg (vl-filename-base (getvar "dwgname")))

You then need to select the entity you want to copy the name into. MTEXT, DTEXT, RTEXT, TEXT, TABLE, ATTRIB, etc. all have different methods required for inserting text.

Lastly you need to check the destination and potentially prompt the user to replace or append the new information in an existing filled out field.



danglar

  • Newt
  • Posts: 161
  • Read My Li(s)(p)
Re: Replace text to filename of drawing problem... (need a fresh look)
« Reply #2 on: August 22, 2016, 10:25:23 AM »
Thanks Master!