Objects change to layer. Help me

i want change layer for object is selected by code python but i can’t. EX: i have text and text dot in layer default. I select text and move them to new layer (add layer and move).
I dont know command of change layer for object. Please help me

That would be:

rs.ObjectLayer(objects, layername)

You might want to check to see if the layer “layername” exists first and if not, create it:

if not rs.IsLayer(layername): rs.AddLayer(layername)

Check the rhinoscriptsyntax help for more info, there are a number of optional arguments for rs.AddLayer() for example.

1 Like

Thank you! I have a rectangle form, i want to get point in the 4 angle and drawing path in which it should be doing any

Hi I’m sorry, but that’s not completely clear, can you explain in more detail?


i want get location of rectangle be draw before.

OK, let me try to walk through this with you.

You have an existing rectangle in Rhino? You want to find it’s “location”?

A rectangle is a polyline with 4 corner points, it has a start/end point and 3 points in between. Rhino objects do not have specific “center” or “pivot” point.

To get the start of a curve, use rs.CurveStartPoint(curve)
To get the end of a curve, use rs.CurveEndPoint(curve)
To get the midpoint of a curve, use rs.CurveMidPoint(curve)

To get the control points of a curve use rs.CurvePoints(curve) this will actually return five points, the start and the end of a closed curve are the same point.

If you are looking for a “center” of a rectangle, you can use rs.CurveAreaCentroid(curve)

Again, check the Help for more info on all of these methods.

Does any of the above answer what you need?


1 Like

Thank you.
how can i get all text dot inside closed curve?

I guess something like this will work:

import rhinoscriptsyntax as rs

#get the containing curve
container=rs.GetObject("Select planar containing curve",4)
if container:
    #make sure it's closed and planar
    if rs.IsCurveClosed(container) and rs.IsCurvePlanar(container):
        #get the curve plane
        #get all visible/selectable dots in the file
        dots=rs.ObjectsByType(8192, state=1)
        if dots:
            for dot in dots:
                #get dot insertion point
                if rs.PointInPlanarClosedCurve(pt,container,plane):
                    #if true, dot is inside container curve, add to list
            #if any dots are inside, they will be in the list "inside"
            if inside:
            #the list 'inside' contains the ID's of the dots for further use

Note that as text dots are considered as points in this case, the script will select dots whose insertion point is inside the container, even of part of the dot itself is outside the container.

1 Like

have you document of python rhinoceros? I want to study but could not find document. Please send me if you have it. Thank a lot

Have a look at this page:

There is also the “Python 101 primer” here:


1 Like