Cannot turn off construction grid or axes in Rhino8

@dale,
In Rhino 7 I was successfully using this C++ code in my DLL to turn off the construction grid and axes (among other things):

// Get list of views in Rhino document.
int32_t num_views = pDoc->GetViewList(view_list, CRhinoView::ViewTypeFilter::Model);
// Removed grid/axes, switch to shaded view, zoom extents and maximize Top viewport.
for (int i = 0; i < num_views; i++) {
	CRhinoView* view = view_list[i]; if (view == nullptr) continue;
	CRhinoViewport& viewport = view->ActiveViewport();
	viewport.SetShowConstructionGrid(false);
	viewport.SetShowConstructionAxes(false);
	viewport.SetShowWorldAxes(false);
	viewport.SetDisplayMode(shaded_attrib->Id());
	// If min/max not available use slower: RhinoDollyExtents(view)
	viewport.DollyExtents(bBox, ON::world_cs);
	// If Top view, maximize it. This will also make it the active view.
	const ON_Viewport vp = viewport.VP(); ON_3dVector dir = vp.CameraDirection();
	// Top view has parallel projection and the camera direction is down.
	if (vp.IsParallelProjection() && dir.x == 0.0 && dir.y == 0.0 && dir.z < 0.0) {
		if (!view->IsMaximized()) view->MaximizeRestoreView();
	}
}

This has stopped working and I end up with them both still displayed:


i notice this issue was raised back in Nov. Has it been fixed and I need to use different code now?

Regards,
Terry.

@Dale,

Any thoughts about this?

Regards,
Terry.

Hi @Terry_Chappell,

This works in a Rhino 8 C++ plug-in:

CRhinoCommand::result CCommandTestTerry::RunCommand(const CRhinoCommandContext& context)
{
  ON_SimpleArray<CRhinoView*> view_list(4);
  const int view_count = context.m_doc.GetViewList(view_list, CRhinoView::ViewTypeFilter::Model);
  for (int i = 0; i < view_count; i++)
  {
    CRhinoView* pView = view_list[i];
    if (nullptr != pView)
    {
      CRhinoViewport& viewport = pView->ActiveViewport();
      viewport.SetShowConstructionGrid(false);
      viewport.SetShowConstructionAxes(false);
      viewport.SetShowWorldAxes(false);
    }
  }
  context.m_doc.Redraw();

  return CRhinoCommand::success;
}

What am I missing?

– Dale

1 Like