Jump to content

Recommended Posts

Posted

I would like to select a viewport widow scale it up/down and then zoom it up or down with the detail.

So for example if I have a 1:10 scale and I would like to zoom it up to 1:5 the viewport size would be scaled by 2 and the viewport scale would be scaled from 1:10 to 1:5.

Doing this separately is reasonably simple (programatically), however I would like to only select the viewport to scale up the detail rather than select viewport then go into the active window and zoom up the scale.

 

Is there a way to zoom a viewport while only selecting the viewport window (in paperspace) and not have to go in the active window to zoom?

thanks

  • Replies 26
  • Created
  • Last Reply

Top Posters In This Topic

  • Small Fish

    10

  • alanjt

    8

  • vnanhvu

    5

  • eyde

    2

Top Posters In This Topic

Posted Images

Posted

Absolutely you can do this. Select your viewport unlock it and in the lower right corner of your screen you have a scale list.

Select the scale you want it to be at then relock the view port and stretch the viewport to encompass the detail. That is all there is to it.

Posted

You have the option from a toolbar or from the bottom status bar...

 

SCALES.png

Scale.PNG

Posted

or you can type it:

Command: z
ZOOM
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>: [color=red][b]1/20xp[/b][/color]

Posted

Command: z

ZOOM

Specify corner of window, enter a scale factor (nX or nXP), or

[All/Center/Dynamic/Extents/Previous/Scale/Window/Object] : 1/20xp

 

I am still not sure how I can change the viewport scale while in paperspace. What you have above works fine while you are in an active viewport.

I want to change the viewport scale while in paperspace....unless I am missing something.

Posted
I am still not sure how I can change the viewport scale while in paperspace. What you have above works fine while you are in an active viewport.

I want to change the viewport scale while in paperspace....unless I am missing something.

Select the viewport and use one the the first two methods I posted (the ones in the pictures).

Posted
I am still not sure how I can change the viewport scale while in paperspace. What you have above works fine while you are in an active viewport.

I want to change the viewport scale while in paperspace....unless I am missing something.

Just select the viewport (highlight it) do not double click inside it into paperspace. The viewport need to be unlock however.

Posted

If you were so inclined to do this with code, just edit the scale with (vla-put-customscale ).

Posted (edited)

okay -thanks

...so it can be done programatically....

here is my attempt the sticking point is viewport scale where I am going wrong?

thanks

 

 
(defun c:Sc  (/ ss EntVpt VpScaleRatio scalevp NewVpScaleRatio ScaleRatio)
 (vl-load-com)
 (setq scalevp (getreal "\nChoose a scale   : "))
 (princ "\nSelect paperspace Viewport  : ")
(setq ss (ssget ":s" '((0 . "viewport"))))
(if ss
(progn
(setq
    EntVpt (ssname ss 0)
    VptObj (vlax-ename->vla-object EntVpt )
    VpScaleRatio(vla-get-customscale VptObj)
);setq

(setq     
    NewVpScaleRatio (/ 1.0 scalevp);Edit:this line is now correct
    CenPtVport (vlax-get VptObj 'Center)
    ScaleRatio (/ NewVpScaleRatio VpScaleRatio )
);setq
(command "scale" ss ""   CenPtVport ScaleRatio)
(vla-put-customscale VptObj (/ 1.0 scalevp) ));Edit:this line is now correct
);progn
);if
);defun

Edited by Small Fish
corrected code
Posted

I'm assuming by 'sticking point', you mean the scale is not what you are wanting.

 

Set the customscale value with the value divided by 1 (eg. (/ 1. scalevp) ).

 

I didn't add your object scaling, but here's an example:

 

(defun c:Test (/ e s)
 (if (setq e (car (entsel "\nSelect viewport to change/view scale: ")))
   (if (eq "AcDbViewport" (vla-get-objectname (setq e (vlax-ename->vla-object e))))
     (if (setq s (getreal (strcat "\nSpecify new scale (Current: 1\" = "
                                  (rtos (/ 1. (vla-get-customscale e)) 2)
                                  "'): "
                          )
                 )
         )
       (vl-catch-all-apply (function vla-put-customscale) (list e (/ 1. s)))
     )
     (princ "\nInvalid object!")
   )
 )
 (princ)
)

Posted

Set the customscale value with the value divided by 1 (eg. (/ 1. scalevp) ).

 

Thanks a million Alan!! - thats where I was going wrong with my code (ugh!)

Now I have it just how I want it :D

cheers SF

 

EDIT: thanks also for your example code

Posted
Thanks a million Alan!! - thats where I was going wrong with my code (ugh!)

Now I have it just how I want it :D

cheers SF

 

EDIT: thanks also for your example code

You're very welcome.

Posted

Alan just one more question - I am trying to learn from your code.....

what does this line do?:

 

 
(vl-catch-all-apply (function vla-put-customscale) (list e (/ 1. s)))

As I understand it passes a list of arguments to a specified function and traps any exceptions,

but I am not sure what exceptions there would be?

Posted
Alan just one more question - I am trying to learn from your code.....

what does this line do?:

 

 
(vl-catch-all-apply (function vla-put-customscale) (list e (/ 1. s)))

As I understand it passes a list of arguments to a specified function and traps any exceptions,

but I am not sure what exceptions there would be?

The viewport could be locked (cause error) or the layer the viewport resides on could be locked (cause error).

Posted
The viewport could be locked (cause error) or the layer the viewport resides on could be locked (cause error).
Alan- thanks Dude:)
  • 1 year later...
Posted

Hi Small Fish.

Your lisp is very good. I first little glitch like to ask you.

When i load your lisp, display error: ; error: extra right paren on input

And when i cant use VLIDE convert Lsp to VLX

; error: extra right paren on input

; Compilation aborted: Fatal errors found.

Thank you very much !

Posted

Haven't seen Small Fish since some time back in June of 2011. Hope you don't mind waiting for a reply.

Posted

hey here I am!! .... been house building.... nowhere near Acad!

 

Amend (vla-put-customscale VptObj (/ 1.0 scalevp))

to (vla-put-customscale VptObj (/ 1.0 scalevp)

 

It should be easy enough to find missing or additional parenthesis with the VLIDE

 

SF

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