Grips not present in a mesh duplicate

Hi everybody,

I found a strange behaviour in Rhino 6. I need to pick a grip, duplicate the Owner and then pick the correspondent grip in this duplicate. I attach here an example code:

CRhinoGetObject gv;
	gv.SetCommandPrompt(L"Select mesh vertex to move");
	gv.SetGeometryFilter(CRhinoGetObject::grip_object);
	gv.GetObjects(1, 1);
	if (gv.CommandResult() != success)
		return gv.CommandResult();
	const CRhinoObject* obj = gv.Object(0).Object();
	const CRhinoGripObject * grip = CRhinoGripObject::Cast(obj);

	if (grip) {
		if (grip->Owner()) {
			CRhinoObject * duplicatedGripsObj = grip->Owner()->Duplicate();
			if (duplicatedGripsObj) {
				duplicatedGripsObj->EnableGrips(true);
				ON_3dPoint pt =	duplicatedGripsObj->m_grips->m_grip_list[grip->m_grip_index]->Point().point;
				context.m_doc.AddPointObject(pt);
				context.m_doc.Redraw();
			}
		}
	}

This code works fine on breps and meshes in Rhiino 5 but it crashes on meshes in Rhino 6.
Is there an additional step needed in the new Rhino?
Thanks!

G.

Hi @gennaro,

It appears that CRhinoMeshObject::EnableGrips fails on objects that are not document controlled.

– Dale

Dale,

it means that I should add the duplicate to the document? There is no other way to force the mesh to build its grips?
Thanks for your reply

G.

Yep.

– Dale

And there is no other way to force the creation of the grips? My concern is that I don’t want to trigger any Rhino event in the process. I would end up altering heavily the logic of my plugin just for the mesh objects. For surfaces, breps and curves it works…

Hi @gennaro,

Not that I know of.

Just curious, what are you doing? Why are you coping document objects and then turning on their grips?

– Dale

I need to do this to simulate the behavior of the object when I move its grips. And I need to do it without touching the original object in the document…

Hi @gennaro,

I’ve logged the issue.

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

– Dale