Set Name of Detail View

Hi,

I got this block of code from Djordje Spasic and I’m wondering how one might go about giving a name to the detail views in a layout. Djordje was nice enough to give me the code below and when you run it the detail views come up empty since they are not assigned.

This is the code to cycle through the detail views:

def GetAllDetailViews():
    pageView_L = Rhino.RhinoDoc.ActiveDoc.Views.GetPageViews()
    
    for pageView in pageView_L:
        print "pageView.PageName: ", pageView.PageName
        detailView_L = pageView.GetDetailViews()
        for detailView in detailView_L:
            print "detailView.Name: ", detailView.Name

Thanks in advance for the help.

Eric

import Rhino
import scriptcontext as sc

def SetDetailViewNames():
    page_views = sc.doc.Views.GetPageViews()
    for page in page_views:
        details_views = page.GetDetailViews()
        for detail in details_views:
            attribs = detail.Attributes.Duplicate()
            attribs.Name = "Eric"
            sc.doc.Objects.ModifyAttributes(detail.Id, attribs, True)
            
SetDetailViewNames()     

– Dale

Thank you again for the very fast reply!!! Works perfectly.

Eric

dale,

I spoke to soon. I am looking to set the name as displayed in object properties. See screenshot.

EricDetail View Name

Seems to be working here in Rhino 6.

– Dale

Dale

I spoke too soon again. It does work in both 5 and 6!!! Sorry for the confusion. Long day.

Eric