July 30, 2020

Iranian Girih Geometry based Generative FreeForm Structural Design

Generative Design

Design iterations could be generatively directed from different diversity of parameters and factors to have results functionally adapted to what project needs. The number of outputs we would have from different generations could turn to be a great optimization process while we set a discrepancy in load cases. The process has been explained presents “Generative Design” approach which is a high qualify trend in engineering design these days. Just consider we have an algorithm using data sets and have them integrated toward an analyzer which creates different shapes by dynamic data set changes through the whole process.

Freeform structures

One of the most interesting challenges took me myself through engineering designs, is free from structures. Lots of progressions have happened in recent years from world leaders of such beautiful structures. One of the popular impressive teams is Block Research Group well-known as BRG from ETH Zurich. It is being developed under supervision of Professor Philippe Block who has always been motivating me to work in this field by what he’s done. There are lots of innovative ideas we can have from designing, analyzing, and engineering to have structures optimized to fabrication processes, where this field could be a pitch to get involved with. If any parameter changes, the whole system has to be updated accordingly hence, free form structures are mainly a stimulating area for those who are an enthusiast with technology in different aspects as declared above.

I started to work on this amazing area whereas a professional experience I had to improve a free-form triangular tessellation by shape optimization. The project finished after 8 months and assembled in just 3 weeks. This experience was a launch-pad for me to start working on an add-on for detail designing free form single-layer structures. After the very first version, we name it Caddisfly. It works on optimized linear models to have 3d details from elements and nodes by just 5 clicks. It’s still under development but we use it exclusively in professional projects. One of the biggest parts of such projects is to have elements and shapes reading force flows and act adapted to load cases. This could be set by the geometry selected for every element in 3d format where we can use the term: “strength through geometry” (By prof. Block). This is the main idea I am working on and in this project, we will review the process by working on an image processing scenario to generate models from images of Iranian Girih Geometries. This is just an initial idea about traditional Iranian masters thought on geometry they had frequently used back then and it needs to be checked more precisely which we are heading to.

Iranian Girih Geometry

There are lots of applications in a high range of variety of Girih geometries in certain physical elements of Iranian traditional architecture. They have been used on windows, planning, and bricks arrangement with huge and large span domes, minarets, porticos, and also known for kar-bandi which devotes to line spans of arches defines the force flows under gigantic structures. The project here is also using RhinoCommon, Anaconda, and GHPythonRemote for loading NumPy, Pillow, in further steps OpenCV and Matplotlib. This is to define an algorithm to read an image pixel by RGB codes and track them with Alpha mode toward the setting of a surface subdivision. The later steps are dedicated to having these data as a mesh points controllable by number sliders for the user to change the meshing parameters and have the process toward a 3d structure on free form surface as structural elements. This is just a very first step of a greater project which lead me to invite those find it interested to collaborate on future sections.

###----------------Reading Files and ImageData-------###

import os
import ghpythonremote
from ghpythonlib.treehelpers import list_to_tree
import rhinoscriptsyntax as rs
import scriptcontext as sc
np = sc.sticky['numpy']
mpl = sc.sticky['matplotlib']
plt = mpl.pyplot
pil = sc.sticky['PIL']
cv2 = sc.sticky['cv2']

a = str(np.random.random((5,2)))

#path = 'F:AcademyMyCoursesPythonized GhThe Project Pythonized GrasshopperThe Final ProjectModelingGirih_Define25x25.jpg'
Data = []
img = np.asarray(

print (img[0,0,1])

for i in range(25):
    for j in range(25):
        Data.append(str(img[i, j, 0]))
#print Data

Data_Code = Data[0]


Domain = rg.Interval(0, 10)

U_ = []
V_ =[]

Subd_Srfs = []

C1 = 10/U
C2 = 10/V

for i in range(0, U, 1):
    U_int = rg.Interval(i*(10/U), C1)
    C1 += 10/U

for j in range(0, V, 1):
    V_int = rg.Interval(j*(10/V), C2)
    C2 += 10/V

for i in range(len(U_)):
    for j in range(len(V_)):
        Subd_Srfs.append(rg.Surface.Trim(Srf, U_[i], V_[j]))


Colours = []
for i in Data:
    Colour_ID = rs.CreateColor(i, i, i)


Domain = rg.Interval(0, 1)

for i in Subd_Srfs:
    rg.Surface.SetDomain(i, 0, Domain)
    rg.Surface.SetDomain(i, 1, Domain)

Center_pt = []

for i in range(len(Subd_Srfs)):
    Center_pt.append(rg.Surface.PointAt(Subd_Srfs[i], 0.5, 0.5))


Data_Range = max(Data) - min(Data)
#print Data_Range
New_Range = Domain_End - Domain_Start

New_Values = []
for i in Data:
    Val = ((i - min(Data))/Data_Range) + Domain_Start


IEn = [i for i, item in enumerate(New_Values) if item < Selection_Telorence]

Selected_Pts = []

for i in IEn:


pl = rg.Plane.FitPlaneToPoints(pt)
meshXL = rg.Mesh.CreateFromTessellation(pt, None, rg.Plane.WorldXY, False)

topo = meshXL.TopologyEdges
MeshEdge = []
for i in range(topo.Count):

FinalEdges = []

for item in MeshEdge:
    if item.Length < Telorence:


from System import Array

arr_lines = Array[rg.Curve](Lines)
mesh = rg.Mesh.CreateFromLines(arr_lines, Face_Valence, Meshing_Tolerence)

Architecture, Coding, Computational Design, Data Science & Visualization, Functional Paradigm, Generative Design, Integrated Design, Lectures and Presentations, OpenSource, Research & Development, Structure, Traditional Architecture , , , , , , ,
4.5 2 votes
Article Rating
Notify of
Inline Feedbacks
View all comments