Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5745

Move Object using Object Name

$
0
0

@J11 wrote:

I’ve used Rhino for a long time, but I’m fairly new to scripting.

I’m trying to automate a process of opening a file, importing another file and moving the imported part to a new location in the original file.

In the original file I have a point named “Point1” (this is the destination point for the imported part)
In the file I’m importing I have a point named “Point0” (this is the origin point)

I’ve named these objects within their respective files Properties panel under Object Name

This is the code I have so far but Im getting the following error.
“Type mismatch in parameter. String required.”

For Each folderIdx In files

	Rhino.Command "-Import " & Chr(34) & strFolder & folderidx.name & Chr(34) & " Enter Enter", True

'Set up for VIEW 1 (SIDE BY SIDE)
	arrObjs = Rhino.NormalObjects
	If Not ISNull(arrObjs) Then

		'import and move object from Point1 to Point0
		Rhino.Command "-Import C:\Template\lever.3dm Enter"
		Rhino.Command "-selLast Enter"

		arrSelected = Rhino.SelectedObjects

		arrPointOrigin = Rhino.ObjectsByName("Point0", True)
		arrPointDestination = Rhino.ObjectsByName("Point1", True)


		arrSelected = Rhino.MoveObject(arrSelected, arrPointOrigin, arrPointDestination)


	End If

	Rhino.UnselectAllObjects

Next

End Sub

Posts: 6

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 5745

Trending Articles