Moving mesh in Python script

Hi community,

I would like to move the result of my merge component, which is consisted of multiple mesh, points, and lines, in a python script.

The function that I tried is :


, where x is the result of merge and movement = Rhino.Geometry.Vector3d(0.1,0,0)

But things are not moving an inch.
Am I missing here something?

Hi @hyungjoo237,

This works for me:

import rhinoscriptsyntax as rs

translation = rs.VectorCreate((0,0,0), (10,0,0)) 
a = rs.MoveObjects(mesh, translation)

In the above script, you first create a translation vector from the origin (0,0,0), which is also the center point of the mesh cube that I input as parameter β€˜mesh’, to another position. The other position is a point 10 units in x-direction away from the origin.

By having a translation vector, you are now able to move your mesh by this vector. I output it at the default GHPython component output β€˜a’ for preview purposes, but you could save it in a variable as well.

MoveObjects(object_ids, translation) takes two arguments: a single object guid or a collection of object guids and a translation, as either a list or tuple of three numbers or a Vector3d. It returns a collection of moved object guids.
Make sure that your parameters are of the right type.

It is usually a bad idea to mix rhinoscriptsyntax and rhinocommon. You should stick to the one or the other.

1 Like