ghPython – Outside the Canvas | Steve Baer's Notes As a follow up to my post about the new features in ghPython, I wanted to point out another feature now available; running Grasshopper components outside of the Grasshopper canvas. Download ghPython… You will need to have installed ghPython and have used the component in grasshopper at least once. We will fix the “at least once” issue in a future release of ghPython. Start RhinoRun EditPythonScript and enter the following script Run the python script ghpythonlib (both components and parallel) modules are available in the standard python editor in Rhino. This also lets you work in a slightly different way where you can get points in Rhino using rhinoscriptsyntax “get input” type functions and pass those points (or curves or breps) into the Grasshopper component code. Like this: Like Loading...
3. An Informal Introduction to Python In the following examples, input and output are distinguished by the presence or absence of prompts (>>> and ...): to repeat the example, you must type everything after the prompt, when the prompt appears; lines that do not begin with a prompt are output from the interpreter. Note that a secondary prompt on a line by itself in an example means you must type a blank line; this is used to end a multi-line command. Many of the examples in this manual, even those entered at the interactive prompt, include comments. Comments in Python start with the hash character, #, and extend to the end of the physical line. A comment may appear at the start of a line or following whitespace or code, but not within a string literal. Let’s try some simple Python commands. 3.1.1. The interpreter acts as a simple calculator: you can type an expression at it and it will write the value. The integer numbers (e.g. 2, 4, 20) have type int, the ones with a fractional part (e.g. 5.0, 1.6) have type float. 3.1.2.
Generative Art - Autonomy: Cellular Automata The most familiar single example of an autonomous agent, to you at least, is the one staring at this page. You, dear reader, with your behavior on any particular day defined by a complex mix of biology, psychology, and the comfortableness of your footwear, are an autonomous object, creating interesting patterns in the data you create. Most everything you do these days leaves a data trail: every purchase you make, every point you earn on your store card, every link you click, and every journey you take. The cards in your wallet are writing your economic autobiography, your tweets and SMSs are writing an ASCII diary as part of a social map, and the phone in your pocket is drawing a GPS picture of your daily psycho-geography. To familiarize you with the concept of autonomy and the emergent complexity of this breed of object, we’ll play one of the early parlor games of computer science: cellular automata. In the 1970s, the field of computer science was obsessed with cellular automata (CA).
The Best Way to Learn Python Python is more popular than ever, and is being used everywhere from back-end web servers, to front-end game development, and everything in between. Python is a true general purpose language and is quickly becoming a must-have tool in the arsenal of any self-respecting programmer. But Python isn't popular just because it's popular. At the time of this writing, there are two main versions of Python in circulation: Python 2.7 and Python 3.2. Wikibooks is always a great source to learn something new, and Python is no exception. You won't find a better source of information than the official python.org documentation. The content tends to be more technical than wikibooks, which will be helpful later on as you progress through the language. For beginners, the biggest difference between Python 2 and Python 3 will most likely be that Python 2 can use print without parentheses. TheNewBoston's playlists are always great, and you can learn a whole host of languages.
Cookbook ghPython – New component and parallel modules | Steve Baer's Notes Just in time for Christmas… ghPython 0.6.0.3 was released this week and it has two new features that I’m really excited about. Download ghPython… A little background David Rutten was visiting the McNeel Seattle office in November to discuss future work on Grasshopper and Rhino. When David is in town it always gives me the chance to brainstorm with him and try to solve some of the features that users ask for. Two features that we commonly hear about are “how can I do what X component does, but through RhinoCommon/code?” Out of these chats came the two major new features in ghPython 0.6.0.3; the ability to call components from python and an easy way to do this using multiple threads. ghPython 0.6.0.3 ships with a new package (ghpythonlib) that supports these two new features. Components As Functions (node-in-code) There is a module in ghpythonlib called components which attempts to make every component available in python in the form of an easy to call function. Here is a sample gh file
The Python Tutorial Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms. The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python Web site, and may be freely distributed. The same site also contains distributions of and pointers to many free third party Python modules, programs and tools, and additional documentation. The Python interpreter is easily extended with new functions and data types implemented in C or C++ (or other languages callable from C). This tutorial introduces the reader informally to the basic concepts and features of the Python language and system.