Creating an object from one layer onto another layer

I am trying to add a sphere off of the two points I made but on a different layer. the new layer would be named Audio Evaluation. The dataset part of the script can be ignored, later on I will be using that to create the radius of the circle, but for now Just making the circle with a specific layer would be helpful.


import Rhino
import scriptcontext as sc
import rhinoscriptsyntax as rs
import math as ma

filename = 'import.csv'
folder = 'C:\\Users\\gornall72\\Desktop\\'

def raw_data():
    rawdata = []
    with open(folder+filename,'r') as infile:
        for line in infile:
    dataset = []
    for data in rawdata:

    header_row = dataset.pop(0)
    data_array = []
    for i in range(len(dataset)):
        data_dict = {}
        for j in range(len(dataset[i])):
            data_dict[header_row[j]] = dataset[i][j]
        print data_array

def Ballast_Points():
    search_string = "Ballast"
    for layer in sc.doc.Layers:
        if search_string.lower() in layer.Name.lower():
            for rh_obj in sc.doc.Objects.FindByLayer(layer):
                if rs.IsSurface(rh_obj.Id):
                    rc = rs.SurfaceAreaCentroid(rh_obj.Id)
                    if rc:
                        attr = Rhino.DocObjects.ObjectAttributes()
                        attr.LayerIndex = layer.LayerIndex
                        sc.doc.Objects.AddPoint(rc[0], attr)
                        #Brand = 
                        #search_string = Brand


response=rs.MessageBox("Evaluate Classroom?",4)
if response!=7:
    rs.MessageBox("Evaluation Aborted")

Hi @Christopher_Gornall,

To add objects to different layers, than the current layer, a new object attribute’s object and set it’s layer index to the appropriate layer. Then pass this atttribute’s object to one of the object table’s “Add…” functions.

For example:

import System
import Rhino
import scriptcontext as sc

def TestAddPoint(point, name):
    if point.IsValid:
        layer_index = sc.doc.Layers.FindByFullPath(name, True)
        if layer_index < 0: 
            layer_index = sc.doc.Layers.Add(name, System.Drawing.Color.Black)
        attribs = sc.doc.CreateDefaultAttributes()
        attribs.LayerIndex = layer_index;
        sc.doc.Objects.AddPoint(point, attribs)
point = Rhino.Geometry.Point3d(3,2,1)
TestAddPoint(point, "test_layer")

– Dale