Author Topic: Filter out layers in SSGET "WP"  (Read 849 times)

0 Members and 1 Guest are viewing this topic.

hmspe

  • Bull Frog
  • Posts: 362
Filter out layers in SSGET "WP"
« on: June 19, 2023, 03:37:04 PM »
Is this possible?  I want to get all entities except entities on layers starting with "VSL-".  All of the tricks I normally use with SSGET are not working for _WP in Bricscad V23.

This routine is for cleaning up a photometric study that has thousands of values.  Easy enough to run (setq selset2 (ssget "_WP" points2)) and filter after, but I think filtering within SSGET would be faster.

Thanks.

"Science is the belief in the ignorance of experts." - Richard Feynman

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: Filter out layers in SSGET "WP"
« Reply #1 on: June 19, 2023, 04:34:34 PM »
Hi,
Have you tried it this way?
Code - Auto/Visual Lisp: [Select]
  1. (ssget "_WP" points '((-4 . "<NOT") (8 . "VSL-*") (-4 . "NOT>")))
Also as you may know is that the entire boundary of your list of coordinates 'points' must be visible in screen to allow ssget to work.
Hope this helps.

Lee Mac

  • Seagull
  • Posts: 12922
  • London, England
Re: Filter out layers in SSGET "WP"
« Reply #2 on: June 19, 2023, 05:19:51 PM »
Alternatively, the following should work -
Code - Auto/Visual Lisp: [Select]
  1. (ssget "_WP" points2 '((8 . "~VSL-*")))

hmspe

  • Bull Frog
  • Posts: 362
Re: Filter out layers in SSGET "WP"
« Reply #3 on: June 19, 2023, 06:32:42 PM »
Thanks to you both. 

I had run exactly the lines of code you both posted and they did not work on my production computer running Bricscad V23.2.06(x64).  I was getting error messages that had the quotation marks removed from the VSL- or ~VSL- string.  I tried the same code on my laptop [first on V23.2.03(x64) then upgraded to V23.2.06(x64)] and the code worked as expected.  Looks like something's amiss with my main computer.   
"Science is the belief in the ignorance of experts." - Richard Feynman

danAllen

  • Newt
  • Posts: 134
Re: Filter out layers in SSGET "WP"
« Reply #4 on: June 19, 2023, 07:27:42 PM »
FYI - if the layer string filter you are providing is a variable, then CONS instead of quote is required
Code - Auto/Visual Lisp: [Select]
  1. (setq t1 "z*")
  2. "z*"
  3. : (ssget "X" '((8 . t1)))
  4. ; ----- Error around expression -----
  5. '((8 . T1))
  6. : (ssget "X" (list (cons 8 t1)))
  7. <Selection set: 00000000544ABBF0>

mhupp

  • Bull Frog
  • Posts: 250
Re: Filter out layers in SSGET "WP"
« Reply #5 on: June 19, 2023, 10:51:33 PM »
hmspe sometimes things get stuck. Closing the program or even rebooting the machine is needed.

hmspe

  • Bull Frog
  • Posts: 362
Re: Filter out layers in SSGET "WP"
« Reply #6 on: June 20, 2023, 10:43:01 AM »
@mhupp --  Thanks.  I had tried closing the program, rebooting, and complete shut down and restart before I posted.

The problem may have been related to the .arg profile I was using.  When I compared the V23 default.arg profile to the custom profile I use there were many entries new to V23 that had not migrated.  After a bit of cut and paste to update the custom profile the lisp code is running as expected. 

... or maybe my computer was just having a bad day yesterday. 
"Science is the belief in the ignorance of experts." - Richard Feynman