Grasshopper

algorithmic modeling for Rhino

Hi all,

I'm wondering if there is a way to bake items to a specific layers, created within a custom component. I have used the following code, but the problem here is that it bakes to the new layer on the initial solution computation. Then it repeatedly bakes to the default layer at each consecutive computation. Thus, I'm left with multiple copies of the initial geometry(one geometry on the new layer and N geometries on the default layer).

What I would like to do is add N layers, then bake N lists of geometry to each layer, only once (when I tell the component to bake). Is there a way to write this into a custom component?

Dim lay_index As Int32 = doc.Layers.Find(lay, True)
If (lay_index < 0) Then
lay_index = RhinoDoc.ActiveDoc.Layers.Add("myLayer6", Drawing.Color.Blue)
End If

Dim att As New DocObjects.ObjectAttributes()
att.LayerIndex = lay_index


A = doc.Objects.AddBrep(x, att)

I read the Custom Bake discussion, but I am not sure whether or not I need to create my own data type.

Views: 518

Replies to This Discussion

usually baking components incorporate a boolean input, so that the component only bakes when the value is true. If your boolean input is called bake:

if bake Then

Dim lay_index As Int32 = doc.Layers.Find(lay, True)
If (lay_index < 0) Then
lay_index = RhinoDoc.ActiveDoc.Layers.Add("myLayer6", Drawing.Color.Blue)
End If

Dim att As New DocObjects.ObjectAttributes()
att.LayerIndex = lay_index


A = doc.Objects.AddBrep(x, att)

End If

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service