How to Array in Python (ArrayCrv)


I try to figure out how to array in Python as ArrayCrv command is not implemented yet.

I tried with
rs.Command("_ArrayCrv " + " SelID " + str(array)) but the the “SelID” does not seems to work because the objects that needs to be multiplied are in a list.

array (objects):
[<System.Guid object at 0x0000000000000035 [5f7cb5a1-d04f-46f3-8a5f-ad467f0ab16f]>]
Select objects to array. Press Enter when done: _ArrayCrv
Select objects to array: SelID
Object ID to select: [<System.Guid - This line is broken it does not parse the whole GUID id.

Is there any alternative way to use this command without interface but only with command line where I can type the number of multiplications ?

Hi onrender

to solve this with a scripted command you can fist select aal the objects to array and than run de command. This way you only need to SelId the pathcurve.

You could script the array command in Rhino, but that involves quite a few steps.
I don’t have the time atm to get you started, but it would be something along the lines of:

  • divide the pathcurve and get the parameters at those divides
  • get the perpendicular planes of the pathcurve at each divide
  • for each divide transform a copy of your input geometry from a base-plane to the perpendicular plane.


Hi @onrender,

Here is starting point:

import Rhino
import rhinoscriptsyntax as rs
import scriptcontext as sc

def SampleArrayCrv():
    obj_ids = rs.GetObjects("Select objects to array")
    if not obj_ids: return
    base_pt = rs.GetPoint("Base point")
    if not base_pt: return
    plane = rs.ViewCPlane()
    plane.Origin = base_pt
    crv_id = rs.GetObject("Select path curve")
    if not crv_id: return
    count = rs.GetInteger("Number of items", 2, 2)
    if not count: return
    if rs.IsCurveClosed(crv_id): count -= 1
    crv_t = rs.DivideCurve(crv_id, count, False, False)
    for t in crv_t:
        frame = rs.CurveFrame(crv_id, t)
        xform = rs.XformRotation1(plane, frame)
        rs.TransformObjects(obj_ids, xform, True)

– Dale

1 Like

Thanks Willem, yes something like this. It takes some time to put together.

Thanks dale,

It is a great starting point. It is very simple :slight_smile: .