1st post updated with my latest version of the function.
you can catch VIEWPORT with this:
(setg pt (getpoint "\nSelect point: ")
ds (getvar "VIEWSIZE")
p1 (polar Pt (* 0.5 pi) ds)
ss (ssget "_F" (list Pt p1)'((0 . "VIEWPORT")))
)
than check if point is inside - see image. all three points grab the VIEWPORT but only green is correct.
maybe it will be useful.
kruuger
Kruuger,
Thanks. Your post got me thinking about it. Your suggested code has a few problems:
1) If the viewport is not completely visible in the current view - the ssget "F" option does not work.
2) if the viewports layer is turned off, the above ssget code also does not work.
Fortunately - your reply got me thinking about another bit of code you posted:
http://www.theswamp.org/index.php?topic=38197.0In that post you were selecting *all* the viewports and iterating through them. I tried this method - iterating through all viewports and trying to find a viewport that has the object under the cursor - and it seems to work well so far. It seems that (nentselp) will not find anything that is not visible within a viewport if the coordinates are not within the boundary.
For now - this function does what I need it to do. Although I will still look further into this for problems, and to find out a way to get the entity without activating a viewport (Like AutoCAD's dimensions can do). I dont know if this is possible without using nenselp, which only works in the active space.
Thanks again! Phil.