Print Instance Definition Names
Windows only
Demonstrates how to print the names of all instance definitions in the document.
CRhinoCommand::result CCommandTest::RunCommand( const CRhinoCommandContext& context )
{
const CRhinoInstanceDefinitionTable& idef_table = context.m_doc.m_instance_definition_table;
int idef_count = idef_table.InstanceDefinitionCount();
if (idef_count == 0)
{
RhinoApp().Print("No instance definitions found.\n");
return CRhinoCommand::nothing;
}
int num_printed = 0;
for (int i = 0; i < idef_count; i++)
{
const CRhinoInstanceDefinition* idef = idef_table[i];
if (idef != 0 && idef->IsDeleted() == false)
{
ON_wString idef_name = idef->Name();
RhinoApp().Print(L"Instance definition %d = %s\n", num_printed, idef_name);
num_printed += 1;
}
}
return CRhinoCommand::success;
}