Move an object: How to select a point from within rhinoScript other than select it by hand in Rhino


#1

Hello,

I have a curve starting from (0,0,0) and I would like to move it to (100,0,0). My issue is I want everything to get done automatically within the code, and not interfere with Rhino’s interface. Is there a way to define the “point to move from” and “point to move to” within the RhinoScript?

To be honest, I am not very familiar with the GetObject class so please excuse my ignorance.

Thank you very much :slight_smile:


(Dale Fugier) #2

Hi @Theofanis,

Not sure this helps, but here is how using RhinoScript.

Sub TestTheofanis
	Dim objects, obj, origin, offset, xform
	origin = Array(0, 0, 0)
	offset = Array(100, 0, 0)
	objects = Rhino.PointPick(origin, , True)
	If IsArray(objects) Then
		xform = Rhino.VectorCreate(offset, origin)
		For Each obj In objects
			Call Rhino.MoveObject(obj(0), xform)
		Next
	End If	
End Sub

– Dale


#3

Thank you Dale! I was almost there, but I was missing the VectorCreate step. I was just trying to take it from a point to another, but it wasn’t working. Maybe I did something wrong. Anyway, Thank you very much!