Grasshopper

algorithmic modeling for Rhino

Hi...

I'm trying to make grasshopper component, using grasshopper sdk.

and need to use array,..

So, I found List. toarray, and I tested in VB Component, and it works well.

But,

Could'nt make Component,..

 

Protected overrides sub registerinputparams~

pmanager.register_doubleparam("double","d","double")

pmanager.register_pointparam("point","P","point3d")

end sub

 

...

Protected overrides sub solveinstance~

dim dbl as List(of double)

dim ptl as List(of rhino.geometry.point3d)

if (not DA.getdata(0, dbl)) then return

if (not da.getdata(1, ptl)) then regurn

pt=ptl.toarray

db=dbl.toarray

 

crv=rhino.geometry.nurbscurve.createinterpolatedcurve(pt,3)

da.setdata(0,crv)

 

 

 



Views: 679

Attachments:

Replies to This Discussion

Hi Daniel,

 

if your input parameters need to behave as list parameters, you need to change both RegisterInputParams() and the Da.GetData() calls. Basically when you get lists from the input then the data iteration is very different, so Grasshopper needs to know in advance if you're planning on doing this.

 

Protected Overrides Sub RegisterInputParams~

  pManager.Register_DoubleParam("double","d","double", GH_ParamAccess.list)

  pManager.Register_PointParam("point","P","point3d", GH_ParamAccess.list)

End Sub

 

then

 

  Dim dbl As New List(Of Double)

  Dim ptl As New List(Of Point3d)

  If (Not DA.GetDataList(0, dbl)) Then Return

  If (Not DA.GetDataList(1, ptl)) Then Return

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Dear, David

Thank you very much,,..

Input Paramater works well.

 

But, OutPut parameter was different.

Protected Overrrides Sub Register OutPutParams~>>>

pManager.Register_DoubleParam("double","d","double", ""not possible to write here"")

pManager.Register_PointParam("point","P","point3d", ""not possible to write here"")

Is there any more to modify?

 

I can retrofit the data layout of outputs, so there's no need to set the access type. All you have to do is either call

 

DA.SetData()

 

or

 

DA.SetDataList()

 

depending on what you want to output.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service