Grasshopper

algorithmic modeling for Rhino

Hi all, 

I am starting to toy around with changing the appearance of GH elements beyond the typical red. I can certainly do this within GH itself with the custom preview, but I am trying to figure out where the methods for this sort of thing exist in the GH/Rhino libraries. To be clear, I'm not overly concerned with how things bake into Rhino, just how they appear in the GH preview. 

I apologize for my lack of programming knowledge, and potential use of the incorrect terms. 

Preemptive thank you! 

Views: 1525

Replies to This Discussion

Each component draws its own preview, and each component usually gets the settings out of the document (green for selected, red for normal, by default). This means it's quite difficult to change that default behaviour.

You can however invoke the preview logic of objects and provide your own settings. I attached a file which draws the wires of all objects whose preview has been disabled, using the object InstanceID as a key for the colour.

Update, both wires and meshes are now customised, and now using a random generator.

ps. updated again, moved custom argument constructor out of loop.

Attachments:

Thanks David, you rock!!!

So say my goal was to create a cube with each face having a different color. (These colors would not need to change once set initially).  I gather what you are saying is that this would take a lot more than my basic understanding of C# scripting.

You certainly can't use the default preview pipelines if you want to add functionality like that. You'll have to actually code up the entire display from scratch.

Fair enough. I'll either have to do some homework, or consider an alternative. Thanks a ton!

If you're happy to only draw previews for geometry inside your own component, that'll be relatively easy. It just means you'll have to add a component for each custom preview you want. The [Brep Topology] component draws breps with different colours per face.

Hmmm, that might be exactly what I am looking for. You da man! Thanks!

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