Serious viewport/camera bug

I ran into serious problems with viewports when I was experimenting with my grasshopper definition. I am using grasshopper with components from Human and Heteropter to receive and modify information about my camera position and viewport size.

My camera goes somewhere very far, far away and I can’t bring it back, grasshopper is turned off so any definition doesn’t override viewport properties on the fly. Selecting geometry and using commands: Zoom selected, Zoom selected all viewports, Zoom extends, Zoom extends all viewports doesn’t help. Deleting all viewports and creating new 4 viewports or 4 default viewports helps only sometimes. It’s really a struggle to make my file work and I don’t have any 100% working step by step solution to repeat when problem occurs again. Even gumball goes crazy and don’t look and work as it should.
I attached screenshots and rhino file, please check it out.

viewport2 viewports-bug.3dm (72.9 KB)

Run the 4View command twice.

– Dale

Dale, thank you for the fast response.

Unfortunately, running 4View command twice doesn’t solve the problem. In some viewport I still can’t even select geometry and in other, gumball arrows are disappearing and showing again when I rotate the view.

Hello - try, one by one, closing the viewports (in the viewport menu, you cannot close the last one I’d say leave the Perspective one) then 4View… anything good happen?


I’d tried that tactic earlier. It doesn’t help. Do you face the same problem in the file that I attached? Does this strategy of closing and using 4View on the end works for you?

Well, as a rule if the viewports get messed up then 4View twice sorts it out - it could be that there is some geometry in outer space - if you select thhe visible expected model and then Invert, is anything selected? If so, Delete.


1 Like

I think that this select & invert technique, then deleting (something which I didn’t bake and create) and 4View command after that works. Very strange. Thank you.

I would like to add something. I found what caused the problem. It was the camera crane component from Heteroptera plugin to Grasshopper. Huge rectangle size which it outputs instantly crashes viewports. This brings me to the problem. How can I create a surface which covers 100% of viewport boundary? The only info which I can find is viewport size in pixels, but how further translate it to rectangle size units which will cover the whole viewport. Is it connected with my screen pixel size?

Hello - I think I have a script someplace that will do this - make a plane that is exactly viewport sized in a particular view. I’ll dig around tomorrow…

@Czaja - see how this works for you-

import Rhino
import scriptcontext as sc
import rhinoscriptsyntax as rs

def test():
    vp = sc.doc.Views.ActiveView.ActiveViewport
    vpb = vp.ParentView.Bounds
    pts = []
    pts.append(Rhino.Geometry.Point3d(0,0, 0))
    pts.append(Rhino.Geometry.Point3d(vpb.Width, 0, 0))
    pts.append(Rhino.Geometry.Point3d(vpb.Width, vpb.Height, 0))
    pts.append(Rhino.Geometry.Point3d(0,vpb.Height, 0))
    s2w = vp.GetTransform(Rhino.DocObjects.CoordinateSystem.Screen, Rhino.DocObjects.CoordinateSystem.World)
    for pt in pts:
    rs. AddSrfPt(pts)


Ok, thank you once again, maybe this info should be added to viewport properties in further releases.