Drag and transform subobjects

Hi everybody!
I have been struggling trying to emulate with C++ SDK the functionality Rhino has to select, drag and transform subobjects (e.g. to move an edge/face of a brep and adapt the entire object according to the new edge/face position).
Untitled
I wonder if I have to reassembly the object “manually” or if there is an SDK function.
Any clue??
Thanks in advance!

Hi @gennaro,

All of that fanciness eventually calls ON_TransformBrepComponents.

– Dale

Brilliant! Thanks!!

Hi!
I am trying to use this function to drag the subcomponents of a brep:

ON_Xform translateXform;
translateXform.TranslationTransformation(ON_3dVector(10,1,1));
if (brep) {
	ON_Brep * dupBrep = brep->Duplicate();
	if (dupBrep) {
		ON_TransformBrepComponents(dupBrep, subidxs.Count(), subidxs, translateXform, 0.01, 2, true);
		CRhinoBrepObject * new_object = new CRhinoBrepObject();
		new_object->SetBrep(dupBrep);
		if (new_object) {
			::RhinoApp().ActiveDoc()->ReplaceObject(pObject, *dupBrep);
		}
	}
}

the problem is that it crashes sometimes. My guess is that it happens when the brep is not valid. The problem is that Rhino is capable to move the subcomponent dragging it with the mouse! Why the function is not capable then? (on Rhino6)

Hi @gennaro,

Does RhinoTransformBrepComponents work any better? Also, make to check the return value.

– Dale

it seems to work!
thanks!