Jump to content

Recommended Posts

Posted

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? :?

Posted

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.

Posted

Sorry, but as far as I know Nameless Guy's silly idea is as close as it comes. -David

Posted
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!

Posted

yay for magic! =)

Posted

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]

Posted

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)
      )
 )

Posted

Will EXTMIN and EXTMAX not work for this purpose? Or am I on a different planet (wouldn't be the first time..) :geek:

Posted
Will EXTMIN and EXTMAX not work for this purpose? Or am I on a different planet (wouldn't be the first time..) :geek:

 

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

Posted
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 :roll:

 

Thanks David.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...