Custom mesh grips unable to transform object

rhinocommon

#1

Hi @dale and all,

I made a custom mesh grips with custom user data, similar to your rectangle one.

Though, something doesn’t work: when dragging grips, OnDraw() properly draws a dynamically modified mesh, but at the end of a grip drag the original mesh is not replaced. A line in the command prompt appears: Unable to transform 1 object.

It seems as if NewGeometry() is not giving a proper mesh, but I really think it does. I’m struggling with this, as the code is very similar to a plugin with polylineCurves and custom user data that works.

Is there something when going from polylineCurves to meshes that I’m missing?

Many thanks!
Pablo


(Dale Fugier) #2

Before returning a new mesh, check to see if is valid:

bool bValid = mesh.IsValid;

To find out what’s wrong with the mesh, you can do this:

string log;
if (!mesh.IsValidWithLog(log))
{
  RhinoApp.WriteLine(log);
  return null;
}

#3

I checked to see if the mesh is valid, and it really is valid! I also checked that is has user data, with mesh.HasUserData.
I’m quite surprised, I didn’t expect it. I don’t understand why it’s unable to transform the mesh, if NewGeometry() is providing a valid mesh for any drag.

Do you have any other suggestion?

Thanks a lot,
Pablo


#4

Hi @dale,

I attach here the sample that is giving me problems, in Visual Studio.

SampleMeshGrips.zip (35.2 KB)

I made it from the rectangle grips sample to work with meshes. It just freely modifies the vertices of a given mesh.

First, create a sample mesh with the command “SampleMeshGripsCreator”, then edit it with “SampleMeshGripsModifier”. In wireframe mode, the original mesh is in black and the dynamically drawn mesh is in red. Drag a grip and check if at the end the black mesh is replaced by the red mesh or not.

In my case it’s not replaced, and the message “Unable to transform 1 object” appears. I have Rhino 5.13 for Windows.

Please take a look and tell me what happens. I would highly appreciate if anyone else tried too.

Many thanks,
Pablo


(Dale Fugier) #5

This is definitely a bug. Unfortunately I won’t be able to fix this in Rhino 5. Any fix will go in the Rhino WIP.

https://mcneel.myjetbrains.com/youtrack/issue/RH-36059

– Dale


(Dale Fugier) #6

A fix should be in next week’s WIP release.

– Dale


#7

Many thanks! I’ll go for the WIP then.

Pablo


(Brian Gillespie) #8

Fixed in Rhino WIP 6.0.16306.09301, just released.