Request: Option to Imort a file under the current layer, rather than ignoring which layer is the current layer if the imported file has layer information,
The current behavior of the Import command as described in Help is:
Rhino imports objects to the model on their original layers and creates the layers if they do not already exist.
If the imported file type does not contain layer information, such as when you Save a file using the Geometry only option, the objects are placed on the current layer.
The request is for an option which results in the objects in the imported file being placed on sublayers of the current layer which have the same names and structure of the layers in the imported file. Such sublayers would be created under the current layer if they do not already exist.
Script attached — it runs the normal Import, then moves the layers it created
under whatever layer is current, names and nesting intact.
One catch: if your file already has a top level layer matching one coming in,
Import merges into that existing layer before the script can move anything, so
those stay put. It prints which ones so you’re not guessing.
Run from the ScriptEditor (python3), or wire it to an alias:
! _-RunPythonScript “C:\path\to\import-under-current-layer.py”