Grasshopper

algorithmic modeling for Rhino

Objective: (simple and stupid)

 

Enter a list of programmatic square footage requirements, make cubes of the area for each program, and stack them vertically within the boundaries of a tower. Simple.

 

Problem:

 

Most program requirements fit easily on one floor, however areas too large for one floor need to be divided and stacked into multiple floors. I used a simple "IF" statement in a function to test for programs that are too large for one level, then assigned them the maximum square footage of one floor and used a "repeat data" to create a list that repeats this area until it equals the number of levels required to meet the program. The problem is that I can't find an easy way to get the data to repeat within the same list. Currently my only strategy is to dispatch lists and somehow insert a sub-list where the occurrences are.

 

Question: Can I write an expression that will repeat data at certain points and insert these new numbers within the output list? See pictures, that was probably worded confusingly.

 

The expression for the function is:  If(x>45*45, x=45*45, x)

Views: 1959

Attachments:

Replies to This Discussion

Hi Jon,

 

I added a Stack Data component for the next release. It's similar to Duplicate Data, except it allows you to specify per item how many times it should be duplicated:

 

 

You think this will be useful? If so, I can write you a VB script that does the same to tide you over until 0.8.0051 goes out.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

David,

 

Well done. That looks perfect. If it wouldn't take long to make the script, I would love to have it. Otherwise I can wait for the next version.

 

-Jon

10 lines of code. Imagine how powerful you'd be if you could script :)

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

 

Attachments:

Brilliant, that worked perfectly and looks very clean now. (Agreed, scripting could save me some headaches.)

Thank you,

-Jon

Hi people! My question is a little similar to the first question. If I have a list with zeros, I want to replace this zeros with the last non zero number in the list. I uploaded a simple example here

Thanks in advance!!!

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service