Grasshopper

algorithmic modeling for Rhino

Hi ALL

Is it possible to colour text? by text I mean "taged" text. Imagine I have a list of cicles colored by a gradient depending on their position, and I want to add text to each circle (Tag3d works fine) but color the text with the same color as the circle....?

is that possible?

Views: 1348

Replies to This Discussion

Sorry to insist... theres any way of coloring text in GH?

many thanks in advance
Hi Pep,

I think you're out of luck. The tag components don't allow colour overrides.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Ok, thanks, is good to know.
Hey David, another question related. Having a list of objects (circles) from rhino, each with different color. How can I get the color of each circle to apply it later to the text .

I have very little scripting skills, and I thought there should be something like .GetColor or .getAttibutes.color.

Any help on thet would be appreciated

thanks
Pretty tricky to do it right. Object colour can come from multiple sources. Typically objects derive their display colour from the layer they are in. Sometimes they derive the colour from the parent object, and sometimes they override the colour themselves.

You have to dig through the MRhinoObjectAttributes class that comes with every MRhinoObject. Find the ColourSource() property and then extract the appropriate colour.

If you know you'll only deal with objects which have per-object colours, then it becomes somewhat easier:

Dim obj As RMA.Rhino.MRhinoObject =
Dim color As RMA.OpenNURBS.IOnColor = obj.Attributes().m_color


--
David Rutten
david@mcneel.com
Poprad, Slovakia
Hi David, many thanks for your time and help. I kind of understand the procedure, but as I said, scripting is not my best quality, and it does not output anything... As input I have a list of cicles created in rhino with 4 different colors. As output I would like to have:

a// 4 lists, each with all the circles with the same color

or

b// a list of the colours of the circles.

Thanks in advance, and waiting to finish my sutides (very soon) to start learning programming more seriuosly :)

Thanks and enjoy this days,
Ok, you have to get the GUID of the object you're referencing, otherwise you won't be able to retrieve the Attributes of the object in question:


In the image, the rectangles are Rhino curves and the spheres are made by Grasshopper.

The code inside the VB component is:

Dim obj_id As Guid = DirectCast(id, Guid)
Dim obj_ref As New MRhinoObjRef(obj_id)
Dim col As IOnColor = obj_ref.Object().Attributes().m_color

A = Color.FromArgb(col.Red(), col.Green(), col.Blue())

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thank yuo very much David, no way I would figure it out myself. Many 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