# Organic Geometry Creation

Dear All,

I am relatively experienced working with Dynamo however, I am struggling to think of ways to create similar forms to those developed by Hashem Joucka shown below. I would appreciate if anyone could tell me what methods I should look at to recreate this kind of geometry or if it’s currently possible:

Kind regards.

Clive

1 Like

If you have a 3D volumen to start with it is easy to create this layer effect. If you mean to create the geometry from 0, I have no idea

1 Like

Hey,

Here’s a graph for you to play with…

It generates a topo from some random points
It makes a nurbs surface to give the organic curves
It extracts a mesh from this and intersects it with a bunch of planes to generate the step outlines.
It grabs the end points of the lines and makes nurbs curves out of them
It patches those curves to makes surfaces
The surfaces are extruded and turned into floors to put into Revit (I would rather boolean and create a mass, but they won’t union unfortunately)

It breaks down in the middle of the form, where the separate peaks and troughs come together into more complex outlines.

SteppedTopoRandom.dyn (43.9 KB)

Let me know if that’s helpful…

Cheers,

Mark

1 Like

It’s funny how just typing out your process helps you improve it…

This graph doesn’t bother to turn the topo into nurbs, this helps more of those surfaces in the middle of the form…

SteppedTopoRandom-1.dyn (44.4 KB)

2 Likes

its all about math, that is every shape and curve has a specific equation or combinations of multi equations.
if you want to draw this on dynamo , you have to draw the basic zigzagged line which have basically sinusoidal shape

then turn them to solid with specific height and copy it to layers, every layer has it’s own values and constants …etc.

it’s need some efforts indeed.

good luck

1 Like

some ideas …

https://www.mathcurve.com/surfaces.gb/Gyroide/gyroide.shtml

5 Likes

Thanks Simone, it seems like the form follows a gyroid so I shall investigate developing this surface.

Looks like an isosurface Grasshopper can do that

@clive_owen you can create a gyroid (nice tip @simoneavellini) of points with the following python, not sure how easy this would be to make into a surface or whatever, maybe someone on the forum might be able to help, I’d be interested myself, `NurbsSurface.ByPoints` seems the way to go but not sure if a gyroid geometry would work well with a nurb surf

Even just as points Its fairly pretty just on its own be prepared to let this calculate for a while I had 34,408 points ! or change some of the values in the code below to run quicker

``````import clr
import math

from Autodesk.DesignScript.Geometry import *

def gyroid (x,y,z) :
def sc (sin,cos) : #it might also be better to define the functions seperately...
r = math.pi/180
return math.sin(sin*r)*math.cos(cos*r)
return sc(x,y) + sc(y,z) + sc(z,x)

rangeXYZ = 361 #change to 181 to calculate just a single gyroid a bit quicker
rangeX = range(rangeXYZ)
rangeY = range(rangeXYZ)
rangeZ = range(rangeXYZ)
gyroids = []
points = []

for x in rangeX :
for y in rangeY :
for z in rangeZ :
if -0.001 < gyroid(x,y,z) < 0.001 : #change to 0.0001 for less points a bit quicker
#				gyroids.append(gyroid(x,y,z))
points.append(Point.ByCoordinates(x, y, z))
OUT = points#, gyroids
``````

I’ve also used `Display.ByGeometryColor` to help visualize it

12 Likes

cool gif @Dimitar_Venkov

3 Likes

I translated your script to a c# script to speed things up a bit, tho it still took ~2.5 minutes to do a 720 degree one (about 375M function calls)

``````using System;
using System.Linq;
using System.Collections.Generic;
using Autodesk.DesignScript.Geometry;

var r = Math.PI / 180;
var N = (int)(double)IN[0];
var TOL = 0.001;

var range = Enumerable.Range(0, N+1);
var OUT = new List<Point>();

public double sc(int s, int c)
{
return Math.Sin(s * r) * Math.Cos(c * r);
}

public double gyroid(int x, int y, int z)
{
return sc(x, y) + sc(y, z) + sc(z, x);
}

