Extrusion objects selection within the block instance

Hi All,
There is strange behavior of object selection within block instance.
I have the block instance that contains 3 objects: polysurface, extrusion and mesh.
I would like implement feature of sub-object selection (to be able select custom number of sub-objects) with command that contains next code:

unsigned int filter = ON::surface_object | ON::brep_object | ON::extrusion_object | ON::mesh_object;

CRhinoGetObject go;
go.SetCommandPrompt(L"Select objects:");
go.SetGeometryFilter(filter);
go.EnableSubObjectSelect(true);
go.GetObjects(1, 0);
if (go.CommandResult() == CRhinoCommand::success)
{
	// todo...
}

But the problem is the extrusion can’t be selected.
Even if selection filter has extrusion bit enabled and sub-object selection is allowed.
What can be wrong? Thanks for any ideas.

InstanceObjectSelection.3dm (86.6 KB)

Hi @samoles82,

Yeah seems like this should work. Actually windows/crossing selection does work. I’ve logged this issue.

https://mcneel.myjetbrains.com/youtrack/issue/RH-53460

In the mean time, see if this works for you:

unsigned int filter = 
  CRhinoGetObject::surface_object | 
  CRhinoGetObject::polysrf_object | 
  CRhinoGetObject::mesh_object;

CRhinoGetObject go;
go.SetCommandPrompt(L"Select objects");
go.SetGeometryFilter(filter);
go.EnableSubObjectSelect(TRUE);
go.EnableGroupSelect(FALSE);
go.GetObjects(1, 0);
if (go.CommandResult() == CRhinoCommand::success)
{
}

– Dale

Hi Dale,
Yes, it seems your code can be a solution of my problem, thanks.

One note connected to selection problem:
According to description of the function:
void CRhinoGetObject::EnableSubObjectSelect(BOOL bEnableSubObjectSelect, BOOL bEnableBlockSubObjectSelect);
I expected that with the next code line:
go.EnableSubObjectSelect(FALSE, TRUE);
it can be possible to select sub-objects of a block instance. But it isn’t so.
Only lines:
go.EnableSubObjectSelect(TRUE);
or
go.EnableSubObjectSelect(TRUE, TRUE);
allow sub-object selection.

Are the function parameters managed independently or the second parameter depends on the first?

Thanks.

Hi @samoles82,

The second parameter (BlockSubObjectSelect) is dependent on the first (SubObjectSelect).

– Dale