Hi,
I am reading Rhino file using Rhino3dmIO module inside Revit. It reads the file but upon calling File3dm.Objects.ToList() returns all objects as nulls. I want to get InstanceReferenceGeometriy and InstanceDefinitionGeometry even after using filter it returns only nulls.
It seems there is a problem with my computer…same code worked on another computer dont know what’s happening exactly.
it seems that Rhino.RhinoDoc.ActiveDoc.Object.ToList() always returns null values but if you foreach or do something like Rhino.RhinoDoc.ActiveDoc.Object.Select(x=>x) it works fine.
Yes we are using the C# version of Rhino3dm, in all snippets I put below file is a File3dm type.
So at first we just tried to do var items = file.Objects.ToList() but got the error from above. Then I took the advice from above and tried var items = file.Objects.Select(x => x).ToList() but still got the error, but I think that’s because LINQ was simplifying expression so the select was essentially doing nothing. Then finally when I do var items = file.Objects.Where(x => true).ToList() I no longer get the error.
I think there might be something around the type of file.Objects inherits both from IList and IEnumerable and the IList implementation is failing so I need to force LINQ to query on the IEnumerable and casting file.Objects to IEnumerable doesn’t work either because LINQ is just too smart