Rhino3dm - Python : Add object to File3dmObjectTable

Hi all,

I just discovered the rhino3dm package and I have issues to add objects in a File3dmObjectTable:
I want to read all the objects in my .3dm model and select the ones that are part of the layers given by the user. And then I want to get the bounding box of the objects.
For that, I decided to create a new File3dmObjectTable, to fill it with the desired objects and then apply the GetBoundingBox() method the get what I want. But when I try to use the several Add() methods to the new File3dmObjectTable I always get a TypeError on the arguments.
Does anyone know if I’m not using the methods in the right way, or is it a bug and there is a better way to have the bounding box ?

Thanks for your help!

Here is my code with the Add() method. I tryied also with the AddBrep() one.

def getObjects(model, layers):
    objects = File3dmObjectTable
    for object in model.Objects:
        if object.Attributes.LayerIndex in layers and object.Attributes.Mode == ObjectMode.Normal:
            objects.Add(object.Geometry, object.Attributes)
    return objects

it returns :

objects.Add(object.Geometry, object.Attributes)
TypeError: Add(): incompatible function arguments. The following argument types are supported:
    1. (self: rhino3dm._rhino3dm.File3dmObjectTable, geometry: rhino3dm._rhino3dm.GeometryBase, attributes: rhino3dm._rhino3dm.ObjectAttributes = None) -> object
Invoked with: <rhino3dm._rhino3dm.Brep object at 0x072C6640>, <rhino3dm._rhino3dm.ObjectAttributes object at 0x072C6620>

with the AddBrep() method:

def getObjects(model, layers):
    objects = File3dmObjectTable
    for object in model.Objects:
        if object.Attributes.LayerIndex in layers and object.Attributes.Mode == ObjectMode.Normal:
            if object.Geometry.HasBrepForm:
                objects.AddBrep(object.Geometry, object.Attributes)
    return objects

it returns :

objects.AddBrep(object.Geometry, object.Attributes)
TypeError: AddBrep(): incompatible function arguments. The following argument types are supported:
1. (self: rhino3dm._rhino3dm.File3dmObjectTable, brep: rhino3dm._rhino3dm.Brep, attributes: rhino3dm._rhino3dm.ObjectAttributes = None) -> object
Invoked with: <rhino3dm._rhino3dm.Brep object at 0x07A69620>, <rhino3dm._rhino3dm.ObjectAttributes object at 0x07A69600>

Hi Hadridi,

I had the same issue as yours. Did you resolve it? The rhino3dm.CommonObject.Decode/Encode cannot work for it. The output geometry is not json.

Bests,
Dan