Author Topic: Combining SSGet Mode Strings?  (Read 3821 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12929
  • London, England
Combining SSGet Mode Strings?
« on: November 29, 2009, 09:54:29 AM »
OK, I'm completely drawing a blank on this one -

How do you combine multiple ssget mode strings?

For example, select all Lines not on locked layers:

Code: [Select]
(ssget "[color=red]_X:L[/color]" '((0 . "LINE")))

But whatever combination of "X" and ":L" I try, I get the usual "bad ssget mode string error".

Any help is appeciated of course,

Cheers,

Lee


hmspe

  • Bull Frog
  • Posts: 367
Re: Combining SSGet Mode Strings?
« Reply #1 on: November 29, 2009, 10:26:20 AM »
Pulled from a post by Princess Jamie in the autodesk customization forum:

    the "X" will search the database. notice that even if the layer is off it will grab the entities.

I suspect you'll need to filter similar to what Jeff Mishler did here:

    (setq ss (ssget "x" '((0 . "*POLYLINE")(-4 . "< NOT")(-4 . "/=")(42 . 0.0)(-4 . "NOT >"))))
"Science is the belief in the ignorance of experts." - Richard Feynman

Lee Mac

  • Seagull
  • Posts: 12929
  • London, England
Re: Combining SSGet Mode Strings?
« Reply #2 on: November 29, 2009, 10:35:09 AM »
Thanks for your reply,

I realise that I could create a list of locked layers and add that filter to the ssget filter list, but I wondered if it was possible to combine the already available "avoid locked layer" mode (:L).  :|

Thanks,

Lee

Jeff_M

  • King Gator
  • Posts: 4100
  • C3D user & customizer
Re: Combining SSGet Mode Strings?
« Reply #3 on: November 29, 2009, 11:13:06 AM »
Hi Lee,
I'm pretty sure that you cannot combine "X" with anything. You will need to build a filter to omit the layers which are locked.

wizman

  • Bull Frog
  • Posts: 290
Re: Combining SSGet Mode Strings?
« Reply #4 on: November 29, 2009, 12:47:58 PM »
i thought (ssget "_all") honors locked layers but trying here is not, maybe it's only on lower version?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Combining SSGet Mode Strings?
« Reply #5 on: November 29, 2009, 01:09:47 PM »
ALL filters FROZEN layers.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Combining SSGet Mode Strings?
« Reply #6 on: November 29, 2009, 01:10:51 PM »
Try these:

Code: [Select]
  ;; filter locked layers
  (setq filter "")
   (vlax-for layobj (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
     (if (= (vla-get-lock layobj) ':vlax-true)
       (setq filter (strcat filter (vla-get-name layobj) ","))
     )
   )
   (and (= filter "")(setq filter "*"))
   (setq SS (ssget "_X" (list (cons 0 "INSERT") (cons 8 filter))))
   
   
Code: [Select]
  ;; filter locked layers
  (setq filter "")
  ;;  get a list of layer name in the drawing
  (while (setq elst (tblnext "layer" (null elst)))
    (if (= 4 (logand 4 (cdr (assoc 70 elst))))
      (setq filter (strcat filter (cdr (assoc 2 elst)) ","))
    )
  )
  (and (= filter "")(setq filter "*"))
  (setq SS (ssget "_X" (list (cons 0 "INSERT") (cons 8 filter))))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

wizman

  • Bull Frog
  • Posts: 290
Re: Combining SSGet Mode Strings?
« Reply #7 on: November 29, 2009, 01:17:51 PM »
ALL filters FROZEN layers.


Thank you Cab, as always, got to correct that in my notes... :-)

Lee Mac

  • Seagull
  • Posts: 12929
  • London, England
Re: Combining SSGet Mode Strings?
« Reply #8 on: November 29, 2009, 02:21:01 PM »
Thanks Guys,

Thanks for the code Alan, I had wondered if I had to make a filter list manually - but its a shame they haven't made it possible to combine :L and X....

Thanks for all the replies guys, appreciated.

Lee  :-)

ribarm

  • Gator
  • Posts: 3313
  • Marko Ribar, architect
Re: Combining SSGet Mode Strings?
« Reply #9 on: September 22, 2013, 06:28:39 AM »
Try these:

Code: [Select]
  ;; filter locked layers
  (setq filter "")
   (vlax-for layobj (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
     (if (= (vla-get-lock layobj) ':vlax-true)
       (setq filter (strcat filter (vla-get-name layobj) ","))
     )
   )
   (and (= filter "")(setq filter "*"))
   (setq SS (ssget "_X" (list (cons 0 "INSERT") (cons 8 filter))))
   
   
Code: [Select]
  ;; filter locked layers
  (setq filter "")
  ;;  get a list of layer name in the drawing
  (while (setq elst (tblnext "layer" (null elst)))
    (if (= 4 (logand 4 (cdr (assoc 70 elst))))
      (setq filter (strcat filter (cdr (assoc 2 elst)) ","))
    )
  )
  (and (= filter "")(setq filter "*"))
  (setq SS (ssget "_X" (list (cons 0 "INSERT") (cons 8 filter))))

CAB, I've noticed mistake here :

Code: [Select]
(and (= filter "")(setq filter "*"))

It should be :

Code: [Select]
(and (= filter "")(setq filter "~*"))

Thanks for your snippet, I've just used it successfully in my code (but had to correct this "*" to "~*")

M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube