Skip to content

Instantly share code, notes, and snippets.

@zeffii
Last active October 25, 2015 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/d01c1e56e4fbac35996e to your computer and use it in GitHub Desktop.
Save zeffii/d01c1e56e4fbac35996e to your computer and use it in GitHub Desktop.
# be in object mode with nothing selected.
import bpy
AA = 0.5257311
BB = 0.381966
CC = 0.8506508
DD = 0.2008114
EE = 0.618034
FF = 0.6498394
GG = 1.618034
HH = 1.051462
Verts = [
AA, BB, CC,
-DD, EE, CC,
-FF, 0, CC,
AA, -GG, CC,
HH, 0, -DD,
CC, EE, DD,
-AA, GG, -CC,
-HH, 0, DD,
-CC, -EE, -DD,
DD, -EE, -CC,
FF, 0, -CC,
-AA, -BB, -CC,
]
Faces = [
3,0,1,2,
0,3,4,5,
1,0,5,6,
2,1,6,7,
3,2,7,8,
4,3,9,10,
5,4,10,6,
7,6,11,8,
3,8,11,9,
10,9,11,6,
]
def deflate(x, stride):
return [x[i: i + stride] for i in range(0, len(x), stride)]
Verts = deflate(Verts, 3)
Faces = deflate(Faces, 4)
mesh = bpy.data.meshes.new("Base_Data")
mesh.from_pydata(Verts, [], Faces)
mesh.update()
obj = bpy.data.objects.new("Base_Profile", mesh)
scene = bpy.context.scene
scene.objects.link(obj)
obj.select = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment