This one is very tricky. It may not make sense for how rhino works, but it makes sense to me and definitely for the UX of how I want this plugin to function.
I have a multitude of problems with the code the way I have it working below. My questions/issues are below the code listing.
CRhinoGetPoint gp0;
gp0.SetCommandPrompt(L"Select Pull Origin");
gp0.GetPoint();
ON_3dPoint origin = gp0.Point();
CRhinoGetPoint gp;
gp.SetCommandPrompt(L"Select Pull Destination");
gp.SetBasePoint(origin);
gp.DrawLineFromPoint(origin, TRUE);
gp.GetPoint();
if(gp.CommandResult() != CRhinoCommand::success)
return gp.CommandResult();
ON_3dPoint pt = gp.Point();
ON_3dVector v = origin - pt;
//if(v.IsTiny())
// return CRhinoCommand::nothing;
//you've got to be kidding me....
//ON_Xform trans = ON_Xform::TranslationTransformation(v);
for(int i = 0; i < translationTarget.Count(); i++)
{
translationTarget[i]->SetPoint(translationTarget[i]->Point().point+v);
//context.m_doc.TransformObject(translationTarget[i], trans, true, true, false);
}
auto surfacedObj = dynamic_cast<CRhinoSuperDGrips *>(newObj->m_grips)->NewObject(true);
if(!context.m_doc.ReplaceObject(CRhinoObjRef(newObj), surfacedObj))
{
OutputDebugStringA("there was a problem");
}
context.m_doc.Redraw();
First, is there a way to not make the user laboriously click two points to get my translation, but instead to simply drag the screen in one swoop?
Second, do I really have to update my rhino grip points one by one? translation via TransformObject didn’t work. This isn’t a big deal but… it’s quite cumbersome.
Third, related to the second issue, when I drag the points on the upper left viewport, the Y & Z directions seem to be swapped, likely due to a difference in coordinate systems between grip point and return values from the GetPoint