Set RhinoViewport.Size Property doesn't work

Hi,
I would like to change the size of the current Viewport (by Python script) and it should be possible to do this by changing RhinoViewport.Size Property - according to http://4.rhino3d.com/5/rhinocommon/ it should be possible to Get and also to Set. But the Set option doesn’t work for me.

activeViewport = doc.Views.ActiveView.ActiveViewport
viewport_info = Rhino.DocObjects.ViewportInfo(activeViewport)
activeViewport.Camera35mmLensLength = 60
activeViewport.Size.Width = 768
activeViewport.Size.Height = 576

The Camera35mmLensLength method works, but the two following don’t.
Am I doing something wrong or is this a bug?

Thanks,
Tomas

Don’t exactly know how pythong works but in VB.Net it also says Get and Set with Size.Width and height but it can’t.

To resolve it in vb.net i do:

activeViewport.Size = New Drawing.Size(700, 500)

Edit the size itself instead of the Width and Height. Hope this helps enough to get you further.

Thanks Jordy.
Yes, this works also in Python by:

import System.Drawing as dw
activeViewport = doc.Views.ActiveView.ActiveViewport
viewport_info = Rhino.DocObjects.ViewportInfo(activeViewport)
activeViewport.Size = dw.Size(768, 576)
activeView.Redraw()

but Redraw isn’t working well (see the image below).
Any ideas?

Thanks,
Tomas

Happens her aswell. It seems like the viewport itself isnt changing size but only the “render” part.
If you drag the viewport it also drags the part on the right of your picture.

Maybe @stevebaer knows how to change the viewport size itself.

Hello,

I am also looking to increase the viewport for a render, but the -viewportProperties command does not let me change the size of the viewport. It lets me change some other properties but when I click on ‘size’ the command ends itself :frowning_face:

I am using Rhino 5 for Mac, could it be that you can only edit the viewport size on a Windows?

Please let me know if anyone has any idea, I’m desperate :frowning:

Valeria

Hi @valeriaszegal,

I see you’ve also posted here, which is a great idea as this category is for developers.

Increase Viewport size in Rhino for Mac

Thanks,

– Dale