Grasshopper

algorithmic modeling for Rhino

Hey guys,

This is the first time I couldn't find a solution in the forum, so I'll just go ahead and ask you guys!

I have the following statements I want to implement:

If 0≤x≤30 y=0.8

If 30<x<60 y=[0.8*(60-x)]/30

If x≤60 y=0

I tried with an expression, but the count of arguments is obviously too high, so I'll jsut add a screenshot of how far I've gotten, although it's fundamentally wrong.

http://gyazo.com/15fa63823ebc697f644dac765192570f

It' s also crucial, that the result(y) can be connected to an expression afterwards, since it's for some structural calculations of a truss. By changing some parameters on the truss (e.g. height, number of points etc.) the angle(x) will differ and therefore change all following calculations.

Thanks in advance!

EDIT: If necessary I'll add the GH file, but it's gotten pretty big with some Karamba and Robot stuff, making it quite chaotic to some extent.

Views: 1627

Replies to This Discussion

You don't have to write x=true in the if statement. If X is a boolean value it can be used directly.

To put all of the above into a single (albeit horribly unreadable) statement:

If(x <= 30, 0.8, If(x < 60, (0.8*(60-x))/30, 0)

It's not quite the same as your three statements, but your statements are contradictory. They are undefined for when x is less than zero or more than 60, and the third statement covers both previous statements. Was it supposed to be:

If x>=60 y=0

?

Thanks! I guess I made it far more complicated than expected.

As for what you mentioned, I made a simple mistake when stating my problem:

If 60≤x y=0 instead of If x≤60 y=0

 

Since this project is about a truss for a roof structure, the angle should never end being below 0.

But thank you for your help, this makes everything nice and easy, far easier than expected actually!

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