Changing colour in a command line script


#1

Sorry if this is obvious, I’m very new to Rhino.

I’ve created a command line file that is read through the Tools/Commands/Read from File menus.

The file plots points as spheres (with the names as text) and lines between some of the points.

Is it possible to change the colour being used for plotting part the way through running the file? Do I have to create a new layer each time? Prefer not to as there may be hundreds of lines.

In AutoCAD I would do this by changing the layers color through a script command.

Many thanks

Simon R


#2

Hi Simon

with the object already selected, this macro seem to work here

-Properties _Object _Color _Object 77,88,99 _Enter _Enter

( 77,88,99 being the RGB values )

HTH, regards


#3

Emilio

Not sure if this will work as the line will need to be selected before using this. I will be plotting the line using a file of commands.

Is there a way I could just change the layer before drawing a line (from a command in the file)?

I can’t find anything to set the current layer (ie to layer 02).

Many thanks


(Willem Derks) #4

Hi Simon,

How about this:
-Layer Current "Layer 01"
Notice how the layername is inside double quotes to be able to pass layernames with spaces in them, for else a space will be interpreted as an Enter.

HTH
-Willem


#5

You can select the last created object by _SelLast
Just put it in your command file after the command that builds the line and before the commands that set its colour.
… Maybe … before _SelLast you can insert _SelNone , to be sure that no other object is selected when the colour changing command will run

Regards


#6

Many thanks for the help. I’ve revised my commands file and everything works great.

Simon R