Croftyno1 Posted June 15, 2011 Posted June 15, 2011 Afternoon Cadders, I would like to ignore the letters when filtering the layers and only filter layers containing certain numbers ie, layer name : grid510, to be filtered by number 510 only, not by the whole layer name. Any suggestions welcome!! This is the code what I currently use to filter my layers, courtesy of Lee Mack from a previous posted question. (defun test ( / ss ) (vl-load-com) (if (setq ss (ssget (setq l '((8 . "ti grid re510,ti grid re520,ti grid re540,ti grid re560,ti grid re570,ti grid re580,ti grid tx150,ti grid type 1,ti grid type 2,ti grid type 3,ti grid type 4"))))) ( (lambda ( l / i e sym ) (repeat (setq i (sslength ss)) (ssadd (setq e (ssname ss (setq i (1- i)))) (cond ( (eval (setq sym (read (strcat "ss" ( (lambda ( j ) (vl-some (function (lambda ( x ) (setq j (1+ j)) (if (wcmatch (strcase (cdr (assoc 8 (entget e)))) (strcase x)) (itoa j) ) ) ) l ) ) 0 ) ) ) ) ) ) ( (set sym (ssadd)) ) ) ) ) ) (LM:str->lst (cdar l) ",") ) ) ) Quote
BlackBox Posted June 15, 2011 Posted June 15, 2011 ??? ... (if (setq ss (ssget '((8 . "[color=red]*[/color]510[color=red]*[color=black],[/color]*[color=black]520[/color]*[/color]")))) ... Quote
alanjt Posted June 15, 2011 Posted June 15, 2011 You should do some reading on the wcmatch function. It will give you the information you need for ssget selection filtering. Quote
Croftyno1 Posted June 15, 2011 Author Posted June 15, 2011 feel like a rite plonker now, *510* works! cant belive thats all i needed to do for gods sake. thanks guys Quote
irneb Posted June 16, 2011 Posted June 16, 2011 feel like a rite plonker now, *510* works! cant belive thats all i needed to do for gods sake. thanks guys The wonders of wild-cards8)! Only once you start using them you start noticing the shortcomings of ACad's wcmatch function:o. Then you start looking at using regular expressions - but that's a whole different ball-game! Quote
Recommended Posts
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.