WindowsIHateYou Posted February 17, 2014 Share Posted February 17, 2014 LISP to scale viewport and adjust extents off of a base point? What my boss gave me: A billion viewports at 1/40 What my boss wants: The same billion viewports at 1/20, but showing the exact same full extents. (I know this will make viewport Areas on layout quadruple in size) Is there a way to scale the viewport so that the zoom scales also? Quote Link to comment Share on other sites More sharing options...
pBe Posted February 17, 2014 Share Posted February 17, 2014 is that change the scale if and only if the scale is 1/40? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 17, 2014 Share Posted February 17, 2014 Is this example works ? (defun c:Test (/ s vl) (princ "\n Select Single viewport ..") (if (setq s (ssget "_+.:S:E:L" '((0 . "VIEWPORT")))) (progn (vla-put-customscale (setq vl (vlax-ename->vla-object (ssname s 0))) 0.025) (vla-scaleentity vl (vla-get-center vl) 2.) ) ) (princ) ) (vl-load-com) Quote Link to comment Share on other sites More sharing options...
WindowsIHateYou Posted February 17, 2014 Author Share Posted February 17, 2014 is that change the scale if and only if the scale is 1/40? For this project all viewports start at 1/40. If starting scale needs to be input to make a function work, it would still be faster than "manual" changes. Is this example works? Wow, so few lines of code to work! Thank you very much:D. Is there any way to use a reference point instead of 'center' of viewport? 'User pick'(?) would be perfect, or 'bottom left'(?) would work for me. Thanks Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 18, 2014 Share Posted February 18, 2014 Wow, so few lines of code to work! Thank you very much:D. Thanks You're welcome . Is there any way to use a reference point instead of 'center' of viewport? 'User pick'(?) would be perfect, or 'bottom left'(?) would work for me. Try these two routines . User input for the base point . (defun c:Test1 (/ s v p) (princ "\n Select Single viewport ..") (if (and (setq s (ssget "_+.:S:E:L" '((0 . "VIEWPORT")))) (setq p (getpoint "\n Specify base point :"))) (progn (vla-put-customscale (setq v (vlax-ename->vla-object (ssname s 0))) 0.025) (vla-scaleentity v (vlax-3d-point p) 2.) ) ) (princ) ) (vl-load-com) Without user intervention . (defun c:Test2 (/ s v l r) (princ "\n Select Single viewport ..") (if (setq s (ssget "_+.:S:E:L" '((0 . "VIEWPORT")))) (progn (vla-getboundingbox (setq v (vlax-ename->vla-object (ssname s 0))) 'l 'r) (vla-put-customscale v 0.025) (vla-scaleentity v (vlax-3d-point (vlax-safearray->list l)) 2.) ) ) (princ) ) (vl-load-com) Quote Link to comment Share on other sites More sharing options...
nod684 Posted February 19, 2014 Share Posted February 19, 2014 this is nice! can it be modified so it will ask for the Original Viewport Scale and ask for the new viewport Scale? Quote Link to comment Share on other sites More sharing options...
WindowsIHateYou Posted February 19, 2014 Author Share Posted February 19, 2014 You're welcome . Try these two routines . User input for the base point . Test1 Without user intervention . Test2 Thanks again. Both of these work perfectly. Test1 will be useful in the future. Test 2 will save me time on THIS job. Quote Link to comment Share on other sites More sharing options...
WindowsIHateYou Posted February 20, 2014 Author Share Posted February 20, 2014 Ok, I found a problem. My original viewports SAID they were 1"=40', but after much swearing and problem shooting, I discovered that properties said they are actually .0226 (not .025). Then there was more swearing. The lisp still saves me time though. Just not as much. Quote Link to comment Share on other sites More sharing options...
Jef! Posted February 20, 2014 Share Posted February 20, 2014 I encountered this problem many times, (like making an exploded view of a model using many viewports frezing everithing but one part in each vport, then due to changes the exploded view is too large to fit on a page).. the best solution I found is very simple: -make a block with the viewports -rescale the block (you can use reference with an entity drawn in model and transfered with chspace prior to make the block if the starting scale is an odd number) -explode the block. hope it helps. regards Jef! Quote Link to comment Share on other sites More sharing options...
WindowsIHateYou Posted February 21, 2014 Author Share Posted February 21, 2014 I encountered this problem many times, (like making an exploded view of a model using many viewports frezing everithing but one part in each vport, then due to changes the exploded view is too large to fit on a page).. the best solution I found is very simple:-make a block with the viewports -rescale the block (you can use reference with an entity drawn in model and transfered with chspace prior to make the block if the starting scale is an odd number) -explode the block. I had a chance to try today. I am VERY surprised that this works. Since it uses block, all additional notes/dims/info also scales up in the correct position. And ALL viewports can be done at once. Thanks for the alternate method. Quote Link to comment Share on other sites More sharing options...
Jef! Posted February 22, 2014 Share Posted February 22, 2014 I found that few years ago, and it saved me (and many coworkers) so many hours of drafting time. If you said that notes/dims/infos followed and scaled up, it means that your dimensions are in paper space. Since you also mentioned that the viewports were actually at a scale of .0226 (not .025) I'd strongly suggest that you double check them since you probably used a dimscale of 1:40 to start with. At a starting scale of .0226, chances are that they wont be accurate. Worst case scenario, import a dimension of the correct scale and match prop them all. I'm glad I could help you. cheers Jef! 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.