Grasshopper

algorithmic modeling for Rhino

i have basic knowledge in programming but not in C# or VB#, so i have the roots of basic logic programation 

i want to know if there's posible to emulate an IF - THEN - ELSE   situation to use it like a driver path in a definition

for example if line = 10 then the component put the value in an A Slot, else in SLOT B

i dont know if the idea its clear, the real issue is that, i'm working on a definition that if i pick multiple polylines the definition works very well, but if i pick just one polyline the definition doesnt work well because i need to flat something in the process, so 

with some basic logic i can drive if  i chose one polyline then flat if i chose multiple polyline then dont flat 

sorry for my crappy english 

Views: 10983

Replies to This Discussion

this can be obtained with "stream gate" component (sets->tree) and e.g. equal/larger/smaller component before.

If x is a lines(as items) input then

Scripted version :

Dim val1 as double = 12.00 'value 1

Dim val2 as double = 15.00 'other value

If x.lenght=10 then

A = val1

else

B = val2

End If


Copy and paste this code into vb  script component, then plug lines as x.

in my case i really need to flat or not flat a component depends if i choose one polyline or various polyline

is a kind of switch that i need to activate or deactivate something

something like this  

Have a look at the Dispatch Component used in conjunction with your Larger Than Component to make the Boolean Pattern.

really true Danny 
let me see if i grab it

thanks once again  

Danny works well the discrimination objective in your idea, but there's an error in the L input of the Shift Commponet its although B is null add a Branch to the shift so the shift move all 3 spaces i need that this null dont take in count in the shift. i dont know if you understad what i mean 

See image

 And...imposible Shift the list with one element.

Hey,

it is an old example, but I still ike it :-)

http://www.rhinocentre.nl/blog/gh/grasshopper-cabinet-intro/grassho...

Best Regards
DeDackel

I still wonder when control panel will return... It would be cool to customize it just like layout with layout editor :)

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