hink you need recursion to modify the random seed; many other ways to accomplish that (use the length of each curve as the seed, for example).
Using multiples of twelve makes it harder for me to grasp the essence of the matter; another way of looking at it is that you want to generate random integers from 2 to 5 (24,36, 48 and 60) and have them add up exactly to curve lengths of 5 (x12=60), 9 (x12=108) or 14 (x12=168).
So you want to generate random numbers until their sum ('Mass Addition') plus 5 is equal to or greater than the curve length (5, 9 or 14). The last number in the series is then not random but just the difference between the two.
For example, for curve length = 5 (x12=60), there are only three possible numbers that can be used as the first in the sequence: 2, 3 or 5. If it's 5, you're done. If it's 2, the second number is 3 (5-2), if it's 3, the second number is 2 (5 - 3). You can't use '4' at all because the remainder, 1 (x12=12) isn't one of your solution options.
There is no point in generating the last number randomly, eh?
P.S. You didn't use 'Internalize data' for the 'Curve (Crv)' param in your GH file.…
Added by Joseph Oster at 2:29pm on September 12, 2015
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
should not be open).
3. All releases of Rhino 5, Arduino, GH, and FF are the latest as of May 21st.
I Boolean toggled the port open, but I can't seem to get any output to display from the UnoRead component. I was hoping to see values from any of the analog inputs (APin5 depicted) connected as info gets sent back and forth between the Arduino and my comp. I'm getting simultaneous "Hooray" and "Whoops" messages, and I can't pinpoint why. See attached JPG.
Does it have to do with the fact that I have a list of COM ports? Even though I know COM 3 is the correct one as defined in the IDE, do I need to re-declare it in Grasshopper as well? Does the {0} shown impact this output?
Any direction is appreciated.
Thanks - JFig
…
The best way is to use a C# or a VB component to transpose these
lists. I think in C# you can use transpose directly. You can ask this
on the VB/C# forum on our new website, www.grasshopper3d.com
- Scott
On May 27, 3:56 am, Tonsgaard wrote:
> Being a long time user of Generative Components trying to use
> grasshopper i miss the "transpose" command.
> I have a point list like this:
>
> 0, 1, 2, 3, 4, 5
> 0, 1, 2, 3, 4, 5
> 0, 1, 2, 3, 4, 5
> 0, 1, 2, 3, 4, 5
> 0, 1, 2, 3, 4, 5
>
> and a want to transpose dimensions to:
>
> 1, 1, 1, 1, 1
> 2, 2, 2, 2, 2
> 3, 3, 3, 3, 3
> 4, 4, 4, 4, 4
> 5, 5, 5, 5, 5
>
> Surely I am not the first in need of this...
> how would i go about and do this...? I suppose its quite easy in VB
> script, but being used to GC's C# like language, I kinda dont know how
> to do this...
>
> thanks...
>
> Tonsgaard…
onsecutive points at the same height then your 'Break at discontinuities' component eliminates the middle point completely and then the 'Interpolate Curve' component gives a much bigger bump in the wrong direction. This was enough to get curves to meet from opposite sides.
I fixed this by changing the heights to 1.1 or 2.9, rather than 1.0 and 3.0, but it took a little while to work it out! Sigh.
I attach a new version. But I actually preferred it as it was before. See what you think!
Bob
p.s. in the first list, elements 11, 12, 23 and 24 go from 1 to 3; elements 17 and 18 go from 3 to 1. In the second list, elements 6, 17, 18 and 29 go from 1 to 3; elements 12 and 23 go from 3 to 1. Given the above fix, these can be easily seen.…
Added by Bob Mackay at 10:40pm on November 24, 2015