Grasshopper

algorithmic modeling for Rhino

Hi guys,

I am trying to rotate a line within a loop but found out the rotate command asks for sinus and cosinus instead of an angle (please see below). Would you know why?

Also I noticed that if I skip the second argument within the method it still works, how would one know if an argument is optional ? 

Cheers,

Arthur

 

Views: 1202

Replies to This Discussion

Hi Arthur,

 

there are 5 methods with the same name ("1 of 5"). They are called overloads.

If you click on the yellow label you'll see the rest of them. Also if you push Ctrl+Shift+Space the label should appear, and you can use arrows up and down to scroll.

 

- Giulio

Thanks a lot Giulio,

Very helpful!

 

Sorry Giulio would you know why the following loop does not generate multiple lines but just a single one?

 

Many thanks,

Arthur

 

 

Got it i think :)

 

Private Sub RunScript(ByVal x As Point3d, ByVal y As Point3d, ByVal z As Double, ByVal u As Integer, ByRef A As Object, ByRef B As Object)

'declare line
Dim ln As New Line(x, y)

'Declare the list
Dim lines As New List(Of Line)(u - 1)

' Add End point
Dim endpt As New list(Of Point3d)(u - 1)

'loop
Dim i As Int16

For i = 1 To u - 1


'rotate line
ln.Transform(transform.Rotation(z * i, vector3d.ZAxis, ln.from))

'add line
lines.add(ln)

'add endpt
endpt.add(ln.To)

Next

A = lines
B = endpt

Nice!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service