Jump to content

Recommended Posts

Posted
I notice that wildcart search is not always the ultimate way to go since it call unrelevant layers. I need a toggle to be able to search the whole word or wildcard. How can it be done?

 

 

guess whole word search can have 2 situations , word is the first word so it would end with a space , or it is the last word , so it would begin with a space.

e.g. "walls and windows" (or "walls_and_windows") or "windows_and_walls". Your filter would be *walls* for any match , "walls *" for any line beginning with walls or "* walls" for strings ending with walls.

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • samifox

    13

  • rlx

    9

  • Lee Mac

    2

  • Tharwat

    2

Top Posters In This Topic

Posted
guess whole word search can have 2 situations , word is the first word so it would end with a space , or it is the last word , so it would begin with a space.

e.g. "walls and windows" (or "walls_and_windows") or "windows_and_walls". Your filter would be *walls* for any match , "walls *" for any line beginning with walls or "* walls" for strings ending with walls.

 

from my tests this search crateria is not always welcome,

im not looking for general layers names but specific names i know my client always use.

 

so "parking roof" is not relevant but "roof" is

 

the wildcard is needed when the xref has been bind, in this situation it layer name will include the prefix of the file

Posted
(defun c:samifox ( / doc fn fp s p l o n c wc)
 (vl-load-com)
 (setq doc (vla-get-activedocument (vlax-get-acad-object)) fn (findfile "map.txt"))
 (princ "\nPress space bar to include wildcard or any other key or button for none")
 (if (equal (grread) '(2 32)) (setq wc "*")(setq wc ""))
 (cond
   ((null fn)(princ "\nData file map.txt not found"))
   ((not (setq fp (open fn "r")))(princ "\nUnable to read from map.txt"))
   (t
    (while (setq s (read-line fp))
      (if (setq p (vl-string-position (ascii ",") s))
        (setq l (cons (cons (substr s 1 p) (substr s (+ 2 p))) l))))
    (if (vl-consp l)
      (vlax-for o (vla-get-layers doc)
 (setq n (strcase (vla-get-name o)))
 (if (vl-some '(lambda (x) (if (wcmatch n (strcase (strcat wc (car x) wc))) (setq c (cdr x)))) l)
   (vl-catch-all-apply 'vla-put-color (list o c))))))
 )
 (princ)
)

Posted
(defun c:samifox ( / doc fn fp s p l o n c wc)
 (vl-load-com)
 (setq doc (vla-get-activedocument (vlax-get-acad-object)) fn (findfile "map.txt"))
 (princ "\nPress space bar to include wildcard or any other key or button for none")
 (if (equal (grread) '(2 32)) (setq wc "*")(setq wc ""))
 (cond
   ((null fn)(princ "\nData file map.txt not found"))
   ((not (setq fp (open fn "r")))(princ "\nUnable to read from map.txt"))
   (t
    (while (setq s (read-line fp))
      (if (setq p (vl-string-position (ascii ",") s))
        (setq l (cons (cons (substr s 1 p) (substr s (+ 2 p))) l))))
    (if (vl-consp l)
      (vlax-for o (vla-get-layers doc)
 (setq n (strcase (vla-get-name o)))
 (if (vl-some '(lambda (x) (if (wcmatch n (strcase (strcat wc (car x) wc))) (setq c (cdr x)))) l)
   (vl-catch-all-apply 'vla-put-color (list o c))))))
 )
 (princ)
)

 

thanks

 

ive used space bar but it doesnt work

Posted
(defun c:samifox ( / doc fn fp s p l o n c wc)
 (vl-load-com)
 (setq doc (vla-get-activedocument (vlax-get-acad-object)) fn (findfile "map.txt"))
 (princ "\nPress space bar to include wildcard or any other key or button for none")
 (if (equal (grread) '(2 32)) (setq wc "*")(setq wc ""))
 (cond
   ((null fn)(princ "\nData file map.txt not found"))
   ((not (setq fp (open fn "r")))(princ "\nUnable to read from map.txt"))
   (t
    (while (setq s (read-line fp))
      (if (setq p (vl-string-position (ascii ",") s))
        (setq l (cons (cons (substr s 1 p) (substr s (+ 2 p))) l))))
    (if (vl-consp l)
      (vlax-for o (vla-get-layers doc)
 (setq n (strcase (vla-get-name o)))
 (if (vl-some '(lambda (x) (if (wcmatch n (strcase (strcat wc (car x) wc))) (setq c (cdr x)))) l)
   (vl-catch-all-apply 'vla-put-color (list o c))))))
 )
 (princ)
)

 

sorry ive read the wrong file

its working perfect

 

thanks you!!!

Posted
sorry ive read the wrong file

its working perfect

 

thanks you!!!

 

 

one appie for you and one air mile for me :D

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