Grasshopper

algorithmic modeling for Rhino

how can I use, "MeshVertexColorList.SetColor Method (MeshFace, Color)" ?

Hi guys,

i tried, setColor Method with (MeshFace, Color)

-------------------------------------------------------------------

  private void RunScript(Mesh x, object y, ref object A)
  {

    Rhino.Geometry.Mesh mesh = new Rhino.Geometry.Mesh();

    mesh.Vertices.Add(0.0, 0.0, 1.0); //0
    mesh.Vertices.Add(1.0, 0.0, 1.0); //1
    mesh.Vertices.Add(2.0, 0.0, 1.0); //2
    mesh.Vertices.Add(3.0, 0.0, 0.0); //3
    mesh.Vertices.Add(0.0, 1.0, 1.0); //4
    mesh.Vertices.Add(1.0, 1.0, 2.0); //5
    mesh.Vertices.Add(2.0, 1.0, 1.0); //6
    mesh.Vertices.Add(3.0, 1.0, 0.0); //7
    mesh.Vertices.Add(0.0, 2.0, 1.0); //8
    mesh.Vertices.Add(1.0, 2.0, 1.0); //9
    mesh.Vertices.Add(2.0, 2.0, 1.0); //10
    mesh.Vertices.Add(3.0, 2.0, 1.0); //11

    mesh.Faces.AddFace(0, 1, 5, 4);
    mesh.Faces.AddFace(1, 2, 6, 5);
    mesh.Faces.AddFace(2, 3, 7, 6);
    mesh.Faces.AddFace(4, 5, 9, 8);
    mesh.Faces.AddFace(5, 6, 10, 9);
    mesh.Faces.AddFace(6, 7, 11, 10);

    mesh.Compact();

    mesh.VertexColors.SetColor(mesh.Faces[0], Color.Black);

    A = mesh;

  }

-------------------------------------------------------------------

but it seems, it doesn't work.

I can't see any change of color.

what did I wrong?

Thanks!

Views: 2036

Replies to This Discussion

You must assign an equal amount of colours as vertices otherwise the colours will be ignored since they make the mesh invalid.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thanks for answers.

but in SDK

http://www.rhino3d.com/5/rhinocommon/html/M_Rhino_Geometry_Collecti...

I see, i can assign a one face with using single color.

Is the Text in SDK wrong?

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