Viewport list

Hi, I need a help, when I open a drawing, I import Viewports from another drawing with the command “NamedView Import.”
After that I need to run a plugin that reads all the names of viewports, very simple,

CRhinoDoc * doc = pApp.ActiveDoc ();

nvistas.Empty ();
doc-> GetViewList (nvistas, true, false);

The problem is that the names of viewports imported from the other drawing do not appear in the list.
How do I make all names appear in the Viewports list?

Hi @nblisboa,

Named Views, imported with _-NamedView _Import will appear in the Named Views panel.


Is this what you are looking for?

– Dale

Hi Dale

Yes the names appear in the panel but I need my plugin, made in Visual C, to create a list with all the names. I’m trying to use GetViewList but only the basic view names are listed. The imported names are not listed

Hi @nblisboa.

If you want to create a Name View, then do something like this:

CRhinoView* pView = RhinoApp().ActiveView();
if (nullptr != pView)
  ON_3dmView named_view = pView->ActiveViewport().View();
  named_view.m_name = "MyNamedView";

If you need a list of Named Views, then do something like this:

int i = 0;
const ON_3dmView* pNamedView = nullptr;
while (nullptr != (pNamedView = context.m_doc.Properties().NamedView(i)))
  ON_wString name = pNamedView->m_name;
  RhinoApp().Print(L"%s\n", static_cast<const wchar_t*>(name));

– Dale

Exactly what I needed. It worked, thank you DALE