View Full Version : Getting viewport scale using a lisp routine.
2004-06-29, 12:05 AM
I have been trying to figure out how to get the viewport scale of a viewport so that I can use the scale in other functions. Just a note usually only have one viewport per tab.
Thanks for any help I can get.
2004-06-29, 12:15 AM
Warren here is an example of similar code:
2004-06-30, 12:27 AM
Thank you very much, have been trying to figure that out for a week.
2004-06-30, 01:33 AM
just to share how about post your finished code
so that others can see the power of sharing ideas?
2004-06-30, 02:09 PM
Here's one I wrote a while back (chg the ext to lsp). It returns a value that can be used transparently in other commands. I also have a vba project on the Exchange for setting the vps by dialog.
2004-06-30, 02:28 PM
Wrote this some time ago (1996).
Feel free to use/modify/hash-up!!!
Full source in ZIP file - not protected.
I originally posted on www.cadalog.com and it had loads of good feedback and downloads.
Type VPTS at command line.
You will be placed in modelspace. Pick a corner of an imaginary box around your detail. Now pick its opposite diagonal corner. Enter scale of detail as it would appear in paperspace. You are now placed in paperspace. Pick your insertion point for your viewport. You now have a viewport to your chosen scale around your detail. A box is also drawn in modelspace around your detail as a guide only. Modelspace and paperspace viewports are in no way connected or joined.
2004-06-30, 08:23 PM
Here's a menu item I used for years before AutoCAD created a control for it:
ID_VP_Scale [Viewport Scale]^C^C^P(if(= 0 (getvar "tilemode"))(progn(princ "PS:MS == 1:")(princ(/ 1 (car (trans '(1 0 0) 2 3 0))))(princ))(progn(prompt "** Command only allowed in Model Space (Floating) **")(princ)))
The only part you really need if you're in a layout (MS or PS) and want the Viewport Scale of the curent viewport (the one the MS command puts the curser in) is:
(car (trans '(1 0 0) 2 3 0))
Powered by vBulletin® Version 4.1.11 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.