Jump to content

FIND command rotating entire dwg


TheZman

Recommended Posts

Hello,

I have a dwg that I use to find roads on in our jurisdiction area when ever people in the field need to find a road, and cant read a map. I use find to find the road text on the dwg. however the annoying thing is the rotates the entire dwg so the text is horizontal. Most of the time the text is not at rotation 0 its rotated so it will fit on the road.

 

When the entire dwg gets rotated it makes it very difficult to give directions. Is there some setting somewhere that I can uncheck to make it not do that.

 

Thanks for your help.

 

EDIT: Oh yes, I am using AutoCAD 2009.

Edited by TheZman
Link to comment
Share on other sites

Oh! That does suck!

 

I've only used find, for replacing text strings in the past.

 

Try this:

 

(defun c:FIND2 (/ s ss)
 (if (and (setq s (getstring "\n  >>  Enter Text to Find: "))
          (setq ss (ssget "_x" (list '(0 . "TEXT,MTEXT") (cons 1 (strcat "*" s "*"))))))
   (command "._zoom" "_object" (ssname ss 0) ""))
   (prompt "\n  <!>  Matching Text Not Found  <!> "))

 

 

Edit:

Added the failure prompt.

 

Hope this helps!

Edited by BlackBox
Removed (vl-load-com)... first time that was necessary! lol
Link to comment
Share on other sites

Oh! That does suck!

 

I've only used find, for replacing text strings in the past.

 

Try this:

 

(defun c:FIND2 (/ s ss)
 (if (and (setq s (getstring "\n  >>  Enter Text to Find: "))
          (setq ss (ssget "_x" (list '(0 . "TEXT,MTEXT") (cons 1 (strcat "*" s "*"))))))
   (command "._zoom" "_object" (ssname ss 0) "")))

 

 

Hope this helps!

DXF 1 is case sensitive and check your and statement (hint: getstring return).

Link to comment
Share on other sites

Oh programming, is there anything you cannot do?

 

This helps a lot. The only problem I see is that it can only find one whole word. So like "1st" it will find only one of them but there are others such as "NW 1st Ave" "NW 1st Ct." "SE 1st Ave" and so on. However this gives me something to fiddle with the rest of the day. Thank you.

Link to comment
Share on other sites

DXF 1 is case sensitive and check your and statement (hint: getstring return).

 

Oh programming, is there anything you cannot do?

 

This helps a lot. The only problem I see is that it can only find one whole word. So like "1st" it will find only one of them but there are others such as "NW 1st Ave" "NW 1st Ct." "SE 1st Ave" and so on. However this gives me something to fiddle with the rest of the day. Thank you.

 

 

Disaster averted:

 

(defun c:FIND2 (/ s ss l)
 (if (and (/= nil (setq s (getstring "\n  >>  Enter Text to Find: ")))
          (setq
            ss (ssget "_x"
                      (list '(0 . "TEXT,MTEXT")
                            '(-4 . "<OR")
                            (cons 1 (strcase (strcat "*" s "*")))
                            (cons 1 (strcase (strcat "*" s "*") T))
                            '(-4 . "OR>")))))
   (if (< 1 (setq l (sslength ss)))
     ((lambda (i / ok e)
        (prompt (strcat "\n  >>  There were " (rtos l 2 0) " Matches Found... "))
        (setq ok "NO")
        (while (and (/= "YES" ok)
                    (setq e (ssname ss (setq i (1+ i)))))
          (command "._zoom" "_object" e "")
          (initget 7 "YES NO")
          (setq ok (getkword "\n  >>  Is this the right one? [Yes/No]: "))))
       -1)
     (command "._zoom" "_object" (ssname ss 0) ""))
   (prompt "\n  <!>  Matching Text Not Found  <!> "))
 (princ))

 

 

This revision will also handle multiple matches.

 

Edit:

 

Fiddle away, Zman...

 

fiddle.jpg

Link to comment
Share on other sites

What about "PiZzA"?

 

Found it without a problem:

 

PiZzA.jpg

 

 

Command: find2

 >>  Enter Text to Find: z

 >>  There were 8 Matches Found... ._zoom
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>: _object
Select objects:   1 found

Select objects:
Command:
 >>  Is this the right one? [Yes/No]: n
._zoom
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>: _object
Select objects:   1 found

Select objects:
Command:
 >>  Is this the right one? [Yes/No]: n
._zoom
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>: _object
Select objects:   1 found

Select objects:
Command:
 >>  Is this the right one? [Yes/No]: y

Command:

 

 

D@mnit Alan, now I'm hungry for pizza! :(

Link to comment
Share on other sites

Found it without a problem:

 

Command: find2
 >>  Enter Text to Find: z
 >>  There were 8 Matches Found... ._zoom
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>: _object
Select objects:   1 found
Select objects:
Command:
 >>  Is this the right one? [Yes/No]: n
._zoom
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>: _object
Select objects:   1 found
Select objects:
Command:
 >>  Is this the right one? [Yes/No]: n
._zoom
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>: _object
Select objects:   1 found
Select objects:
Command:
 >>  Is this the right one? [Yes/No]: y
Command:

 

[ATTACH]24539[/ATTACH]

 

 

D@mnit Alan, now I'm hungry for pizza! :(

Hmph. I could have sworn you couldn't pull that off with SSGET filtering. I stand corrected. Out of curiosity, try

(cons 1 (strcat "*" (strcase s) "*,*" (strcase s T) "*"))

Link to comment
Share on other sites

Hmph. I could have sworn you couldn't pull that off with SSGET filtering. I stand corrected. Out of curiosity, try

(cons 1 (strcat "*" (strcase s) "*,*" (strcase s T) "*"))

 

Yep, that works too. :beer:

Link to comment
Share on other sites

Hmph. I could have sworn you couldn't pull that off with SSGET filtering. I stand corrected.

 

... And might I just add that today is being marked down in my calendar :P, and I kind of think you should be proud of that. :thumbsup:

 

Edit:

You wouldn't be 'proud of that' enough to buy me a pizza, would you...? I mean it's your fault, I'm hungry for pizza. :(

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...