Grasshopper

algorithmic modeling for Rhino

Hi Guys!

I got a small problem with my Tree in C#. I want to cull the Last item in a given Path but its not working. Does anybody know the answer to my question?

Thanks in advance

Views: 737

Attachments:

Replies to This Discussion

Here is my Code
    double hohe = bZ * (Math.Tan(54 * (Math.PI / 180)) );

    double hoheK = (bZ / 2) * (Math.Tan(9 * (Math.PI / 180)) );
    DataTree<Point3d> Tmo = new DataTree<Point3d>();
    Point3d[,] mO = new Point3d[aZX, aZY];
   
    for(int i = 0;i < aZX;i++){
      for(int j = 0;j < aZY;j++){
        GH_Path pthMO = new GH_Path(j);
        if(j == 0){
          Point3d MO = new Point3d((bZ / 2) + (bZ * i), (hohe - hoheK), 0);
          mO[i, j] = MO;
        }
        else if(j % 2 != 0){
          Point3d MO1 = new Point3d((bZ * i), (hohe * (j + 1) - (hoheK * (j + 1))), 0);
          mO[i, j] = MO1;
        }
        else{
          Point3d MO2 = new Point3d((bZ / 2) + (bZ * i), (hohe - hoheK) * (j + 1 ), 0);
          mO[i, j] = MO2;
        }

        Tmo.Add(mO[i, j], pthMO);

      }

    }

    Tmo.Path(0).CullElement();
    _MO = Tmo;

Nobody can help me?

Trees are dictionaries of paths and lists. When you say you want to cull the last item in a given path, does that mean removing the last index in a path, or does it mean removing the last item in the list that is associated with the path?

input:       {0;0;4;2} (A, B, C, D)

output 1    {0;0;4;2} (A, B, C, D)

output 2    {0;0;4;2} (A, B, C, D)

--

David Rutten

david@mcneel.com

Thanks for your reply!

I have a tree with variable amount of paths (in the code j). in each path is a variable long list of points(in the code i).

i solved my problem with TreeThatIWant.Branch(PathIWant).RemoveAt(ElementiWant);

is this the right way to do it or is there a better way?

thanks

Lukas

That's an excellent way.

--

David Rutten

david@mcneel.com

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