Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Cannot manipulate detail viewport

$
0
0

@vincentfs wrote:

Hi,

I was trying to manipulate the detail viewport through rhino python, without avail. The viewport does not change. I tried ZoomBoundingBox and ZoomExtentsSelected, neither of them worked. I don’t know whether I am missing some steps. I am on Rhino 6.18.

Thanks for advices,
Vincent

import Rhino
import scriptcontext as sc
import rhinoscriptsyntax as rs

guid = rs.GetObject()
obj = rs.coercerhinoobject(guid)
#obj is the rhinoobject I want the viewport to zoom at

newView = sc.doc.Views.AddPageView("newpageview", 200, 200)
# add detail
detail = newView.AddDetailView("test", Rhino.Geometry.Point2d(0,0), Rhino.Geometry.Point2d(200,200), Rhino.Display.DefinedViewportProjection.Top)
bbox = obj.Geometry.GetBoundingBox(True)
viewport = detail.Viewport
print viewport.CameraTarget
viewport.SetCameraTarget(bbox.Center, True) # move location
print viewport.CameraTarget
# the CameraTarget did changed
detail.CommitChanges()
sc.doc.Views.Redraw()

Posts: 6

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles