Creating a Box of Curves in Rhino

Ahhh!!! I’m super new to this whole python thing and ridiculously confused…

Any advice for the following prompt?
I really don’t know how to create a 3D ‘grid’ of lines…
((Subsequently, this may just be the death of me.))

Write a script that generates 300 curves that each have at least 5 random points. All the points of each curve need to be positioned within a box measuring 10 x 80 x 20 units.
Tip: I recommend that you create all 5 points in each iteration of a for-loop. You will need to store all 5 3D-points in one array to create the curve(s).

Well, a good way to figure this stuff out before you start coding is to write yourself a logic diagram or “plan of attack”… In this case, without actually writing your script for you, I would do the following:

The first thing is to be able to create one random point somewhere in the box.
Then do that 5 or more times
Then make one curve from the points
Then repeat all of the above 300 times.

Written that way, it looks pretty simple no?

So something like:

1. Create an empty list to store your points
2. Make a random function that can generate a number between 0 and 10. This will be your X coordinate. Store this in a variable, say, “x”.
3. Make another that can generate a number between 0 and 80 - your Y coordinate.
4. Make a third that generates a number between 0 and 20 for Z.
5. Use the 3 generators above to create one 3d point., store it in a variable.
6. Add that point to the list.

Now, create a loop that runs through the above 5 or more times, your list will have all the points.
Then, create a single interpolated curve through the 5+ points.

You’re almost done here… All you need to do now is enclose all of the above in another (outer) loop, and run that one 300 times. Presto!

Now all you need to do is translate the above into real code, using the syntax of whatever programming language you’re using.

HTH, --Mitch