Jump to content

Recommended Posts

Posted

Can anyone help me?

 

using acad2000i

 

I'm using qselect to count certain "textstrings" "piece names" in my drawings ie: pc1, pc2,etc

after starting qselect i have to apply al these filters

clicking all the following applyto,(entire drawing) objecttype,(text) properties,(contents) operator, (=equals) value, (here manual input by user)

 

I would like to shorten this sequence to save time

 

thanks nick

Posted

Try this, (case-sensitive):

 

(defun c:tcnt (/ ss tStr)
 (if (and (setq ss (ssget "X" (list (cons 0 "*TEXT"))))
      (setq tStr (getstring t "\nText to Search For: ")))
   (progn
     (setq ss (vl-remove-if-not '(lambda (x) (eq tStr (cdr (assoc 1 (entget x)))))
        (mapcar 'cadr (ssnamex ss))))
     (if (not (zerop (length ss)))
   (princ (strcat (rtos (length ss) 2 0) " Item(s) Found."))
   (princ "\nNo Matching Text Strings. ")))
   (princ "\n<!> No Text Found in Drawing <!>"))
 (princ))

Posted

To:Lee Mac

 

Tried your lisp it works great thanks a lot!!!!

Posted
To:Lee Mac

 

Tried your lisp it works great thanks a lot!!!!

 

 

No Probs mate - happy to have helped :)

Posted

You can use a simple ( ssget ) filter as well.

[b][color=BLACK]([/color][/b]defun c:stext [b][color=FUCHSIA]([/color][/b]/ ts ss[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]setq ts [b][color=NAVY]([/color][/b]getstring t [color=#2f4f4f]"\nText To Search For [b][color=MAROON]([/color][/b] Case Sensitive [b][color=MAROON])[/color][/b]:   "[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]if [b][color=NAVY]([/color][/b]setq ss [b][color=MAROON]([/color][/b]ssget [color=#2f4f4f]"X"[/color] [b][color=GREEN]([/color][/b]list [b][color=BLUE]([/color][/b]cons 0 [color=#2f4f4f]"*TEXT"[/color][b][color=BLUE])[/color][/b]
                               [b][color=BLUE]([/color][/b]cons 1 ts[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
     [b][color=NAVY]([/color][/b]princ [b][color=MAROON]([/color][/b]strcat [color=#2f4f4f]"\n"[/color] [b][color=GREEN]([/color][/b]rtos [b][color=BLUE]([/color][/b]sslength ss[b][color=BLUE])[/color][/b] 2 0[b][color=GREEN])[/color][/b] [color=#2f4f4f]" - Entities Found"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

-David

Posted

Haha - why do I always go for the harder way around things... :unsure:

 

 

Nice code David :thumbsup:

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