@dale I am trying to copy a layout and set the first detail on the copied layout to a named view. I am not able to set the detail to the named view. Please see an example below. (The example must be run, while the layout to copy is visible.). Thanks for your help.
#! python3
import Rhino
import scriptcontext as sc
def main():
source_layout = sc.doc.Views.ActiveView
duplicate_layout = source_layout.Duplicate(True)
duplicate_layout.PageName = "Layout002"
detail_view = duplicate_layout.GetDetailViews()[0]
named_view_index = sc.doc.NamedViews.FindByName("NamedView002")
# This is not working as intended, does nothing
sc.doc.NamedViews.Restore(named_view_index, detail_view.Viewport)
sc.doc.Views.Redraw()
main()
@BrianJ May you suggest who might help me with this one. I am stuck and we are working towards a deadline. To give some context: I need to apply custom plan headers with variable attributes to hundreds of layouts while using different named views on the generated layouts. I am not able to figure a usable workaround. Many thanks!
@dale Many thanks, I should have thought of that as a workaround
Long term, I would still be interested in getting the rhinocommon solution to work. We seem to need this quite frequently and I would like to add it as a custom command to our office library. If you might have any pointers as to why my code does not work, it would be greatly appreciated.