Jump to content

Find for text and display it in the center of the window


teknomatika

Recommended Posts

Hi,

I ask for your help for the following. I need to find a particular text string among thousands. Once found, it should be centrally visible in the window.
I can't do that in the tool "Find and replace" because when I leave it, the location is lost.
Another alternative would be to draw a circle around the string text with a diameter to be specified.

 

Thanks!

Link to comment
Share on other sites

Depending on your LISP ability and how you want to search for the text:

 

This link and offering from RonJon will find your text string (https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-text-lsp/td-p/9272343😞

 

(setq ss (ssget "X" (list '(0 . "*TEXT")(cons 1 str)(cons 410 (getvar "ctab")))))

 

str being the string to search for, This can have a wildcard * character in it something like

 

(setq str "*my string*")

 

Then you can use "Zoom" "Object" something like

 

(command "ZOOM" "OB" (ssname ss 0) "")

 

to zoom to it (this will zoom to the first instance of the text string that it finds if there are more than 1 in the drawing).

You might want to do an additional zoom to zoom into the text depending how close you want to be to it

 

 

Should be able to put that together?

Edited by Steven P
  • Like 2
Link to comment
Share on other sites

if their are going to be multiple results use the following.
 

(while (< (sslength SS) 0)
  (command "ZOOM" "OB" (ssname ss 0)) ;BricsCAD use OB for object O for out
  (command pause) ;allows user to see what was zoom to enter/right click to continue to next text
  (ssdel (ssname ss 0) ss)
)

 

  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...