Grasshopper

algorithmic modeling for Rhino

if x= range between two variables then x= ....  

For x=i to i-1

 if x= [1.05*Y,0.98*Y] , then x=y

x is variable as a graft ( 0.99,1.522,3.98)

y is variable as flatten (1 ,1.5,4)

ex

if (x=0.99) = [1.05*1 0.98*1] then choose x=1

else

if (x=1.522) = [1.05*2 0.98*2] then choose x=1.5

else

if (x=3.98) = [1.05*4 0.98*4] then choose x=4

how can write like this in visual basic 

Views: 534

Replies to This Discussion

I don't understand that pseudocode (is it pseudocode?). What do the different brackets signify? What values is this loop supposed to iterate over For x=i to i-1 ?

OK I have list as shwon

x = 1,5,6.5 , ........ since x is width of door

z= 2.2 , 2.3 , 2.5 , ...... height of door

i have many of door  

x actual = 0.95 , 4.96 , 6.45 ........  

i want that , if xactual = 1.05X to .95x choose X 

Hi Mostafa, if I understood correctly, I think you mean to round your values to an increment of a certain step size, for example:

Let me see if I understand. You have a collection of numbers and these numbers are all over the place. Then you have a small set of special numbers, and you want to 'round' all the random numbers to the nearest special number, but only if it's really close already, ie. within 5%.

Is that correct?

Private Sub RunScript(ByVal x As Double, ByVal s As List(Of Double), ByVal L0 As Double, ByVal L1 As Double, ByRef y As Object)
  For Each specialNumber As Double In s
    Dim limit0 As Double = L0 * specialNumber
    Dim limit1 As Double = L1 * specialNumber
    If (x >= limit0 AndAlso x <= limit1) Then
      y = specialNumber
      Return
    End If
  Next

  y = x
End Sub

Attachments:

yes , thanks sir for ur help and i appreciate that

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service