Grasshopper

algorithmic modeling for Rhino

hi,

I'm relatively new to RhinoScript, and I'm stuck at this tiny script, that I can't seem to figure out why isn't working. It's probably basic stuff. It keeps giving me the "type mismatch in parameter. array required" - even though I'm convinced it is an array I'm feeding it.

Call Circles()
Sub Circles()

Dim i, j
Dim arrPoints
Dim dblRadi

dblRadi = 2.0

arrPoints = Rhino.GetPointCoordinates("Select points")
If IsNull(arrPoints) Then Exit Sub

For i = 0 To Ubound(arrPoints)
Call Rhino.Print("Point array (" & i & "): " & Pt2Str(arrPoints(i)))
Call Rhino.AddCircle(arrPoints(i), dblRadi)
Next

End Sub

thanks in advance,
oh, and - is there an official RhinoScript discussion forum? I can't seem to find it.

Views: 1304

Replies to This Discussion

From Rhinoscript help:

AddCircle
Adds a circle curve to the document.

Syntax
Rhino.AddCircle (arrPlane, dblRadius)

Parameters
arrPlane
Required. Array. The plane on which the circle will lie. The origin of the plane will be the center point of the circle.

dblRadius
Required. Number. The radius of the circle.


Returns
String
The identifier of the new object if successful.

Null
If not successful, or on error.


Example
Dim arrPlane

arrPlane = Rhino.WorldXYPlane

Rhino.AddCircle arrPlane, 5.0



The AddCircle function takes a cplane as its first argument, though, you are feeding it a point...that is not enough.

You need to do something like this:




Call Circles()

Sub Circles()

Dim i, j
Dim arrPoints
Dim dblRadi
Dim strCir

dblRadi = 2.0

arrPoints = Rhino.GetPointCoordinates("Select points")

Call Print(UBOUND(arrPoints))
If IsNull(arrPoints) Then Exit Sub

For i = 0 To Ubound(arrPoints)
Call Rhino.Print("Point array (" & i & "): " & Pt2Str(arrPoints(i)))
strCir = Rhino.AddCircle(Rhino.WorldXYPlane, dblRadi)
Call Rhino.MoveObject(strCir,array(0,0,0), arrPoints(i))

Next

End Sub


And no, there is no forum like this one here for Rhinoscript only. There are diverse locales around the web, but nothing that organizes things like this. So either we mke another NING group for this, or the powers that be add a section to these forums for Rhinoscript...

Rhinoscript seems that its poised to change a bit in Rhino 5 as different capabilities get integrated. Surely a place like this for Rhinoscript users ... even a general coding group, for SDK programmers, Rhinoscript peeps, etc can gather. Currently, the Rhino.Plugins Newsgroup handles it all.
thanks for the reply, Luis.
The best place to get Rhinoscript help is the Rhino Plugins Newsgroup. A number of plugin developers along with scripters and the guys from McNeel are there so you can get pretty good answer pretty quick.

There's also Rhinoscript.org which would be a good place. They have a forum. It seams fairly active, although I've never really spent much time there.
thanks for the input,
i know about rhinoscript.org, but it's been a while since i stopped by. i actually thought it was more or less dead, but i see now that it still kicks.

cheers.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service