I have created many parent layers with sublayers in my C++ script. But this leaves all the sublayers expanded. How do I collapse all the sublayers using the C++ SDK?
That reference is helpful for changing the visibility of layers in a viewport. But it does not affect collapsing and expanding layers in the Layers tab that I pictured above. I need a way for the C++ script to be able to do what I manually do in the Layers tab when I click on the Down Arrow in front of a parent layer name.
This shows the needed command in Rhinocommon syntax:
def ExpandLayer( layer, expand ):
"""Expands a layer. Expanded layers can be viewed in Rhino's layer dialog
Parameters:
layer (str): name of the layer to expand
expand (bool): True to expand, False to collapse
Returns:
bool: True or False indicating success or failure
Example:
import rhinoscriptsyntax as rs
if rs.IsLayerExpanded("Default"):
rs.ExpandLayer( "Default", False )
See Also:
IsLayerExpanded
"""
layer = __getlayer(layer, True)
if layer.IsExpanded==expand: return False
layer.IsExpanded = expand
return True
Perhaps you know a way to execute a Rhinocommon command from C++?