Hi,
I am having trouble with sub nested block selection : when using sub object selection I can select any child block, but when running a script asking to pick select blocks, only the parent block can be selected.
Is there a way to keep sub object selection effective while running a script ?
rs.GetObject() allows the subobjects=True parameter, but it looks like rs.GetObjects() (plural) does not have that parameter. If you need to select multiple sub-objects, you may need to use the Rhino.Input.Custom api (https://developer.rhino3d.com/api/rhinocommon/rhino.input.custom).
import Rhino
def select_multiple_subobjects():
go = Rhino.Input.Custom.GetObject()
go.SubObjectSelect = True
go.SetCommandPrompt("Select subobjects")
get_result = go.GetMultiple(minimumNumber=0, maximumNumber=0)
if get_result == Rhino.Input.GetResult.Object:
selected_objects = go.Objects()
return selected_objects
if go.CommandResult() != Rhino.Commands.Result.Success:
print(go.CommandResult())
return
Thanks for your quick response.
Your example led me to the solution, I tried SubObjectSelect but it didn’t work because of the following line :
go.GeometryFilter = Rhino.DocObjects.ObjectType.InstanceReference
Once removed it work as espected. I link the code with the commented line as example.
blockPickerTest.py (1.9 KB)