Grasshopper

algorithmic modeling for Rhino

hello forum. So many of the things I make are just dealing within the geometry of a subdivided surfaces panel. I'd like to understand how to connect points from panels in different rows to design shapes. any advice> I tried shifting lists which helps me move to one panel over but I'm not sure how to shift tree branches and how to add intelligence so that if there is no shape in the corresponding position it simply doesn't create the forms. see file and pic  the shape in blue is the shape I am hoping to make but all over the surface..thanks!.ethan 

Views: 872

Attachments:

Replies to This Discussion

This is very easy with code (directly accessing/manipulating data trees etc etc) and ... er ... a bit "weird" with GH components. Additionally using "crude" ways (say: try{this} catch{that}) you can deal with conditions (occurring in the "outer limits" of your collections) that otherwise require an extensive bunch of what-ifs and take-this-while-not-take-that.

Notify if you want a C# example on that matter (but if you are unfamiliar with that kind of stuff this could/may be totally useless to you)

Peter thanks for your reply. Yes I would like a C# example if its not too much trouble... To be sure I understand you correctly: its the error checking that's a gh challenge, but how about just shifting the tree branch? I know how to shift a list but is there a way to shift a tree branch? Thanks! e

Consider 4 lines that share a common point and are stored in some tree (each branch contains the lines). Our task is to calculate the angles between the pairs:

 

... blah blah code above

for(int L = 0;L < 4;L++){               // --------------------------- for each pair
            Line L1 = wLines.Branch(surf, u, v)[L];
            Line L2;
            try{  L2 = wLines.Branch(surf, u, v)[L + 1];}
            catch{ L2 = wLines.Branch(surf, u, v)[0];}

            double angle = Vector3d.VectorAngle(L1.Direction, L2.Direction);

            double angleOUT = angle;
            if(degrees) angleOUT = RhinoMath.ToDegrees(angle);

            anglesDT.Add(angleOUT, new GH_Path(surf, u, v));
          }

... blah blah code below

It's obvious that we reach the end of the list with this way ... but the catch takes care for us.

This obviously is a very naive example: for some rather more complex "I-don't-care-because-I-am-crude" examples exploit the C# here:

http://www.grasshopper3d.com/forum/topics/gone-in-10-milliseconds-t...

more soon.

BTW: as regards the "gone-in-xxx" case, I'm talking about that kind of "out of limits error handling approach" (crude but points are few and thus .. why bother?).

So ...  we are "shifting" branches here by trying to "inquire" a tree (with a variety of ways depending on the active  "panel mode") without taking care about if we reach the "outer limits" of our collections. This "technique" is rather suitable for your case as well (otherwise a BIG set of ifs should been used especially if the desired "patterns" of yours are complex).

more, soon

If the tree is just a list of a list (2 levels):

Flip matrix > shift list > flip matrix > continue

Otherwise with Relative Item (RelItem) component:

Set true to wrap Paths and Items (Wp & Wi)

the output at "B" will be just a new tree shifted by the offset given in "O"

maybe this will help too:

http://www.grasshopper3d.com/forum/topics/relative-items-for-two-data

http://www.grasshopper3d.com/forum/topics/relative-item-component-b...

Also, if you want to work just with points, rebuild your list of points:

flatten all points > cull points (leave one) > partition points (lenght of list = number of x cells + 1)

So you can work with a simple (2 level) tree.

OK, I had a very limited amount of time for this  ... but get a prelude and wait for the usual (chaotic) update(s).

A very simple pattern (an arrow) is "extracted" from a pool of data by shifting branches, items, cats and dogs. This "pattern" can be anything actually: some Brep made with some logic, some lines, some truss module, some holes in the surfaces ... anything.

Spot the way that the function "inquires" the tree without asking too may questions about if these "index shifts" are valid or not. 

best, Peter

Attachments:

Thank you Peter! and Riccardo! I will study these solutions tonight> I really appreciate the guidance... always more to learn :) e

Get the V2 (not that different, except that the option 2 added could yield a "truss" like collection with some lines of code more - as it is it's just for fun). I left the 1st function as it was for easy understanding  (2nd is a bit more "structured")

Attachments:

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