Hi!
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)