Hello Robert,
Here are a few samples:
- Convert obj to 3dm with rhino3dm (leveraging threejs OBJLoader)
- Convert to 3dm with Rhino.Compute
The latter includes a C# script component in the gh definition with the following code:
if( null == data || null == ext ) return;
var decodedData = Convert.FromBase64String(data);
var tmpPath = Path.GetTempFileName();
tmpPath = Path.ChangeExtension(tmpPath, ext);
Print(tmpPath);
File.WriteAllBytes(tmpPath, decodedData);
if(File.Exists(tmpPath))
{
using( var doc = Rhino.RhinoDoc.CreateHeadless(null)){
doc.Import(tmpPath);
var ros = doc.Objects.FindByObjectType(Rhino.DocObjects.ObjectType.Mesh);
Print("Number of meshes: {0}", ros.Length);
var meshes = new List<Rhino.Geometry.Mesh>();
foreach( Rhino.DocObjects.RhinoObject obj in ros )
{
meshes.Add(obj.DuplicateGeometry() as Rhino.Geometry.Mesh);
}
A = meshes;
}
}
So as you can see, you pass a b64 encoded file (stl, dwg, or whatever Rhino supports), you save that file on the server, you create a headless doc, and you import the file into the headless doc. You should tailor this example to handle the objects you are interested in.