Grasshopper

algorithmic modeling for Rhino

Hi to all,

I know how to place a normal component by the InstantiateNewObject() Method, but I don't get it how to call a Panel or an other "Primitive" (like boolean, integer, number, ...)-Component.

Hope somebody can help me.

Nice greets

Alex

Views: 1465

Replies to This Discussion

the problem is this:

Instances.ActiveCanvas.InstantiateNewObject(panel.ComponentGuid, "Test", attachmentpoint, False)

You're using the overload which takes an ID, but that one creates its own instance of GH_Panel because it doesn't know you've already made a panel of your own.


''1. Declare the bounds component as GH_component
Dim lastComponent As IGH_Component = TryCast( actdoc.Objects.item(1), IGH_Component)
If (lastComponent Is Nothing) Then Return

''2. Declare the upper Input as IGH_Param
Dim lastParam As IGH_Param = lastComponent.Params.Input(0)

''3. Create a New Panel At Point 0,0
Dim panel As New Special.GH_Panel()
Dim attachmentpoint As New PointF
attachmentpoint.X = 0
attachmentpoint.Y = 0
Instances.ActiveCanvas.InstantiateNewObject(panel, "Test", attachmentpoint, False)

''4.Create a Connection between this two components( bounds(input(0)) and panel(output))
lastParam.AddSource(panel)

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thx a lot

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service