Problem with RhinoCommon GetSubObjects

There appears to be a problem in 6.0.15118.10591 with the objects we get from RhinoCommon’s GetSubObjects method; here is a quick repro in python:

from Rhino import *

def stackoverflow():
    for o in RhinoDoc.ActiveDoc.Objects.GetSelectedObjects(False, False):
        for s in o.GetSubObjects():
            # The Attributes exist, and we can touch them:
            print('attrs: %s' % s.Attributes.GetType().Name)
            # But, calls like these will cause a stack overflow:
            #print('id:    %s' % s.Id)
            #print('type:  %s' % s.ObjectType)
            #print('str:   %s' % s.Attributes.GetUserString('k'))
            # In the VS debugger, you can reproduce it just by hovering over
            # the sub-object and trying to look at its properties. The stack
            # looks like this:
            #   ObjectAttributes.get_ObjectId()+0x26
            #   ObjectAttributes._InternalGetConstPointer()+0x136
            #   ObjectAttributes.get_ObjectId()+0x26
            #   ObjectAttributes._InternalGetConstPointer()+0x136

if __name__ == '__main__':

Checking in V5, rather than an overflow, I get an error printed in the python output window: Message: This object cannot be modified because it is controlled by a document. I have been testing with a simple extrusion, and the same extrusion exploded and joined.

I can repeat this. I’ve reported it as a bug.

A post was split to a new topic: V5 Problem with RhinoCommon GetSubObjects

RH-30320 is fixed in the latest Rhino 6 Service Release Candidate