TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Biscuits on October 22, 2020, 09:05:12 AM

Title: Edit nested Text
Post by: Biscuits 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.
Title: Re: Edit nested Text
Post by: ronjonp 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. )
Title: Re: Edit nested Text
Post by: jtoverka 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 (http://www.lee-mac.com/bfind.html)
Title: Re: Edit nested Text
Post by: Biscuits on October 22, 2020, 02:28:33 PM
Thanks guys. Both methods will be a great help.
Stay safe!