Camera Setting on Detail


I am trying to set up a camera with a Namedview on a detail using python.
The way I structured is

  1. setup a camera location, up and target and save as a Named view
  2. Create a layout,
  3. Create a detail,
  4. Change the Camera location, up, target under the detail and then commit changes.

so from task 3) the code looks like

detail = layout.AddDetailView(“dName_{0}”.format(page_number), top_left, bottom_right, Rhino.Display.DefinedViewportProjection.Top)
if detail:
detail.Viewport.CameraUp = NamedView.CameraUp

This is how I change the camera setting.(NamedVIew here is viewportinfo from the saved NamedView)

However, even if the values such as cameraLocation, Direction, and target, are changed, the end layout with the detail is back to the top view.

Or is there a way to move and set a camera under a detail? I am willing to take any suggestions on setting multiple layouts and multiple details with multiple views through scripting.


Nevermind. I figured. Everything worked fine using detail.CommitViewportChanges() before detail.CommitChanges()

And any non-Viewportchages before CommitViewportChanges seems to un-do all the viewport changes.

Thank you.