double g;
foreach(var x in range)
{
foreach(var y in range)
{
foreach(var z in range)
{
g = gyroid(x, y, z);
if (g > -TOL && g < TOL)
{
}
}
}
}
return OUT;
``````

I then exported the points and converted them into a mesh using mesh lab:

gyroid_720.txt (1.3 MB) (rename the file to *.ply; the forum does not support mesh files)

edit: a better way to speed things up, is to pre-compute all the sin and cos calls

6 Likes

Thanks @Dimitar_Venkov, I’ll take a look at this
I’m sure I’ll get to grips with c# some day but i’m still on python at the moment
hopefully the ‘Aish Curve’ won’t be too steep for me
its great to know this forum is here to help

http://designscript.io/splashws16dsmmain-dsmmainid7-p-77ea535-30262-final.pdf

2 Likes

Gyroid approximation (polysurface)…

gyroid1.dyn (8.2 KB) (ver 2)

``````l = 10;
o = 3;
n = 3;
p = Point.ByCoordinates([0,l/2,l,l,l,l-o,l,l/2,0,0,0,o,0,l/2,l/2,l/2,l-o,o,l-o,o],[l,l,l,l-o,l,l/2,0,0,0,o,0,l/2,l,l/2,l-o,o,l-o,o,l/2,l/2],[0,o,0,l/2,l,l,l,l-o,l,l/2,0,0,0,l/2,o,l-o,l/2,l/2,l-o,o]);
a = Arc.ByThreePoints(p[[0..10..2]],p[[1..11..2]],p[[2..12..2]]).SplitByParameter(0.5)[0];
b = Arc.ByThreePoints(p[[1,13,3,13,5,13]],p[14..19],p[[13,7,13,9,13,11]]);
m1 = PolySurface.ByJoinedSurfaces(PolyCurve.ByJoinedCurves([[a[5][1],a[0][0],b[0],b[5]],[a[0][1],a[1][0],b[2],b[0]],[a[1][1],a[2][0],b[4],b[2]],[a[2][1],a[3][0],b[4],b[1]],[a[3][1],a[4][0],b[3],b[1]],[a[4][1],a[5][0],b[5],b[3]]]).Patch());
m2 = PolySurface.ByJoinedSurfaces(List.Flatten([m1,m1.Rotate(Point.Origin(),Vector.ZAxis(),-180).Translate(l,2*l,0)],-1));
m3 = PolySurface.ByJoinedSurfaces(List.Flatten([m2,m2.Mirror(Plane.XY()).Mirror(Plane.YZ()).Translate(0,0,l)],-1));
m4 = PolySurface.ByJoinedSurfaces(List.Flatten([m3,m3.Mirror(Plane.XY()).Rotate(Point.Origin(),Vector.ZAxis(),180).Translate(0,2*l,2*l)],-1));
m5 = PolySurface.ByJoinedSurfaces(List.Flatten(m4.Translate((0..#n..2*l)<1>,(0..#n..2*l)<2>,(0..#n..2*l)<3>),-1));
``````

Also tried the equation (script below). Seems to work with a small sample, but takes forever with required values

gyroid2.dyn (3.4 KB) (ver 2)

``````[Imperative]
{
n = 360;
i = 0.02;
px = [];
py = [];
pz = [];
x = 0;
c = 0;
while (x<n)
{
y = 0;
while(y<n)
{
z = 0;
while(z<n)
{
b = (Math.Sin(x)*Math.Cos(y))
+ (Math.Sin(y)*Math.Cos(z))
+ (Math.Sin(z)*Math.Cos(x));
if (Math.Round(b,3) == 0)
{
px[c] = x;
py[c] = y;
pz[c] = z;
c = c + 1;
}
z = z + i;
}
y = y + i;
}
x = x + i;
}
return = Point.ByCoordinates(px,py,pz);
};``````
11 Likes

This is fantastic, thank you very much everybody!

1 Like