Author Topic: Edit nested Text  (Read 1544 times)

0 Members and 1 Guest are viewing this topic.

Biscuits

  • Swamp Rat
  • Posts: 502
Edit nested Text
« on: October 22, 2020, 09:05:12 AM »
Hello everyone. Was wondering if anyone has any lisp ideas to edit text buried in a block without using bedit or refedit.
This is not an attribute but should have been. Been searching the internet but not getting anywhere. Would like something like a command line version of find/replace. Any help would be appreciated. Using Autocad Map3D 2017.

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Edit nested Text
« Reply #1 on: October 22, 2020, 11:36:50 AM »
You can do it like this but it will change all references in the drawing ( may need to regen to see changes ).
Code - Auto/Visual Lisp: [Select]
  1. (defun c:foo (/ e)
  2.   (if (and (setq e (car (nentsel "\nPick text: ")))
  3.            (setq e (vlax-ename->vla-object e))
  4.            (vlax-write-enabled-p e)
  5.            (vlax-property-available-p e 'textstring)
  6.       )
  7.     (vla-put-textstring e "Your string")
  8.   )
  9.   (princ)
  10. )

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

jtoverka

  • Newt
  • Posts: 127
Re: Edit nested Text
« Reply #2 on: October 22, 2020, 01:09:29 PM »
Would like something like a command line version of find/replace.

I use this regularly. It has the option to find and replace block text. It is very robust. Although it is not command line, it can do multiple drawings in the background, and save a batch of find and replace options for the next time you run AutoCAD.

http://www.lee-mac.com/bfind.html

Biscuits

  • Swamp Rat
  • Posts: 502
Re: Edit nested Text
« Reply #3 on: October 22, 2020, 02:28:33 PM »
Thanks guys. Both methods will be a great help.
Stay safe!