mcneel / compute.rhino3d

REST geometry server based on RhinoCommon and headless Rhino
Other
296 stars 185 forks source link

Resthopper crashes when a grasshopper definition has RH_IN or RH_OUT group without associated object, #97

Closed kretz closed 4 years ago

kretz commented 4 years ago

Sometimes, not sure how or why, Grasshopper fails to handle the deletion of groups correctly and ends up keeping the group without any objects inside. These groups are not visible, and can only be found using search. And when you try to locate them they are located top left of the canvas. This is probably a bug that should be corrected in Grasshopper.

Screenshot 2020-06-15 at 17 46 49

When a group is this kind is sent to Rhino Compute, and marked as RH_IN or RH_OUT it is assumed that the group is not empty, and crashes if it is. https://github.com/mcneel/compute.rhino3d/blob/master/src/compute.geometry/ResthopperEndpoints.cs#L115 https://github.com/mcneel/compute.rhino3d/blob/master/src/compute.geometry/ResthopperEndpoints.cs#L483

Since it is really hard to delete the invisible group (only way I found is manually editing the ghx file) I suggest groups without objects are checked and ignored.

I will attach example of problematic gh file as soon as I have a clean one.

mcneel-build commented 4 years ago

Linked with COMPUTE-118

sbaer commented 4 years ago

Thanks, the code was assuming all groups has at least one item. Modified to skip empty groups