Vbscript polar array


(Cshea) #1

i would like to perform polar array to a curve in vbscript.
which curve method or transform method should I be using please


#2

Hi @cshea, there is no predefined method unfortunately. But you can make your own:

Option Explicit

Call PolarArray()
Sub PolarArray()
	Dim strObject, arrCenter, intCount, arrPlane, i, dblAngle, arrAxis, arrXForm
	
	strObject = Rhino.GetObject("Select object to array", 0, True, True)
	If IsNull(strObject) Then Exit Sub
	
	arrCenter = Rhino.GetPoint("Center of polar array")
	If Not IsArray(arrCenter) Then Exit Sub
	
	intCount = Rhino.GetInteger("Number of items", 10, 2)
	If IsNull(intCount) Then Exit Sub
	
	arrPlane = Rhino.ViewCPlane()
	arrAxis = Rhino.XformCPlaneToWorld(Array(0, 0, 1), arrPlane)
	
	For i=1 To intCount - 1		
		dblAngle = 360 / intCount * i
		arrXForm = Rhino.XformRotation(dblAngle, arrAxis, arrCenter)
		Rhino.TransformObject strObject, arrXForm, True
	Next
End Sub

Does that help ?

_
c.


(Cshea) #3

Thanks Clement
that works well …