Triaxial Waffling Grasshopper3d Definition

triaxialwaffle01

Almost 4 months after my last post..:( i have been really busy lately , mostly with amazingly interesting stuff that I’ll have the time (me thinks!) to unveil in the near future, plus the development for the next build of Nudibranch  to be up-to-date with the new grasshopper version 0.9.0052.

But just to get things rolling and before moving into any major update, I decided to share a fabrication oriented definition of mine, that was developed quite a long time ago. I tried to narrow it down , clean it up and share it along with a small code snippet in Python to generate dot text objects in the rhino viewport (this is now embedded in the new gh), but it serves the general purpose of learning how to interact with rhino objects through Gh.

triaxialwaffle02

triax002

triax004

On the other hand, this definition is really useful (though my point of view at least) especially for the many advantages it has over the normal 2-dimensional waffling system, mainly in terms of rigidness and detail. At the same time this fabrication methodology provides a denser structural framework for any possible post-processing routine in order to describe better the analysed and fabricated design (most of the times a freeform, double curved surface or object) like for example the implementation of a gap filling material like stucco, cement or resin forming somehow an interesting composite system.

triax001

triax003

The system takes on single surface and translates it into ready to laser-cut stripes laying on three different grid systems, + tags + the quantification of the joints of the system(python snippet). The code of which is just a few lines as you can see below.

</pre>
import Rhino

dots = []

att = Rhino.DocObjects.ObjectAttributes()
att.ColorSource = Rhino.DocObjects.ObjectColorSource.ColorFromObject
att.ObjectColor = col

for i in range(len(pos)):
 dot = Rhino.Geometry.TextDot(text+str(i),pos[i])
 dots.append(dot)
 if bake == True:
 D = Rhino.RhinoDoc.ActiveDoc.Objects.AddTextDot(text+str(i),pos[i],att)

Dots= dots
<pre>

Let me know if there is any way to improve this definition or if bugs are brought up.  You can grab it the usual place ..

🙂

Rossler Attractor Python Script in Grasshopper3d

Looking more into Python, the syntax and how you can use for loops, Rhinocommon and math within the GH Python Component, I decided to write and share this animated Python script of a Rossler attractor.  This particular attractor lies in the context of particle kinematics within chemical reactions. This system is defined by three non-linear ordinary differential equations originally studied by Otto Rössler. I find it to be, an extremely interesting and minimally beautiful system, mainly due to the particle’s easily observed movement in the Cartesian 3D space.

rosslers002

ros006

Thy python code looks something like this:

#”Rossler Attractor Grasshopper Python Component”
#Written by Marios Tsiliakos on 22/11/2012
#Based on the equations provided by Paul Bourke http://paulbourke.net
#Rossler Attractor by Marios Tsiliakos is licensed under a
#Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
#Based on work at http://www.digitalsubstance.wordpress.com.
#Imports
from math import *
import _random as rnd
import Rhino
# Subfunction
def Rossler(it):
#random number
r=rnd.Random(Seed)
r0 = r.random()*0.1
# set the constants
a = 0.15 + r0
b = 0.2 – r0
c = 5.7 + r0
h = H
var.append((round(a,2),round(b,2),round(c,2)))
# provide the initial point
x,y,z=0.1,0.0,0.0
for i in range(it):
x0= x + h*(-y -z)
y0= y + h*(x + a*y)
z0= z + h*(b+z*(x-c))
#make the resulting coordinates the coordinates last point
x,y,z = x0, y0, z0
pts= Rhino.Geometry.Point3d(x,y,z)
arrPts.append(pts)
#Main function
if Iterations == None:
Iterations = 1000
if H == None:
H = 0.05
if Seed == None:
Seed = 2
if Run== True:
#global lists
arrPts = []
var =[]
# always provide the creation of a curve by sufficient number of points
numpoints =counter+4
if numpoints < Iterations:
Rossler(numpoints)
crv = Rhino.Geometry.Curve.CreateInterpolatedCurve(arrPts,3)
counter+=10
print counter
print “Rossler attractor with values: a =” , var[0][0],”b=” , var[0][1],”c=”, var[0][2],”h=” , H
if numpoints >= Iterations:
print “goal achieved”
# Comment out the next line to get the resulting points
#Rossler(Iterations)
#crv = Rhino.Geometry.Curve.CreateInterpolatedCurve(arrPts,3)
#counter = Iterations
#outputs
Ross=crv
Points = arrPts
else :
print(“Idle”)
counter = 0

And here is a snapshot of the definition . You can download it at the usual place.

Enjoy!

2-state Cellular Automaton in Python for Grasshopper

CA0001m

I just got my hands on Python for rhino last week (more specifically on a package called ironpython), because I wanted to try out the capabilities and the adaptive character of this powerful scripting/coding language. What is interesting in the case of ironpython is the import of both the rhinoscript syntax and the Rhinocommon elements within the Grasshopper3d environment. Having prior programming experience python is fairly easy to learn and quite user friendly. The  feature of debugging without compiling the code is also really useful.

To test the scripting possibilities of Python I wrote a 2-state cellular automaton based on this code from Processing on Worlfram 2d CA’s. I have implemented both Rhinocommon and rhinoscript syntax commands and members in the code, plus I have introduced some time based evolving  just to make the simulation dynamic.

CA003

The algorithm can create a variety of patterns, emerging from the initial rule defining the state relation between the automata (ie. the famous rule 110). The parameters of the python component are the number of the rule  used, the width of the drawing grid, the size of the cell and the time. The process becomes kind of slow after a few iterations because lots of geometry is being generated, thus if the boxes were to be replaced by simple points the algorithm would have a much better performance.

CA002f

CA004

Here is a small video documenting the process.

This is a snapshot of the grasshopper definition. I plan to release the code after I clean it up a little bit, so stay tuned if you want to try it out.