Calling hou.SceneViewer.selectGeometry() waits for the user to perform a selection in the viewport, and returns an object of this type representing the elected components. The returned selection can be manipulated by converting it to a specific component type, grown, or shrunk. Then the selection can be converted to a string that can be used in a SOP node group parameter.
If the selection contains components from more than one SOP, you can use the hou.GeometrySelection.mergedNode() function to create a Merge SOP and/or Object Merge SOPs that brings all the referenced geometry into a single node.
boundingBox() -> BoundingBox
Returns the bounding box of the selected region.
connectivity() -> hou.connectivityType enum value
geometryType() -> hou.geometryType enum value
Returns the type of component that was selected.
mergedNode(parent, creator_name, force_keep_original_objects=False, display_original_objects=False) -> Node
Creates a Merge SOP that combines all the SOPs referenced by the selection. Most selections will only reference a single SOP in which case no Merge SOP is required, and the selected SOP will be returned.
mergedSelectionString(empty_string_selects_all=True, force_numeric=False) -> string
Returns a single string that can be used in group parameters of the merged node returned by hou.GeometrySelection.mergedNode(). If all components are selected from a single node this is equivalent to the first string in the tuple returned by hou.GeometrySelection.selectionStrings().
shrinkSelection(checkuv = true)
Removes components that are on the boundary of the selection.
Expands the selection by adding all components that are connected to components currently in the selection.
needsMergedNode(parent) -> bool
Returns true if a Merge SOP needs to be created in order to access all components in the selection.
nodes() -> tuple of Nodes
Returns a tuple of all nodes referenced by the selection.
ordered() -> bool
Returns true if this is an ordered selection. This means that the order
in which the user selected the components is preserved. To have an
ordered selection, the
ordered parameter needs to have been set to
True when calling hou.SceneViewer.geometrySelection.
orientedBoundingBox() -> OrientedBoundingBox
Returns the oriented bounding box of the selected region.
primitiveTypes() -> tuple of hou.primitiveType enum values
Returns a tuple containing all primitive types that are contained in the selection.
selections() -> tuple of [Hom:hou.Selection]
Returns a tuple of component selection objects. These correspond to the nodes returned by the nodes function.
selectionStrings(empty_string_selects_all=True, bool force_numeric=False) -> tuple of strings
Returns a tuple of strings that can be used to refer to the selected components in each SOP node referenced by the selection.
Sets the type of connectivity to enforce when modifying the selection. The current selection is also expanded so that all connected components (using the supplied style of connectivity) become part of the selection.
Changes the type of component contained in the selection, converting the existing selection to the new component type.
Sets the tuple of primitive types allowed in the selection. Any primitives that are not of an allowed type are removed from the selection. Only has an effect if this is a primitive selection.