Message 1 of 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all,
I was trying to think of something to help a user with their question here:
And I'm under the impression that this code SHOULD return T only if an entity is entirely within the current viewport view. But when I test it, I am getting T even when it is partially within view. My "View:LL-UR" function appears to be returning the correct coordinates, therefore I am under the impression that perhaps the "_W" functionality of ssget is acting incorrectly? Can someone either help confirm this or tell me where I'm messing up? Just pass an entity name into the function.
(defun IsEntityInView (e / View:LL-UR corners ss) (defun View:LL-UR ( / h w c) (setq h (getvar 'VIEWSIZE)) (setq w (* 0.5 (* h (apply '/ (getvar 'SCREENSIZE))))) (setq h (* 0.5 h)) (setq c (getvar 'VIEWCTR)) (list (mapcar '- c (list w h)) (mapcar '+ c (list w h)) );list );defun (setq corners (VIEW:LL-UR)) (or (member e (vl-remove-if 'listp (mapcar 'cadr (ssnamex (if (setq ss (ssget "_W" (car corners) (cadr corners))) ss (ssadd))) );mapcar );vl );member );or );defun
Using:
Civil 3D 2019
Thanks.
Best,
~DD
Solved! Go to Solution.