I’m trying to produce UI for a false color visual analysis mode. In this mode I want to have a button for “Adjust mesh” to be able to get mesh settings for the analysis mode, similar to dialogs for e.g. CurvatureAnalysis and Zebra commands.
I have found the SDK function RhinoMeshObjects
that seems to do exactly what I want. There is just a couple of minor problems
-
When I click thesee the reply belowPreview
button, the commandline gets filled with the messageClick OK to keep mesh:
This message does not go away, even when the UI is closed. -
When I close the mesh settings dialog with the Cancel button while a preview is showing, this preview keeps on showing.solved with a redraw
Below is the code that handles the button-click of the “Adjust mesh” button. Any suggestions on how to tackle the problems above are highly appreciated.
void CProjectionDialog::OnBnClickedButtonAdjust()
{
CRhinoDoc* pDoc = RhinoApp().ActiveDoc();
if (!pDoc) return;
ON_UUID currentMode = CurrentModeId();
ON_SimpleArray<const CRhinoObject*> analysing;
CRhinoObjectIterator it(*pDoc);
while(CRhinoObject* pObj = it.Next())
{
if (pObj && pObj->InAnalysisMode(currentMode))
{
analysing.Append(pObj);
}
}
const ON_MeshParameters& anal = pDoc->Properties().AnalysisMeshSettings();
ON_MeshParameters toChange(anal);
ON_ClassArray<CRhinoObjectMesh> meshes;
// TODO: after clicking OK the dialog hangs with "Click OK to keep meshes" on the command line
// TODO: after clicking Cancel when a preview is showing, the preview keeps on showing
CRhinoCommand::result res = RhinoMeshObjects(analysing, toChange, m_uiStyle, meshes);
if (res == CRhinoCommand::result::success)
{
pDoc->Properties().SetAnalysisMeshSettings(toChange);
}
}