Grasshopper

algorithmic modeling for Rhino

Selecting specific items in list and their inverse

Hi everyone.

I'm trying to recreate this model in an algorithmic way in Grasshopper. Mainly the boxes that are sometimes rotated.

What I'm able to do is create a row of boxes and rotate one, then move the others so they don't overlap. I'll attach my current files to this post.

What I can't seem to figure out how to do is how to select several of them to rotate and moving the rest to be in the correct position.

Is there a better way of going about this?

Is there a way to generate a sequence with a pattern, like: true (rotated), false (not rotated), false, true, false, etc.? And then to say: if the current item is false, but the previous was true, then move it by a certain amount?

I'm pretty new to Grasshopper, so any advice you can give would be great.

Thanks!

Views: 581

Attachments:

Replies to This Discussion

You don't need a Rhino file for the origin point.

If I understand you correctly, here's a way:

The yellow panel contains a list of rotation angles (in degrees).  That could be replaced by a series of control knobs but note that "0" must be specified for boxes that don't rotate.

A copy of the original box is rotated in place at the origin for each angle in the list.  Then a bounding box for each rotated copy is used to determine its new resulting X dimension.  The 'Pr (Partial Results)' of 'MA (Mass Addition)' is used to create a series of destination points.  The bottom face of the 'BBox' is used to get the four bottom vertices, which are sorted by X.  The minimum X value is used to calculate how far each box needs to be moved (the difference between its destination point and the minimum X value).

Attachments:

Instead of this (rotation in XY plane with arbitrary angles):

You probably want this?  Rotation in XZ plane at 0 or 90 degrees?  Minor change:

Attachments:

Oops!  The last "destination point" needs to be removed because it creates a duplicate of the last box (due to the fact the first point (0,0,0) has to be inserted...).

I did this earlier but lost it.  Fixed code attached.  'Shift offset (S)' = -1, 'Wrap (W)' = False.

Attachments:

Hi Joseph,

Thank you so much for these incredibly detailed responses. I'm going to try my best to understand what you did here so I can use it properly.

The point sorting is more complex than it needs to be - wandered into the weeds there for no reason.  This is simpler and does the same thing:

Attachments:

Better yet!  Code review and optimization makes it simpler.

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service