Freerefill Posted May 26, 2009 Posted May 26, 2009 I feel like I'm missing something obvious and I get the feeling someone is going to post a quick reply to this and make me feel like an idiot, but I can't figure it out. Is there any way to get the current view limits in modelspace? Obviously on the model tab itself. I found VIEWCTR and VIEWSIZE, but VIEWCTR only gives me the center, which is nice but isn't completely helpful, and VIEWSIZE which is nice, but only gives me the height. I'm not talking about the drawing extents, just the current view. I'm just confused. Can anyone help me out? Quote
Freerefill Posted May 26, 2009 Author Posted May 26, 2009 Screensize returns the size of the drawing window in pixels. Some nameless guy I work with had a silly idea of using the ratio from Screensize and the height from Viewsize to get the width. It's a close approximation, close enough to be useable, but it's not accurate. Quote
David Bethel Posted May 26, 2009 Posted May 26, 2009 Sorry, but as far as I know Nameless Guy's silly idea is as close as it comes. -David Quote
Freerefill Posted May 26, 2009 Author Posted May 26, 2009 Sorry, but as far as I know Nameless Guy's silly idea is as close as it comes. -David *shakes fist* Damn you, CommandoBill! Your magic wins again! Quote
David Bethel Posted May 26, 2009 Posted May 26, 2009 Look like this? -David [color=#8b4513];;;GET PLAN VIEW VISIBLE ENTITIES[/color] [color=#8b4513];;;GLOBAL SS SELECTION SET[/color] [b][color=BLACK]([/color][/b]defun c:getvisent [b][color=FUCHSIA]([/color][/b]/ scl siz ctr ll ur[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq scl [b][color=NAVY]([/color][/b]/ [b][color=MAROON]([/color][/b]car [b][color=GREEN]([/color][/b]getvar [color=#2f4f4f]"SCREENSIZE"[/color][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cadr [b][color=GREEN]([/color][/b]getvar [color=#2f4f4f]"SCREENSIZE"[/color][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] siz [b][color=NAVY]([/color][/b]getvar [color=#2f4f4f]"VIEWSIZE"[/color][b][color=NAVY])[/color][/b] ctr [b][color=NAVY]([/color][/b]getvar [color=#2f4f4f]"VIEWCTR"[/color][b][color=NAVY])[/color][/b] ll [b][color=NAVY]([/color][/b]list [b][color=MAROON]([/color][/b]- [b][color=GREEN]([/color][/b]car ctr[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]* siz scl 0.5[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]- [b][color=GREEN]([/color][/b]cadr ctr[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]* siz 0.5[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] ur [b][color=NAVY]([/color][/b]list [b][color=MAROON]([/color][/b]+ [b][color=GREEN]([/color][/b]car ctr[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]* siz scl 0.5[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]+ [b][color=GREEN]([/color][/b]cadr ctr[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]* siz 0.5[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] ss [b][color=NAVY]([/color][/b]ssget [color=#2f4f4f]"C"[/color] ll ur[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] Quote
Freerefill Posted May 26, 2009 Author Posted May 26, 2009 I made mine draw a rectangle, and I tried to make it so I didn't have to define any variables. It's not pretty and it's not perfect, but it works. (defun c:extrec( / ) (command "rectang" (list (- (car (getvar "viewctr")) (/ (* (getvar "viewsize") (/ (car (getvar "screensize")) (cadr (getvar "screensize")))) 2)) (- (cadr (getvar "viewctr")) (/ (getvar "viewsize") 2)) 0) (list (+ (car (getvar "viewctr")) (/ (* (getvar "viewsize") (/ (car (getvar "screensize")) (cadr (getvar "screensize")))) 2)) (+ (cadr (getvar "viewctr")) (/ (getvar "viewsize") 2)) 0) ) ) Quote
Lee Mac Posted May 26, 2009 Posted May 26, 2009 Will EXTMIN and EXTMAX not work for this purpose? Or am I on a different planet (wouldn't be the first time..) Quote
David Bethel Posted May 26, 2009 Posted May 26, 2009 Will EXTMIN and EXTMAX not work for this purpose? Or am I on a different planet (wouldn't be the first time..) Maybe Mars, definitely not Saturn. Zooming inside EXTMIN and EXTMAX does not alter their values. The OP listed the current view limits and I took that as the current screen size. Also erasing entities inside the EXTMIN and EXTMAX values can lead to incorrect values until a ZOOM _E is issued. -David Quote
Lee Mac Posted May 26, 2009 Posted May 26, 2009 Maybe Mars, definitely not Saturn. Zooming inside EXTMIN and EXTMAX does not alter their values. The OP listed the current view limits and I took that as the current screen size. Also erasing entities inside the EXTMIN and EXTMAX values can lead to incorrect values until a ZOOM _E is issued. -David Ahh - definitely Mars Thanks David. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.