Rhino 8 Gltf import doesn't work with Hops

Hi! :slight_smile:

I want to import mesh from a .gtlf/.glb file using hops.
So I tried to go around this issue, by creating a grasshopper component instead of reading a file within a script editor.

The component works perfectly outside of hops with any given format.
With hops it works when importing .obj, .3dm (tested only these), but when I try to import .gltf or .glb it fails to return a mesh. My guess would be that there might be some compatibility issues with the new Rhino 8 .glTF importer.

Please let me know if you have any suggestions on how to resolve this issue.

Import logic:

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var tmpPath = "";
            
            DA.GetData(0, ref tmpPath);
    
            using( var doc = Rhino.RhinoDoc.CreateHeadless(null)){
                doc.Import(tmpPath);
                var ros = doc.Objects.FindByObjectType(Rhino.DocObjects.ObjectType.Mesh);
                var meshes = new List<Rhino.Geometry.Mesh>();
                
                foreach( Rhino.DocObjects.RhinoObject obj in ros )
                {
                    meshes.Add(obj.DuplicateGeometry() as Rhino.Geometry.Mesh);
                }
                DA.SetDataList(0, meshes);
            }
        }

GltfLoader.gha (6 KB)

@Joshua_Kennedy Iā€™m having the same exact issue when importing / exporting .glb/.gltf as well. This only happens when Iā€™m exporting a headless RhinoDoc on HOPS / compute.rhino. It works fine in UI mode though.

https://mcneel.myjetbrains.com/youtrack/issue/RH-78795/File-IO-Support-exporting-glTF-programmatically-with-options

Hi, I think this is the issue. Iā€™m hoping to take a look soon.

1 Like