tombu Posted May 10, 2021 Share Posted May 10, 2021 Try: (defun c:ZSnapOld ( / pt1 pt2) (setq pt1 (getpoint "\nSelect First Window Point: ")) (setq pt2 (getcorner pt1 "\nSelect Second Window Point: ")) (command "._zoom" "_w" pt1 pt2) ; end zoom ) It should snap to whatever osnap settings you're alteady using. Sometimes simple is best. 1 Quote Link to comment Share on other sites More sharing options...
tombu Posted May 10, 2021 Share Posted May 10, 2021 This more complicated version will also temporarily toggle Osnaps on while Zooming if needed for newer versions. ; Zoom Window using Osnap settings by Tom Beauford ; Macro: ^P(or C:ZSnap (load "ZSnap.lsp"));ZSnap ; Command line: (load "ZSnap.lsp") ZSnap (defun c:ZSnap ( / *error* osmode pt1 pt2) (defun *Error* (msg) ; embedded defun (setvar 'osmode osmode) (if (/= s "Function cancelled") (princ (strcat "\nError: " msg)) ) (princ) ) (setq osmode (getvar 'osmode)) (if (> (getvar 'osmode) 16384) (setvar 'osmode (- osmode 16384)) ) (setq pt1 (getpoint "\nSelect First Window Point: ")) (setq pt2 (getcorner pt1 "\nSelect Second Window Point: ")) (command "._zoom" "_w" pt1 pt2) ; end zoom (setvar 'osmode osmode) ) Osnap bitcodes changed when Geometric CEnter osnap was added so you will need to find the old bitcode setting to Suppress the current running object snaps in older versions. 1 Quote Link to comment Share on other sites More sharing options...
Dana W Posted May 10, 2021 Share Posted May 10, 2021 All this code popping up. Looks a lot more complicated than I first thought. Quote Link to comment Share on other sites More sharing options...
sketch11 Posted May 10, 2021 Author Share Posted May 10, 2021 Thanks for assisting again tombu. I tried both of the above code snippets on AutoCAD 2021 and both work. I'll try on a previous version at a later stage. Cheers. Quote Link to comment Share on other sites More sharing options...
sketch11 Posted May 14, 2021 Author Share Posted May 14, 2021 Hi tombu, thanks, both of these worked on a previous version. Quote Link to comment Share on other sites More sharing options...
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.