Copy an object to target points

I am trying to move a simple box extrusion to random points but I keep getting this error: Message: unsupported operand type(s) for -: ‘Guid’ and ‘Point3d’.

Here is my script:

import rhinoscriptsyntax as rs
import random

targetPoints =

for n in range(5):
…randomPoints = rs.AddPoint(random.randrange(1, 300), random.randrange(1, 300), 0)

for i in targetPoints:
…Object = rs.GetObject(“Pick your box”, rs.filter.extrusion)
…startPoint = rs.GetPoint(“Point to copy from”)
…translation = i-startPoint
…rs.CopyObject(Object, translation)

I guess you’re looking for rs.CreateVector:

import rhinoscriptsyntax as rs
from random import randrange
t_pts = []
for n in range(5):
    rnd_pt = rs.AddPoint(randrange(1, 300), randrange(1, 300), 0)
obj = rs.GetObject('Pick your box', rs.filter.extrusion)
s_pt = rs.GetPoint('Point to copy from')
for t_pt in t_pts:
    vec = rs.VectorCreate(t_pt, s_pt)
    rs.CopyObject(obj, vec) (373 Bytes)

1 Like

Thank you, Mahdiyar! I did not know about ‘CreateVector’ component and that’s what I was missing.