Jump to content

continuous zoom


salman

Recommended Posts

I want to write code that zooms the objects in the drawing that are below my cursor. And this should happen

continueusly as I move my cursor, so that I do not need to use the zoom command repeatedly. Do I need to use some

 

infinite loop for this like below

( while( T )

read the current cursor location

zoom the portion below the cursor and surroundings.

)

I have not use this technique so far but I think if I perhaps use an infinite loop inside a program and load after loading

I will not be able to do other tasks and CAD will become stuck.

Please guide.

Link to comment
Share on other sites

yes I have used the zoom wheel, but it is disturbing when you are quickly moving from one portion to another and you have to zoom in or out the new portion again and again.

Link to comment
Share on other sites

So, how would the program know how much to zoom in?

 

How would it know when to zoom out?

 

Isn't this just a "lazy" lisp request?

Link to comment
Share on other sites

do you mean like the old windows magnifier addon that used to kick about. id imagine that this would cause more hastle than its worth.

why dont you concider buying a 3dconexxion space navigator, you can buy them from amazon for £40

http://www.3dconnexion.com/3dmouse/spacenavigator.php

 

http://www.amazon.co.uk/3Dconnexion-SpaceNavigator-Personal-Edition-USB/dp/B000LB41BM/ref=sr_1_1?ie=UTF8&s=electronics&qid=1241994390&sr=8-1

Link to comment
Share on other sites

do you mean like the old windows magnifier addon that used to kick about. id imagine that this would cause more hastle than its worth.

why dont you concider buying a 3dconexxion space navigator, you can buy them from amazon for £40

http://www.3dconnexion.com/3dmouse/spacenavigator.php

 

http://www.amazon.co.uk/3Dconnexion-SpaceNavigator-Personal-Edition-USB/dp/B000LB41BM/ref=sr_1_1?ie=UTF8&s=electronics&qid=1241994390&sr=8-1

 

 

 

Never knew those things existed... :P

Link to comment
Share on other sites

I was thinking about buying one for myself, they actually look really handy.

 

Yeah, they look pretty quick.

 

I have seen a roller ball thing that acts like a mouse (upside down), so that it stays in the same place, while you move the ball on top... but I have never come across these things before now..

Link to comment
Share on other sites

This is the best I could come up with....

 

left click to zoom out, right click to exit.

 

(defun c:QZoom (/ app grdat iEnt Minp Maxp)
 (vl-load-com)
 (setq app (vlax-get-acad-object))
 (princ "\nMove Cursor over Objects to Zoom... ")
 (while (or (= 5 (car (setq grdat (grread t 4 2))))
            (eq 3 (car grdat)))
   (if (setq iEnt (car (nentselp (cadr grdat))))
     (progn
       (vla-getBoundingBox
         (vlax-ename->vla-object iEnt)
           'Minp 'Maxp)
       (vla-zoomwindow app Minp Maxp)))
   (if (eq 3 (car grdat))
     (vla-zoomextents app)))
(princ))
 
Edited by Lee Mac
Link to comment
Share on other sites

Cheers Bill,

 

Its a bit... how to put it... "fragile", but I suppose, if you are careful with the mouse movement, it may work for you :)

Link to comment
Share on other sites

  • 14 years later...

Good evening @Lee Mac ( well it is here anyway 🤣 )

I know this is an old post but I'd like to try the zoom routine you posted above, but it has formatting with the brackets.

Is there any way to repost it in the new format?

Thanks!

Link to comment
Share on other sites

@Lee Mac I copied it and was able to remove the bracketed data... works good.

 

Could you help me modify it to act like a "magnifier" , and when I right or left click it zooms to that view?

I'm thinking a predefined square size over an area that defines a zoom window. 

The drawing could be zoomed all the way out, or any zoom level.

The square (grvecs ..?) follows the cursor around until you click.

When you move the square over an area and click it defines that as the zoom window?

Thanks again!

 

Link to comment
Share on other sites

@Abrasive Try this. Not sure if this is what you want. I thought this was an interesting challenge. Use the plus [+] and Minus [-] keys to change the boundary size.

