Grasshopper

algorithmic modeling for Rhino

Beginner question: Software to write and run python scripts?

Hello all,

I have been visiting some pages that create art or objects with scripting, and I wonder what is being used to 1. Write the script 2. Run the script 3. make the pc generate the geometry.

These are some examples.

https://n-e-r-v-o-u-s.com/blog/?p=3983

https://mathematics.culturalspot.org/asset-viewer/10-000-circles-1/...

Thanks for the insight.

Shynn

Views: 1237

Replies to This Discussion

I "think" that nervous system uses a fair bit of custom java for their development, (some of their blog posts reference the technology they use, https://n-e-r-v-o-u-s.com/blog/?p=2295).  While there are many IDE's, (integrated development environments....the thing you use to write code in various languages), this might be a good starting point IF you decide to go down the "non-GH/Rhino" path.

https://p5js.org/get-started/

Processing, (which actually has it's own built-in IDE), and ps5 have a ton of online resources if you wish to go down that path. Look up "the coding train" on youtube for a TON of processing and PS5 info. (Daniel Shiffman, Nature of Code, all around super smart/insightful person). 

Acknowledging that java is a bit outside of the context of this forum, I think that there are a few "nervous knock-offs/inspired" projects on the forum that have used GH to imitate/approximate some of their projects.  Some use native GH components, others use various "node in code" custom components, (VB, C#, Python).

As for your second example, it looks as if the author/artist says that they are mathematically created surfaces.  If you are unfamiliar with how that might look, there are a few discussions that show GH implementations.  This may be a good place to start.

http://www.grasshopper3d.com/forum/topics/mathematical-surfaces?id=...

Lastly, the title of the discussion states "Beginner question", so I presume that you may not have had much experience with coding?  If so, that's just fine!  I might also suggest starting here to understand some basic GH/Python syntax.

http://developer.rhino3d.com/guides/rhinopython/your-first-python-s...

not sure that is the answer/s you were looking for, but maybe it helps point in the right direction.

Hey Chris, this is awesome! Thanks for the extensive reply!

I have been following up on the of the links you posted, and seeing the Lorenz System Wikipedia page has a python simulation of it, I wonder if just copy pasting it inside the python component in gh will work? I presume not... So I wonder, what must be done to make it work?

https://en.wikipedia.org/wiki/Lorenz_system

That particular example imports a few libraries, that, to my knowledge, are not available to use in a GH python component, nor a rhino Python script. (actually, i don't think you can import any of those....) So, no, copy and paste will not work in that example.  

If you search the forum, you will probably find something, (might be in another programming language than python).  I only suggested python as a starting point, based on your reference to "beginner". 

lastly....maybe there is a plug-in/or definition for GH that does something like this already?

::cough::

http://eat-a-bug.blogspot.com/2009/12/lorenz-attractor.html

Okay great, I will start investigating.

Im not particularly interested in the Lorenz System, but in why I couldn't copy paste it directly, and you gave me some nice insight with the "import library" concept.

Thanks once again Chris.

Since you said you are not interested in the Lorenz system....I threw this together at the end of the day :)  It only uses a "native" import statement, which is Rhino, (commonly referred to as....wait for.....rhinocommon).  the actual procedural code is a simple for loop.  the only sticky part was translating the math properly.  but, here is how I approached it.  after a few quick google searches to check the math, (that you supplied from your wiki link), I came up with this.

I commented the file to help describe some of the steps.  As a next step, you could try replacing the hard-coded variables in the code by assigning input parameters, (variables).

k3dsrf is another program that you can use as a "reference" for mathematically created surfaces, (not sure about curves like this one).  It's handy because you can see the calculations/math for the various values).

Anyway, probably too much info.  Hope some of it is helpful!

Good luck!

Attachments:
It sure is! Thank you!

I have one more doubt, anyone can answer though, I read in the n-e-r-v-o-u-s site that they run the script to generate geostones cuts and this script adds seeds (circles) during the time anoother alogarithm is running. Its like a simulation right? The most similar thing I cant think of is gh is kangaroo, but I doubt you can run two things at a time and make them interact with eah other. This is all achivablen inside an IDE?

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