‘’‘attributes = doc_object.Attributes’’’
Runtime error (MissingMemberException): ‘NoneType’ object has no attribute ‘Attributes’
我是在尝试这个示例中的bake代码:
if B:
print(type(G)) #debug message to Python output
#we obtain the reference in the Rhino doc
doc_object = scriptcontext.doc.Objects.Find(G)
print(type(doc_object))
attributes = doc_object.Attributes
print('the type of attributes is: ' + str(type(attributes))) #debug message to Python output
geometry = doc_object.Geometry
print('the type of geometry is: ' + str(type(doc_object))) #debug message to Python output
#we change the scriptcontext
scriptcontext.doc = Rhino.RhinoDoc.ActiveDoc
#we add both the geometry and the attributes to the Rhino doc
rhino_brep = scriptcontext.doc.Objects.Add(geometry, attributes)
print('the Rhino doc ID is: ' + str(rhino_brep)) #debug message to Python output
#we can for example change the layer in Rhino...
if not rs.IsLayer(L):
rs.AddLayer(L)
rs.ObjectLayer(rhino_brep, L)
#we put back the original Grasshopper document as default
scriptcontext.doc = ghdoc
a = G