Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

selecting all objects passing thru given point.

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
ProfWolfMan
3281 Views, 9 Replies

selecting all objects passing thru given point.

 

Hi all,
I am trying to select all objects passing thru a apecified point as like below.
(ssget '(2 2))
i have three lines sharing coommon start point as (2 2).
but above code returns only latest object.
I expect selection set of all three objects.
where i am wrong? Please help.
Thanks & regards,
G

 

Thanks & Regards,
G
9 REPLIES 9
Message 2 of 10
pbejse
in reply to: ProfWolfMan

try this

 

(setq pt '(2.0 2.0) fuz 1.0);<---- fuz value
(setq ss (ssget "C" (polar pt (* pi 0.25) (* fuz (sqrt 2)))
                      (polar pt (* pi 1.25) (* fuz (sqrt 2)))))

 fuz = range, with thi example it will select a window at '(1.0 1.0) and '(3.0 3.0)

fuz value of 0.5 '(2.5 2.5) and '(1.5 1.5)

 

The bigger the fuz the larger the crossing selection

if you need to fiilter entity type

 

(setq pt '(2.0 2.0) fuz 0.01 typ "LINE");<-- options  
(setq ss (ssget "C" (polar pt (* pi 0.25) (* fuz (sqrt 2)))
                      (polar pt (* pi 1.25) (* fuz (sqrt 2)))
                     (list (cons 0 typ))))

 

You can add as many filter you want.

(setq ss (ssget "C" (polar pt (* pi 0.25) (* fuz (sqrt 2)))
                      (polar pt (* pi 1.25) (* fuz (sqrt 2)))
                     '((0 . "LINE")(8 . "YourLayer"))));<--filter

 

 

Hope this helps

 

 

 

 

 

Message 3 of 10
ProfWolfMan
in reply to: pbejse

HI,

 

thank you very much for your help.

 

range trick does well.

 

Regards,

G

 

Thanks & Regards,
G
Message 4 of 10
pbejse
in reply to: ProfWolfMan

Anytime G

 

Glad i could help

 

Message 5 of 10
Kent1Cooper
in reply to: ProfWolfMan


@ProfWolfMan wrote:

....

I am trying to select all objects passing thru a apecified point as like below.

(ssget '(2 2))
i have three lines sharing coommon start point as (2 2).
but above code returns only latest object.
I expect selection set of all three objects.
.... 

The "fuzz factor" approach is good if it's possible that the objects might not all land precisely on or pass precisely through the point.  But if your Lines really do all start [or end] at a common point, or more generally, if any objects really do pass exactly through one, you can use that point itself twice, for both corners of a Crossing window, without a fuzz factor:

 

(ssget "c" '(2 2 0) '(2 2 0))

 

and it will find all of the objects.

Kent Cooper, AIA
Message 6 of 10
pbejse
in reply to: Kent1Cooper


@Kent1Cooper wrote:

(ssget "c" '(2 2 0) '(2 2 0))

 

and it will find all of the objects.


I never knew that. i'm so retarded   Smiley Happy

 

Nice kent

 

 

Message 7 of 10
ProfWolfMan
in reply to: Kent1Cooper

Hi,

 

Excellent and simple for my case.

as itold i am in a situation that all lines are start at same point.

so, without fuzz your method is simple. Thanks for your logic.

 

and also i learnt about fuzz factor from this thread. once again thanks to you both.

 

 

Thanks & Regards,
G
Message 8 of 10
vsrisaichaitanya
in reply to: pbejse

Is it  depends on zoom level?

Actually i tried this but i get different answers as zoom changes......

Message 9 of 10
stevor
in reply to: vsrisaichaitanya

Know that the coordinates must be in the viewing area,

ie, on the screen, to collect the objects.

 

Do not know the zoom magnitude parameters,

we only zoomed if necessary.

 

 John Uhden provides a method at

http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-failure/td-p/2393234

and comments at

http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/strange-behaviour-with-ssget/td-p/826...

 

Google still works wonders at mining info.

S
Message 10 of 10
thajmul2501
in reply to: pbejse

hi kent 

i followed your instruction but it does not work for me.

might be i mistaken

actually i want to use overkill command in order to delete the merge line.

(command "overkill" (setq pnt (ssget "c" '(2,2,0) '(2,2,0)) '(0 . "line")) "")

this is i actually used.

 

this is original lisp

(defun c:111 ()

(defun *error* (msg)
(if (/= msg "Function cancelled")
(princ (strcat "\nError: " msg))
)
(if oom
(setvar "osmode" oom)
)
(princ)
)


(setq pnt (getpoint "\npick point: "))
(setq hdist (getdist pnt "\nget the distance of horizontal: "))
(setq vdist (getdist pnt "\nget the distance of vertical: "))
(setq ang (angle pnt pnt))

(setq a (polar pnt 0.0 hdist))
(setq b (polar pnt (- (* pi 0.5)) vdist))
(setq c (polar b 0.0 hdist))
(setq d (polar c (* pi 0.5) vdist))
(setq p3 (polar pnt (angle pnt a) (/ (distance pnt a)2)))
(setq int (getint "\nenter of lines: "))
(setq i 0)

 


(command "line" pnt a "")
(command "line" pnt b c d "")

(command "text" p3 0.2 "0" "thajmul" "")
(command "move" p3 "" "d" "@0,-0.2,0" "")
(repeat int
(command "line" pnt a "")
(command "copy" (entlast) "" pnt (polar pnt (dtr 270)0.2))
(setq pnt (polar pnt (dtr 270)0.2))
(setq a (polar a (dtr 270.0)0.2))
(setq i (+ 1 i))
(command "overkill" (setq pnt (ssget "c" '(2,2,0) '(2,2,0)) '(0 . "line")) "")
)
(princ)
)

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost