dsw
1
CRhinoObjectIterator it(doc, CRhinoObjectIterator::normal_or_locked_objects, CRhinoObjectIterator::active_objects);
it.SetObjectFilter(ON::mesh_object);
it.EnableSelectedFilter();
If i use this code to get all selected meshes the result will always be empty.
What am i doing wrong?
dale
(Dale Fugier)
2
This seems to work:
CRhinoObjectIterator it( context.m_doc, CRhinoObjectIterator::normal_objects, CRhinoObjectIterator::active_objects );
it.SetObjectFilter( ON::mesh_object );
it.EnableSelectedFilter();
int mesh_count = 0;
const CRhinoObject* obj = 0;
for( obj = it.First(); obj; obj = it.Next() )
{
const CRhinoMeshObject* mesh_obj = CRhinoMeshObject::Cast( obj );
if( mesh_obj )
{
ON_wString uuid_str;
ON_UuidToString( mesh_obj->ModelObjectId(), uuid_str );
RhinoApp().Print( L"Mesh object %d = %s\n", ++mesh_count, (const wchar_t*)uuid_str );
}
}
Let me know if you find otherwise…
dsw
3
Hi Dale,
i’m a little bit confused. i tried the whole day to find the problem and it did not work.
But somehow it works right now.
dale
(Dale Fugier)
4
My version is slightly different, as I am looking for just “normal” objects, not normal and locked object. Locked objects can’t be selected…