I'm trying to do a simple MoveObject translation in Python for Grasshopper (Rhino). I have one grasshopper input, it being the geometry I want to move (here a point), and one grasshopper output, the moved geometry. Here my code:
import rhinoscriptsyntax as rs
import math
PointToMove = x
MovedPoints = []
Point1 = [0,0,0]
Point2 = [50,50,50]
Translation = Point2 - Point1
MovedPoints = rs.MoveObject(PointToMove, Translation)
a = MovedPoints
The bug that shows up is the following: Error: Runtime error (TypeErrorException): unsupported operand type(s) for -: 'list' and 'list'
The problem is clearly the subtraction during the creation of the translation vector. I tried both importing the math syntax as well as just a very easy straightforward code:
import rhinoscriptsyntax as rs
import math
point1 = [1,2,3]
point2 = [4,5,6]
vec = point2 - point1
print(vec)
And still the issue is: Error: Runtime error (TypeErrorException): unsupported operand type(s) for -: 'list' and 'list'
Any help would be much appreciated!
Your logic for creating the translation is not valid Iron Python. You have some options, but I suggest using rhino's api for creating points, vectors, and translations. See example below: