Grasshopper

algorithmic modeling for Rhino

What does that mean?!

I just want to shift some data in trees and then flip Matrix...?!?

Ideas?

Views: 6724

Attachments:

Replies to This Discussion

Flip matrix requires that the datatree is synonymous with a 2D matrix, in which rows and columns may be swapped. If your data-tree is more complicated than that, Flip Matrix will not work.

A 'locus' a specific location. In this case, it refers to the numbers that are part of a data-tree path list. For example, the path {0;0;3} has 3 loci. The path {0;0;3;1;2;6} has six loci. When you want to flip a data-tree using Flip Matrix, then all the paths can only differ at a single locus, thus:

{0;0;0}

{0;0;1}

{0;0;2}

{0;0;3}

is fine because only the third locus differs. If the tree is more complex:

{0;0;0}

{0;0;1}

{0;1;0}

{0;1;1}

then Flip Matrix doesn't understand which rows and columns to flip.

You'll have to use a Path Mapper to solve this problem I think.

--

David Rutten

david@mcneel.com

Tirol, Austria

Hey, thank you very much, 

but i cannot get this to work.. what i want to do is, remove one row of points each side of this panels (screenshot) so my idea was to simply shift list... 

But i do not know what to do with that path mapper.. Can you help me out?

Thanks!!!

Path Mapper is quite a complicated object, but it is incredible powerful. It can mimic a lot of other datatree operations (Flatten, Graft, Reverse List, Renumber Paths, Shift Paths, Flip Matrix, ...)

The idea of a Path Mapper is that you write a representation of what you have now and then another representation of what you're after. For example, let's say that you have paths containing 4 elements and you want to reverse the order of them:

{0;0;0;0}     ->   {0;0;0;0}

{0;0;0;1}     ->   {1;0;0;0}

{0;1;0;2}     ->   {2;0;1;0}

{0;1;0;5}     ->   {5;0;1;0}

You can encode this operation in a Path Mapper, using notation like this:

{A;B;C;D}  ->   {D;C;B;A}

Removing the last elements in those paths will look like this:

{A;B;C;D}  ->  {A;B;C}

Removing the first and last elements:

{A;B;C;D}  ->  {B;C}

Flattening:

{A;B;C;D}  -> {0}

As you see you don't have a choice when it comes to the part before the arrow. That always has to represent the existing layout. You can choose the name of the variables, it doesn't have to be A, B, C etc. but beyond that your hands are tied.

However on the right hand side you have lots and lots of possibilities. See Danny's awesome tutorial here.

--

David Rutten

david@mcneel.com

Tirol, Austria

Thank you very much!!!

it worked!

That's it! Thanks for posting. Glad I finally went looking for this.

David - Flip Matrix should absolutely be able to do this. It should know to work with only the last layer of branches and their lists. If there are A, B and C, it should flip B and C, as this path mapper (shown above) does. If there are A, B, C, and D, it should flip C and D. Using explicit mapping in Path Mapper to solve this is not as smart a solution because it can't scale / will break if more branches of data are added.

Also on this subject, Shift Paths should flatten list when left with only one branch instead of failing. When you switch from dealing with say, three panelized surfaces to one, your entire GH script should not fail without switching out Shift Paths components with list flatteners. Both of these issues are the key hold ups preventing GH from effectively dealing with lists of lists. As it is now, it does not deal well with them.

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