I have cloned the compute.rhino3d repo and running the Rhino.compute project which is intialising the compute.geometry instance. When I am calling the endpoint from frontend I am getting following error frequently. Sometimes it works sometimes it gives the error as follow
Here is my frontend code which is hitting the endpoint RhinoCompute.url = “http://localhost:6500/”;
const res = await RhinoCompute.computeFetch(
“gd/getdesigns”,
[selectedFile.name],
true
);
console.log(res);
and here is the function for the plugin which gets invoked by that End Point
public class MyRhinoPlugin : Rhino.PlugIns.PlugIn
{
public MyRhinoPlugin()
{
Instance = this;
HostUtils.RegisterComputeEndpoint(“gd”, typeof(MyGeometry));
}
public static MyRhinoPlugin Instance { get; private set; }
}
public static class MyGeometry
{
public static string GetDesigns(string name)
{
MyRhinoCommand command = new MyRhinoCommand();
command.GD(name);
return name;
}
You shouldn’t create instances of Rhino.Commands.Command classes. Rhino itself creates a single instance of each public command class that you derive from for you. This is why there is a static Instance property that will let you access the single instance of you Command derived class.
All that said, this is probably not the actual problem in this case. You aren’t showing what the contents of the GD function looks like so I can’t tell if that is the potential problem.
These functions are nothing but rhinocommon apis called with some geometrical calculations. They working fine when running in Rhino desktop application only when we are calling this plugin through compute it is giving errors