) function if you've already got a boolean value.
This expression:
x < 12
results in exactly the same things as this expression:
If( x < 12, True, False )
If() is only really useful when you want to return non-boolean data, like so:
If( x < 12, x, 100-x )
In this case, the expression will return either x, or 100-x if x is larger than or equal to 12:
x result
1 1
2 2
10 10
11 11
12 88
13 87
14 86
18 82
70 30
--
David Rutten
david@mcneel.com
Poprad, Slovakia…
Added by David Rutten at 7:22am on August 10, 2011
ggle A
7. Toggle A
8. Toggle 2
9. Toggle 3
10. Toggle A
11. Toggle A
12. Toggle 3
I was thinking to use somehow slider and animate option....but without luck
Any idea would be appreciated…
Here it the RhinoScript that I am using:
'Option Explicit
'Rem Script written by Giulio
'Rem Script version lunes, 10 de noviembre de 2008 21:00:00
'Rem This script is licenced to you under the conditions shown at
'Rem http://www.giuliopiacentino.com/this/
Call Main()
Sub Main()'starts command
Dim arrLfStart(),arrRxStart(), arrLfEnd(), arrRxEnd(), arrLinks(), i 'sets intergers
Dim links: links = 36 'number of cylinders (links)
ReDim arrLfStart(links), arrRxStart(links), arrLfEnd(links), arrRxEnd(links), arrLinks(links) 'combines integer with number
Dim angleDist:angleDist = Rhino.PI / 10
For i=0 To links 'sets integer
'The following sets the path
arrLfStart(i) = Array(Cos(i-angleDist)*3 + Cos(i*12)*12, Sin(i-angleDist)*3 + Sin(i*12)*12, i*5)
arrRxStart(i) = Array(Cos(i+angleDist)*3 + Cos(i*12)*12, Sin(i+angleDist)*3 + Sin(i*12)*12, i*5)
arrLfEnd(i) = Array(-Cos(i-angleDist)*3 + Cos(i*12)*12, -Sin(i-angleDist)*3 + Sin(i*12)*12, i*5)
arrRxEnd(i) = Array(-Cos(i+angleDist)*3 + Cos(i*12)*12, -Sin(i+angleDist)*3 + Sin(i*12)*12, i*5)
'The following adds cylindars according to specified points
Call Rhino.AddCylinder(IntraPts(arrLfStart(i), arrRxStart(i), 0.5), IntraPts(arrLfEnd(i), arrRxEnd(i), 0.5), 0.5)
Next
'The following adds surfaces to the path
Call Rhino.AddLoftSrf(Array(Rhino.AddInterpCurve(arrLfStart), Rhino.AddInterpCurve(arrRxStart)))
Call Rhino.AddLoftSrf(Array(Rhino.AddInterpCurve(arrLfEnd), Rhino.AddInterpCurve(arrRxEnd)))
End Sub
Function IntraPts(byRef p1, byRef p2,byRef n)
'Rem This function gives the first point out if you use n=0,
'Rem with n=1 it gives the second point.
IntraPts = Array( p1(0)*(1.0-n)+p2(0)*n, p1(1)*(1.0-n)+p2(1)*n, p1(2)*(1.0-n)+p2(2)*n )
End Function
I know that the script works in RhinoScript. If anyone could help me out I would appreciate it.…
Added by Adam Smith at 1:57pm on September 9, 2010
e input says that a value of 12 should equal 12 PM, but it seems to be showing 11 AM instead. I checked this against Diva, in case I had just forgotten how to read a sun path diagram :P I've attached the sunpath from ladybug and diva, both were set to June 21 at 12 pm. As you can see Ladybug is one hour earlier. Seems to be a bug, and can be dealt with by simply changing the inputs to account for it, but it's misleading that the input says one thing and does another.
Thanks!…
pen Brep"; I didn't know it worked on flat surfaces. And I think it's only fair to include in your benchmark the considerable time 'SUnion' takes in this example: 21.9 seconds for 121 rings and likely much more with 400 or 1,000+ rings.
Then I noticed the pattern doesn't match. Checked the circles and they are the same. The distance between them, however, is different: 7 instead of 6. When I change that value to 6, the Python fails badly. All the holes and gaps are gone, which destroys the pattern:
I can't do the "two phase" approach on an 11 X 11 grid, but I can do 6 X 6 and 2 X 2 to get a 12 X 12 grid (40 'SUnion' operations) in 28 seconds total. That beats your benchmark of ~37 seconds for an 11 X 11 grid, if you include the 'SUnion' in your code.
…
thank you very much for your reply pieter,I'm wondering if there were more than 3 expressions how will it be?I mean if it was X, X+12, X+24, X+36 and more...and that depended on a slider.