Set plot styles
To set plot styles according to a CSV file
Introduction
This script is a Rhino plugin that allows to set the plot style of layers in Rhino according to a CSV file. It opens a user interface in Rhino that allows the user to select a scale, and reads the corresponding CSV file to set the print color, linetype and thickness of each layer.
Features
User interface in Rhino that allows the user to select a scale
Reading of CSV files
Setting of the print color, linetype and thickness of each layer
Usage
Open Rhino and use the
RunPythonScript
command to load the scriptIn the user interface, select the scale you want to apply
The script will read the corresponding CSV file and set the print color, linetype and thickness of each layer
Logic
The script initializes an options variable with the different scales available
A user interface is opened in Rhino that allows the user to select a scale
The script reads the corresponding CSV file according to the user's choice
The script reads each row in the CSV file, and assigns the print color, linetype and thickness of each layer according to the values in the CSV file
Dependencies
Rhino
rhinoscriptsyntax library (included in Rhino)
CSV files containing the plot styles infos
Known issues
The script only works for the specific path where the csv files are located, this path should be modified to match the user's path.
The script only assigns values to the layers that match the names in the csv file. If a layer in Rhino has a different name than in the csv, the script will not assign any values to that layer.
The script assumes that the csv file is structured in a specific way, with the layer name in the first column, the red value in the second column, the green value in the third column, the blue value in the fourth column, the linetype in the fifth column, and the line width in the seventh column. If the csv file is structured differently, the script will not work properly.
The script doesn't check if the user inputs a valid scale choice, if the user enters an invalid scale the script will throw an error.
The script does not handle if the user cancels the options box and the script will throw an error.
Script
Example CSV file
To work, the script must by fed with a CSV file formatted as this example
Last updated