Grasshopper

algorithmic modeling for Rhino

Hi,

I try to make an animation of pipes growing perpendicular from a surface using Giulio Piacentino render animation tool. The surface (a box for now) should have a different color then the pipes.

When assigning the geometries to the renderAnimation tool, every second pipe had the same material as the box. I modified the code a bit adding this lines

    for(int i = 0; i < geometry.Count; i++){

      Rhino.DocObjects.ObjectAttributes att = new Rhino.DocObjects.ObjectAttributes();

      int nwMat;

      if (material.Count > 0)
      {
        int ding = i;
        if (ding > 0)
        {
          ding = 1;
        }
        else
        {
          ding = 0;
        }

        //object origin = material[i % material.Count];
        object origin = material[ding];

As a result, the box (must be 1st object) has the first material/color in the list, everything else (the pipes) gets the 2nd material assigned.

This works for this case, but if there are different objects with different materials, this might not work. Is there a smart way to do this, like giving objects a material tag?

Views: 861

Attachments:

Replies to This Discussion

wrong GH file

Attachments:

Hi Harald,

I'd say it is possible to do this without modifying the script (you can duplicate the color data the right amount of times in advance) but I'd need a little more information to me more helpful.

Could you please post a sample file?

Thanks,

- Giulio
_____________
giulio@mcneel.com

Hi Giulio,

I posted the right file now.

Duplicating the color data was my first idea, too. I tried this, but it didn't work the way I wanted, but this was before I flattened the "pipe tree" I got from the move component.

Btw, if I don't flatted the tree and merge the objects as I do now, the script returns first the box, the first column of pipes, then the second, etc. They have never rendered altogether as they do now. That was the reason to look into the code.

Thanks.

Harald.

Mh... I am a little confused... am I supposed to add some geometry?
Is there a Rhino file that goes with this?

- Giulio
_____________
giulio@mcneel.com

No Rhino file. Just open the GH file and activate the timer top left. The pipes will grow from two surfaces. Max length of the tubes is set mid left in the lower group, the panel on the left of the upper group sets the number of frames.

btw. the interval scripts doesn't stop the animation always; I put 200 frames and it didn't stop.

-H.

Hey Harald,

did you manage to find a way attaching different materials to different geometries?

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