Jump to content

Make a ssget list selection with exeptions


pttr

Recommended Posts

Hi

I have this code, that checks every layer that starts with the name A-

(if (setq ssL (ssget "_X" (list (cons 8 "A-*") '(410 . "Model"))))
	;do something
)

This works fine, but I want to make some exceptions in the selection of layers.

 

EX:

Select  ( A-*)  except (A-4) except (A-5)

 

There are a lot of layers starting with A- (as you can imagine) and i only want to skip a few.

 

Looked att Lee Macs code here:

http://www.lee-mac.com/ssget.html#:~:text=Logical Not,256 (ByLayer).

 

And it's something like this I´m looking for, but I can't make it work for the list selection.

 

 

Link to comment
Share on other sites

Don't know what your where trying but this should work.

(if (setq ssL (ssget "_X" '((8 . "A-*")(-4 . "<NOT")(8 . "A-4,A-5")(-4 . "NOT>")(410 . "Model"))))
   ;Do stuff
)

 

-Edit

for each layer you want to ignore just add it into the middle (8 . "layer1,layer2,layer3,layer4,layer5")

Also worth a look.

 

(if (setq ssL (ssget "_X" '((8 . "A-*")(-4 . "<NOT")(8 . "A-#")(-4 . "NOT>")(410 . "Model"))))
This would ignore layers A-0, A-1, A-2, A-3, A-4, A-5, A-6, A-7, A-8, & A-9

 



 

Edited by mhupp
  • Like 1
Link to comment
Share on other sites

4 hours ago, mhupp said:

Don't know what your where trying but this should work.

(if (setq ssL (ssget "_X" '((8 . "A-*")(-4 . "<NOT")(8 . "A-4,A-5")(-4 . "NOT>")(410 . "Model"))))
   ;Do stuff
)

 

-Edit

for each layer you want to ignore just add it into the middle (8 . "layer1,layer2,layer3,layer4,layer5")

Also worth a look.

 

(if (setq ssL (ssget "_X" '((8 . "A-*")(-4 . "<NOT")(8 . "A-#")(-4 . "NOT>")(410 . "Model"))))
This would ignore layers A-0, A-1, A-2, A-3, A-4, A-5, A-6, A-7, A-8, & A-9

 



 

 

I forgot to say that i need ssL to be a list,  else I need to change a lot of stuff 🙄

Link to comment
Share on other sites

3 hours ago, pttr said:

 

I forgot to say that i need ssL to be a list,  else I need to change a lot of stuff 🙄

(setq l '("A-4" "A-5"))
(setq ssl (ssget "_X"
		 (list '(8 . "A-*")
		       '(-4 . "<NOT")
		       (cons 8 (apply 'strcat (mapcar '(lambda (x) (strcat x ",")) l)))
		       '(-4 . "NOT>")
		       '(410 . "Model")
		 )
	  )
)

 

  • Like 3
Link to comment
Share on other sites

14 hours ago, ronjonp said:
(setq l '("A-4" "A-5"))
(setq ssl (ssget "_X"
		 (list '(8 . "A-*")
		       '(-4 . "<NOT")
		       (cons 8 (apply 'strcat (mapcar '(lambda (x) (strcat x ",")) l)))
		       '(-4 . "NOT>")
		       '(410 . "Model")
		 )
	  )
)

 

Woaw that is just great, thanks alot! 👌

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