Grasshopper

algorithmic modeling for Rhino

Since this should have been a new discussion right from start, I gather the previuos.

What has been discussed so far:

Delete

Hi,

can someone please tell me how to mod Giulio´s latest bakeAttribute, so it also sets a specified layercolor?

Thanks,

Phillip

Hi Phillip

if possible, you should try to modify layer colors independently from baking. A layer can have only one color, but many objects.

To modify a layer color, use something along these lines:

if(!string.IsNullOrEmpty(layer) && !color.IsEmpty)
{
      int n = RhinoDoc.ActiveDoc.Layers.Find(layer, true);
      if(n < 0) return;

      Rhino.DocObjects.Layer l = RhinoDoc.ActiveDoc.Layers[n];
      l.Color = color;
      A = l.CommitChanges();
}

Can I also ask you to start a new discussion next time?
I hope this helps,

- Giulio

 

Views: 812

Attachments:

Replies to This Discussion

Thanks Phillip for posting everything about this discussion. By now it was happening a little bit everywhere :)

This line changes the color of the layer before it was added to the document:

onlayer.Color = color;

And these update the color of the layer:

Rhino.DocObjects.Layer onlayer = layerTable[layerIndex];
onlayer.Color = color;
onlayer.CommitChanges();

Together, this becomes the attached file.

I hope this follows the specs,

- Giulio
_________________
giulio@mcneel.com

Attachments:

Hi Giulio,

Great!

Just as my guess - the right word in the right place.

Impossible for me though to figure it out myself, especially the second part.

I really need to get more into this.

Thanks a lot! (And thanks for the dedicated filename, hehe.)

Best,

Phillip

Hi Giulio, 

Just wanted to say Thank you for the latest bakeAttribute tool, it has been very very helpful.  

Your a legend 

Chris

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service