Deselect geometries?

Hi all. I do need to find a way to deselect from Grasshopper the selected geometries from the Rhino viewport and I can’t find any component that can do this.

I do found that there is a DeselectAll Method in the Rhino API but I don’t know how to write a script that can use this function.

Any help will be appreciated. Thank you.

the first thing that comes to my mind (without code and without using the new R8 Content components) is to use IDs:


All but selected IDs.gh (7.7 KB)

Sorry, not what I need. I only need to deselect the preselected geometries without a second intervention in the viewport.

I am using a component from Sasquatch components called Select in Document but also I do need the opposite (deselect one) and I can’t find any viable solution.

Select_in_Document_Sasquatch

oh yeah, I think I didn’t understand your goal :upside_down_face: probably I’m not understanding it even now :smiley:

→ you have some geometries that are selected on the Rhino viewport (A)
→ then you go on the Grasshopper window, where you have an output that contains just a subset of those geometries (B)
→ and you want to run a GH command/code of some sort in such a way the Rhino selected geometries will be just (A) - (B) ?

No. I just want to deselect all the geometries, so I won’t have any kind of geometries selected. Like simulating the press of the ESCAPE key in the viewport which deselect everything previously selected.

There is a component in LunchBox called RhinoCommand that can send commands to Rhino viewport, but unfortunately it is freezing all my definitions and I do need to restart Rhino to unfreeze.

P.S. After I do press the button, the mouse movements are just attempts to select the components which it is not working because the entire definition is just frozen!

SelNone_RhinoCommand_Lunchbox.gh (3.3 KB)

now I have understood :smiley:

I guess in order to deselect everything you can use something like:

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino

if x:
    sc.doc = Rhino.RhinoDoc.ActiveDoc
    rs.UnselectAllObjects()

PyDeselectAll.gh (3.0 KB)

1 Like