For some reason the following code is failing. I am attempting to modify a block that contains nested blocks, to remove anything that isn’t a nested block instance.
block = r.RhinoDoc.ActiveDoc.InstanceDefinitions.Find(name)
idefIndex = block.Index
oldGeom = block.GetObjects()
newGeom = []
newAttr = []
for oldObj in oldGeom:
if oldObj.ObjectType == r.DocObjects.ObjectType.InstanceReference:
idefId = block.Id
trans = oldObj.InstanceXform
newObj = r.Geometry.InstanceReferenceGeometry(idefId,trans)
newGeom.append(newObj)
newAttr.append(oldObj.Attributes)
#modify the instancedef
res = r.RhinoDoc.ActiveDoc.InstanceDefinitions.ModifyGeometry(idefIndex,newGeom,newAttr)
Im trying to grasp what is causing this to fail, I do have “linked” nested blocks in places, could this be the cause? Any help/ ideas would be appreciated.
edit: to clarify by failing I mean that the modifyGeometry function is returning “False”