Grasshopper

algorithmic modeling for Rhino

i am doing an execise that is  convert the old version script into the GH 0.7

here is the original script


i try my best ,but still cannot convert the nurbscurves into ellipse

here is my script


Private Sub RunScript(ByVal x As Object, ByVal y As Object, ByVal z As Object, ByRef A As Object, ByRef B As Object) 

    

    Dim c_list As New list(Of nurbscurve)

    Dim P_list As New list(Of Point3d)


    For i As int32 = 0 To z

      Dim c As New Ellipse(plane.WorldXY, i / 2, i)


      Dim g As New NurbsCurve(c.ToNurbsCurve)


      g.rotate(y * i, New vector3d(0, 1, 0), New point3d(x, 0, 0))

      c_list.add(g)


      Dim e As New BoundingBox

      e = g.getboundingbox(False)


      p_list.add(e.Center)

    Next


    Dim polyline As New polyline(p_list)

    a = c_list

    b = polyline


  End Sub 


 

 To do the same thing is more easy in the old version

because i can't get the center of an ellipse directly 

how can i do  ???


thanks 

ceason

Views: 462

Replies to This Discussion

Dim c_list As New list(Of NurbsCurve)
Dim P_list As New list(Of Point3d)

For i As Int32 = 0 To z
   Dim c As New Ellipse(plane.WorldXY, i / 2, i)
   Dim g As NurbsCurve = c.ToNurbsCurve()

   g.Rotate(y * i, Vector3d.YAxis, New Point3d(x, 0, 0))

   c_list.Add(g)
   p_list.Add(g.GetBoundingBox(True).Center)
Next

A = c_list
B = New polyline(p_list)


--
David Rutten
david@mcneel.com
Poprad, Slovakia
Ah, you probably meant this:

p_list.Add(c.Plane.Origin)

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Better yet:


Dim c_list As New list(Of Ellipse)
Dim P_list As New list(Of Point3d)

For i As Int32 = 0 To z
   Dim p As Plane = Plane.WorldXY
   p.Rotate(y * i, Vector3d.YAxis, New Point3d(x, 0, 0))

   c_list.Add(New Ellipse(p, i / 2, i))
   p_list.Add(p.Origin)
Next

A = c_list
B = New polyline(p_list)



--
David Rutten
david@mcneel.com
Poprad, Slovakia
thanks, David
i had spent a lot time on this question.
before your answering , i never have a idea of (ellipse.plane.origin)
the syntax have a bit of change between the old and new GH .
UM~

ceason
Yes, the new SDK has been lovingly hand-crafted by the friendly, indigenous people of Washingtonia and Slovakia. The old SDK was written by a collection of python scripts that ate C++ code and spat out C++/CLI wrappers.

We wanted to create something that makes sense given the context of .NET, a lot of things are very different indeed.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
yes, i can find out the new syntax is more easy to know and handle than the old one
this is a very great change for us .

ceason

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service