(defun C:ZOOMD (/ _rect ac code data h ls pt v)
   (vl-load-com)
   ; Sub function for drawing the zoom boundary.
   (defun _rect ()
      (mapcar
        '(lambda (a) (grdraw (car a) (cadr a) -1))
         (list
            (list (car ls) (list (car (cadr ls)) (cadr (car ls))))
            (list (list (car (cadr ls)) (cadr (car ls))) (cadr ls))
            (list (cadr ls) (list (car (car ls)) (cadr (cadr ls))))
            (list (list (car (car ls)) (cadr (cadr ls))) (car ls))
         )
      )
   )
   
   (setq ac (vlax-get-acad-object)
         h  (/    (getvar "viewsize") 4.0)
         v  (list (* h (apply '/ (getvar "screensize"))) h)
   )
   (princ "\nUse [+] or [-] keys to Increase or Decrease Zoom Boundary and Pick Center: ")
   (while (not pt)
      (setq gr (grread t 15 0) code (car gr) data (cadr gr))
      (if ls (_rect))      
      (cond
         ((= code 5)
            (setq ls (list (mapcar '- data v) (mapcar '+ data v)))
            (_rect)
         )
         ((= code 2)
            (cond
               ((or (= data 43)(= data 61))
                  (setq scl 1.5 v (mapcar '(lambda (x) (* x scl)) v))
                  (_rect)
               )
               ((= data 45)
                  (setq scl 0.75 v (mapcar '(lambda (x) (* x scl)) v))
                  (_rect)
               )
            )
         )
         ((= code 3)(setq pt T))
      )
   )
   (vla-zoomwindow ac (vlax-3d-point (car ls)) (vlax-3d-point (cadr ls)))
   (princ)
)

 

Edited by pkenewell
Added (vl-load-com)
  • Like 1
Link to comment
Share on other sites

2 hours ago, pkenewell said:

@Abrasive Try this. Not sure if this is what you want. I thought this was an interesting challenge. Use the plus [+] and Minus [-] keys to change the boundary size.

(defun C:ZOOMD (/ _rect ac code data h ls pt v)
   (vl-load-com)
   ; Sub function for drawing the zoom boundary.
   (defun _rect ()
      (mapcar
        '(lambda (a) (grdraw (car a) (cadr a) -1))
         (list
            (list (car ls) (list (car (cadr ls)) (cadr (car ls))))
            (list (list (car (cadr ls)) (cadr (car ls))) (cadr ls))
            (list (cadr ls) (list (car (car ls)) (cadr (cadr ls))))
            (list (list (car (car ls)) (cadr (cadr ls))) (car ls))
         )
      )
   )
   
   (setq ac (vlax-get-acad-object)
         h  (/    (getvar "viewsize") 4.0)
         v  (list (* h (apply '/ (getvar "screensize"))) h)
   )
   (princ "\nUse [+] or [-] keys to Increase or Decrease Zoom Boundary and Pick Center: ")
   (while (not pt)
      (setq gr (grread t 15 0) code (car gr) data (cadr gr))
      (if ls (_rect))      
      (cond
         ((= code 5)
            (setq ls (list (mapcar '- data v) (mapcar '+ data v)))
            (_rect)
         )
         ((= code 2)
            (cond
               ((or (= data 43)(= data 61))
                  (setq scl 1.5 v (mapcar '(lambda (x) (* x scl)) v))
                  (_rect)
               )
               ((= data 45)
                  (setq scl 0.75 v (mapcar '(lambda (x) (* x scl)) v))
                  (_rect)
               )
            )
         )
         ((= code 3)(setq pt T))
      )
   )
   (vla-zoomwindow ac (vlax-3d-point (car ls)) (vlax-3d-point (cadr ls)))
   (princ)
)

 

PERFECT!!!

That's exactly what was thinking.

thank you again.

  • Like 1
Link to comment
Share on other sites

@pkenewell This works really well, could you get it to update the drawn box as I increase or decrease the size?

Right now it updates when I move the cursor.

Link to comment
Share on other sites

My $0.05 Zoom C scale put it in a defun as a command pick a point. Can have various scales. Use maybe numbers for defun name 10, 100.

Link to comment
Share on other sites

15 hours ago, Abrasive said:

@pkenewell This works really well, could you get it to update the drawn box as I increase or decrease the size?

Right now it updates when I move the cursor.

@Abrasive Strange. It works correctly for me without moving the cursor. I did make a couple edits to the code in the hour or 2 after I posted it; check the original post and make sure you copied the latest version. Otherwise - I don't think there is any way I can make it better.This function uses temporary graphics in a (grread) loop, so it is heavily dependant on graphics and processor speed. It may need more mouse movement on slower systems. It could also be less responsive with a lower dpi mouse?

Link to comment
Share on other sites

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