Author Topic: Using ssget with a point and a filter  (Read 1737 times)

0 Members and 1 Guest are viewing this topic.

Prickle Farmer

  • Newt
  • Posts: 33
  • 35+ years of AutoCAD / BricsCAD
Using ssget with a point and a filter
« on: September 20, 2021, 10:15:45 PM »
Earlier in my code I save a user point (pt) from an entsel command.  I want to use that same point to select an object but need to restrict (filter) the layer
The line below works fine in Bricscad but not in Civil 3D or AutoCAD. There will always be 2 objects on top of each other. I only want to select the one on $XPLODE layer.  I don't have AutoCAD to test so I'm starting to annoy my user with testing requests.  Any ideas?

(setq en (ssget pt '((8 . "$XPLODE"))))
I'd rather have a bottle in front of me than a frontal lobotomy.

BIGAL

  • Swamp Rat
  • Posts: 1417
  • 40 + years of using Autocad
Re: Using ssget with a point and a filter
« Reply #1 on: September 20, 2021, 11:40:59 PM »
You are right pt works when only 1 object, the way around is to use a "F" option crossing so work out a UR and LL pts plus your filter.

Code: [Select]
(setq pt1 (mapcar '+ pt (list 1 1 0.0)))
(setq pt2 (mapcar '+ pt (list -1 -1 0.0)))
(setq ent (ssname (ssget "F" (list pt1 pt2) '((8 . "DEFAULT"))) 0))

A man who never made a mistake never made anything

Prickle Farmer

  • Newt
  • Posts: 33
  • 35+ years of AutoCAD / BricsCAD
Re: Using ssget with a point and a filter
« Reply #2 on: September 21, 2021, 12:44:31 AM »
Thanks BIGAL, that'll do it.  Also, I need the ssname to drill down to entity from a selection set!!

I love coming to the Swamp.  I never leave without an answer.  Cheers.
I'd rather have a bottle in front of me than a frontal lobotomy.