Zoom and snapping

I would like to zoom->window on a specific rectangle by snapping on it. However, I cannot keep the ESNAP alive while zooming. Whenever I switch on "zoom" the ESNAP goes off. Both in paper-space and model-space. Am I doing something wrong ?

Comments

  • You're not doing anything wrong, this behavior is intented.

  • Is there a reason why it won't snap while zooming ? To me it seems to be a nice feature in order to quickly align "parts-of-the-world" to a viewport in paperspace by snapping on rectangles which are shown in model-space (separate layer).

  • I think it's great that esnaps don't work during pan and zoom. In the dim past, that wasn't true, at least with acad, and it was a nuisance. I wrote lisp routines for pan and zoom to get rid of that when I first started using acad.Paul, you can still zoom to your rectangle. It just won't be precise. But zoom factor usually only needs to be precise when zooming to a scale. Or are you interested in esnap so you can hide everything outside the rectangle? I do that. I always draw a defpoints-layer rectangle around any detail in modelspace, showing where I want the viewport to end. After setting viewport scale, I drag the opposite corner grips of the viewport, esnapping them to that rectangle.

  • Anthony,I need to have precise scaling. The drawings are seafloor-maps showing things on the bottom of the sea. People measure on these drawings with rulers and such.We produce a lot of these drawings every day, so I would like to have a fast and accurate way of doing things.Ideally I would like to click a rectangle in modelspace which automagically would rotate and scale my viewport to fit this rectangle....

  • Paul, Here is a really LISP simple code that works well... its makes the following assumptions... 1. the rectangle in model space is the exact dimensions as the vport2. the command is run while you are in the vport in questionps. by clicking three sequential corners TL TR BR... the code is really simplified... if you just select the rectangle, then its difficult to determine what up/down and it adds a level of complexity to the code that I choose not to think about. with that said, it would be possible to use the selection point location [i.e. (cadr (entsel))] could provide information about the top/bottom of the vport...steve

    (defun setVport () ; Must Start INSIDE the vport in questions (if (AND (= (getvar "TILEMODE") 0) (> (getvar "CVPORT") 1)) ; start TRUE ----> IN LAYOUT MODE AND VPORT IS ACTIVE (progn ; select 3 corners of rectangle representing viewport (setq pt_topLeft (getpoint "Select TOP LEFT corner of the rectangle representing the desired Viewport:")) (setq pt_topRight (getpoint "Select TOP RIGHT corner of the rectangle representing the desired Viewport:")) (setq pt_bottomRight (getpoint "Select BOTTOM RIGHT corner of the rectangle representing the desired Viewport:")) ; Determine angle in degrees based on pt_topLeft and pt_topRight (SETQ ANG (* -1 (ANGLE pt_topLeft pt_topRight) (/ 180 PI))) ; use dview - twist to set twist angle of vport (command "dview" "" "TW" ang "") ; use zoom to scale viewport correctly (command "zoom" "w" pt_topLeft pt_bottomRight) ) ; end TRUE------------------- ; START ELSE-----> IF NOT IN A LAYOUT AND VIEWPORT NOT ACTIVE - don't run command (progn (print "Command must be run from an active Viewport") ) ; END ELSE); end if(princ))
  • In most cases it would be a darn nuisance, as it used to be in Acad if I remember correctly.You can zoom to individually snapped points though it's a slow job.If you can snap a viewport to exact points in model space now I'm not sure it has been possible in the past, but you can do it using Xclip in an Xref'd drawing - just draw a polyline exactly where you want in Mspace and pick it as the xclip frame.

  • using the function i posted.... if the scale of the "rectangle" in model space is scalled correctly then the scale of the printed product will be precise.the length and width of the "rectangle" simply represents the aspect ratio of the vport window (which i assume is always the same). So make a block of a "rectangle" border at a scale of say 1":1'. Then insert the block and set the block scale to the desired size... i.e -> if the "rectangle" block is at 100 scale then the vport will be scaled at 1"=100'... then rotate it if you want...then use the function i provided above to reset the vport view... the esnaps will work because the (getpoint) arguements allow esnaps to be active... whereas the zoom command ignores esnaps (your problem in the first place), unless the esnap toolbar is used to toggle endpoint esnap on/off...

  • Paul, I'm just curious... Why don't you like using the Properties bar to set viewport scale? It's hard to imagine anything faster or easier than that.

  • Anthony,I could use the scale, but I also have to position and rotate. Just clicking on objects is easier than numeric input of coordinates. Especially when the modelspace contains rectangles which exactly map on the viewport.I'm not exactly a LISP-guru but I'm going to try Stephen's piece of code which seems to do exactly what I want.

  • Stephen,I try to run your LISP routine, but I'm very, very new to LISP. Can you give me step-by-step instructions on how to run it ? I used "appload" and added your code, but wht's next ?

  • PaulHave you tried the align command Very useful for scale and rotate like you want I think.Open help and read.Patrik

  • Paul, Put the lisp script into a text file and call it SOMETHING.LSPNow the file can be loaded several ways: 1. use appload menu - make sure you actually load it, not just add it to the list 2. drag the SOMETHING.LSP file onto an active bricscad window 3. type (load "c:/something.lsp") at the command lineonce its loaded.. just call the function name. for the script i posted you would have to type (setvport)If you swap the line: (defun setVport ()with (defun c:setVport ()then you can just type setvport - without the parenthesismake sense...steve

  • And you can have Stephen's lisp function load automatically whenever you start up, so that it's always available. Just add that same load function, i.e.: (load "c:/something.lsp")as a separate line in a text file called "On_start.lsp" that's in the user support folder. Do a search for that filename - it's a long path name, and not part of C:\Program Files\Bricsys.You can put "something.lsp" anywhere you want, but make sure you include its path in the load function. For example, if you put it in C:\My Documents\Lisps, then that line should be: (load "c:/My Documents/Lisps/something.lsp")

  • Gentlemen,It works! (The "c:" made a big difference)I tried it using a rectangle which had the right orientation (lined up with the viewport so-to speak). Would it be possible to enhance the LISP so it also takes rotation into account ? That would really make may day.

  • Ahhhh, I was a bit hasty... It also works for rotated rectangles ! Thanks Stephen, this makes my life a lot easier. I think I'll have to dive onto LISP so I can write my own stuff next time.

  • Paul, glad you figured it out... i started learning LISP from scratch 2 years ago..steve

This discussion has been closed.