W1: Ornament Design in Grasshopper
by merttoka in Workshop > Tools
750 Views, 2 Favorites, 0 Comments
W1: Ornament Design in Grasshopper



This small project is my first exposure to Rhino, Grasshopper, and Python scripting workflow. I have used programming languages and other CAD programs (Autodesk, Maya, Cinema4D) before, but I found Rhino and Grasshopper quite different than my previous endeavors. I am excited about the Grasshopper's visual programming style combined with powerful Python scripting capabilities.
I started with the sample code provided by Jennifer Jacobs and did slight modifications to the code and Grasshopper patch. I removed boolean union operation as it caused performance issues and failed after every attempt (I wonder why). Instead, I baked the model by enabling grouping, which enabled me to select the object as a single group.
`Cap Type` slider changes the type of end for each curve, and the value of 3 makes them rounded. Python code is as follows:
<p>import rhinoscriptsyntax as rs</p><p># Function to calculate distance between two points def dist2(p0, p1): return (p0.X- p1.X)*(p0.X- p1.X) + (p0.Y- p1.Y)*(p0.Y- p1.Y)+(p0.Z- p1.Z)*(p0.Z- p1.Z)</p><p># Create a list of points pt = [] dx = (p2.X-p1.X)/(rx-1) ry = int(.5+(p2.Y-p1.Y)/dx) for i in range(0,ry+1): for j in range(0,ry+1): x = p1.X + j*dx y = p1.Y + i*dx if(mtype == 0): if((i*i - j*j) % mod) == 0: pt.append(rs.CreatePoint(x,y,0.0)) elif(mtype == 1): if((i*i + j*j) % mod) == 0: pt.append(rs.CreatePoint(x,y,0.0)) elif(mtype == 2): if((i*j) % mod) == 0: pt.append(rs.CreatePoint(x,y,0.0)) else: if((i*j+j+i) % mod) == 0: pt.append(rs.CreatePoint(x,y,0.0))</p><p>a = pt print("## done points")</p><p># create a list of lines ln = [] d2 = dist*dist</p><p>for j in range(0,len(pt)): for i in range(0,len(pt)): if(dist2(pt[i],pt[j])</p><p>b = ln print("## done lines")</p>
3rd Dimension




For extruding the 2D pattern, I wanted to explore varying edge thicknesses and possible noise effects. I was imagining creating a noise blob that grows stronger in the Z-direction and using a boolean difference operation with the extruded ornament. However, since I am fairly new at both Rhino and Grasshopper, I couldn't find a good way to achieve this noise effect.
Instead, I baked 5 different versions of the same pattern with different distance coefficients (dist=[2.5, 2.2, 1.8, 1.5, 0.8]). This enabled me to produce less complicated versions of the same ornament. I stack these variations on top of each other to modulate the Z-direction.
Rendering


Once I have the 3D shape, I used Rhino's default renderer to capture shaded images of the final design. You can find some experimentations with different light and surface configurations.