RhinoScriptSyntax - Section Style?

Hi @ssommerv,

there is no method in RhinoScriptSyntax yet but it can be accessed with RhinoCommon in Rhino 8 from Attributes.SectionAttributesSource

eg. below should change an object’s section style source to “FromLayer”:

#! python 2

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs

def DoSomething():
    
    obj_id = rs.GetObject("Select object")
    if not obj_id: return
    
    rh_obj = rs.coercerhinoobject(obj_id, True, True)
    print "Old:", rh_obj.Attributes.SectionAttributesSource 
    
    source = Rhino.DocObjects.ObjectSectionAttributesSource.FromLayer
    print "New:", source
    
    attr = rh_obj.Attributes.Duplicate()
    attr.SectionAttributesSource = source
    scriptcontext.doc.Objects.ModifyAttributes(rh_obj, attr, False)

DoSomething()

does that help ?

_
c.

1 Like