A Python-based utility script for Rhino 3D that automates the importing of layered structures from a template .3dm
file.
This Python script streamlines the process of importing layered structures from a template .3dm
file into your current Rhino 3D environment. By automating the creation of layers and nested sublayers, it ensures that complex layer hierarchies can be quickly and reliably reproduced, maintaining consistency across multiple projects and files.
-
Load a Template File: The script reads a selected
.3dm
file containing a predefined layer structure. -
Automated Process: With a single file selection, all desired layers are imported without the need for manual recreation.
-
Select a Template File:
After running the script, you will be prompted to select a.3dm
file containing the desired layer structure. Navigate to your template file and confirm. -
Automatic Layer Creation:
The script will read the template file and automatically create all layers and sublayers in your current Rhino document. Once completed, a success message will appear for each newly created layer. -
Review the Result:
Check the Layers panel in Rhino. You should see the recreated hierarchy, with layers and sublayers matching those in the template. -
Redraw the Views:
The script will refresh your views automatically, ensuring the new layers are immediately visible and ready for use.
- Type
_RunPythonScript
in the command line. - Browse to the location where you saved the script and select it.
If you plan to use this script frequently, you can create a button or an alias for quick access.
-
Right-click on an empty area of the toolbar and select New Button.
-
In the Button Editor:
- Left Button Command:
Replace
! _-RunPythonScript "FullPathToYourScript\import_Rhino_layerTemplate"
FullPathToYourScript
with the actual file path where you saved the script. - Tooltip and Help: Add a description for the button's functionality.
- Set an Icon (Optional): You can assign an icon to the button for easier identification.
- Left Button Command:
-
Go to Tools > Options and select the Aliases tab.
-
Create a New Alias:
- Alias: Choose a short command name, e.g.,
importlayer
. - Command Macro:
Again, replace
_-RunPythonScript "FullPathToYourScript\import_Rhino_layerTemplate"
FullPathToYourScript
with the actual path.
- Alias: Choose a short command name, e.g.,
-
Use the Alias: Type the alias (e.g.,
importlayer
) into the command line and press Enter to run the script.