Code Red > AutoLISP (Vanilla / Visual)

Selecting object and point?

(1/7) > >>

whdjr:
I am trying to select an object and the selection point, but sometimes the object may overlap another object at the selection point.  How can I "weed" out the other objects and return the object I want and the selction point.  

I have tried using entsel, but it may select the other object and I don't want the other object.

I tried using getpoint, but then couldn't get the object.

I have tried using ssget, but I don't get a selection point.

After reading some of the threads here I tried nentselp, but that didn't return all of the objects at the selection point.

My situation here is I am trying to select a segment of a polyline at my selection point, but sometimes the polyline might overlap another line and I can't filter out the other line.

I am lost at what to try next.  Does anybody have any ideas?

Thanks,

Keith™:
You can use a variety of methods. It will be necessary to do a bit of testing to see which works best for you, but what you could do is...
pseudocode

--- Code: ---
select point using getpoint
pass point to ssget with filter for object type

--- End code ---


To accomplish the ssget filter use this scenario

--- Code: ---
(ssget (getpoint) '((0 . "line")))

--- End code ---


This will however create another problem whenever you have overlapping entities and the draworder. The one on top will always be selected.
To resolve this you would need to pass more than one point to the ssget command. This would likely be the original point and another point that is ever so slightly away from the original, say at 0.0001, making sure you turn off osnaps when you grab the selection set.

As I said this is not a simple solution, but it can be made to work.

CAB:
Something like this?


--- Code: ---(defun c:test ()
  (setq pt (getpoint)
        dis 2 ; could be a function of DimScale
        p1 (polar pt 0.785 dis)
        p2 (polar pt 3.93 dis))
  (setq ss (ssget "_C" p1 p2 '((0 . "*polyline")) ))
  (princ)
)
--- End code ---

Keith™:
CAB that is what I had in mind ... incedently CAB I am going to be in Tampa this evening...gonna try and go to MOSI tomorrow...

CAB:

--- Quote from: Keith ---CAB that is what I had in mind ... incedently CAB I am going to be in Tampa this evening...gonna try and go to MOSI tomorrow...
--- End quote ---

Thanks for the invite, gonna have to pass though.
I'm sure you'll have a good time, wish I could be there. :?

Navigation

[0] Message Index

[#] Next page

Go to full version