C++ Active View - SDK changed

Hi,

I am following this tutorial:

IsKindOf is not present in C++ sdk what is equivalent of that?

Hi @Petras_Vestartas,

The guide you reference shows source for Rhino 5. Here is what you need to do in Rhino 6:

CRhinoCommand::result CCommandTest6::RunCommand(const CRhinoCommandContext& context)
{
  CRhinoView* view = RhinoApp().ActiveView();
  if (nullptr == view)
    return CRhinoCommand::failure;

  CRhinoPageView* page_view = static_cast<CRhinoPageView*>(view);
  if (page_view)
  {
    ON_wString layout_name = page_view->MainViewport().Name();
    ON_UUID active_detail_uuid = page_view->ActiveDetailObject();
    if (ON_UuidIsNotNil(active_detail_uuid))
    {
      ON_wString detail_name = page_view->ActiveViewport().Name();
      RhinoApp().Print(L"The detail \"%s\" on layout \"%s\" is active.\n", 
        static_cast<const wchar_t*>(detail_name), 
        static_cast<const wchar_t*>(layout_name)
      );
    }
    else
    {
      RhinoApp().Print(L"The layout \"%s\" is active.\n", 
        static_cast<const wchar_t*>(layout_name)
      );
    }
  }
  else
  {
    ON_wString viewport_name = view->ActiveViewport().Name();
    RhinoApp().Print(L"The viewport \"%s\" is active.\n", 
      static_cast<const wchar_t*>(viewport_name)
    );
  }

  return CRhinoCommand::success;
}

I’ve updated the guide.

– Dale

Thank you:)