Created
April 25, 2018 07:09
-
-
Save joshuaskelly/90f94cb76d8bc6458415373abc86487c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
import bmesh | |
me = bpy.data.meshes.new('test') | |
bm = bmesh.new() | |
bm.verts.new((0,0,0)) | |
bm.verts.new((0,10,0)) | |
bm.verts.new((10,10,0)) | |
bm.verts.new((10,0,0)) | |
bm.verts.new((2,2,0)) | |
bm.verts.new((2,8,0)) | |
bm.verts.new((8,8,0)) | |
bm.verts.new((8,2,0)) | |
bm.verts.ensure_lookup_table() | |
bm.edges.new(bm.verts[0:2]) | |
bm.edges.new(bm.verts[1:3]) | |
bm.edges.new(bm.verts[2:4]) | |
bm.edges.new((bm.verts[3],bm.verts[0])) | |
bm.edges.new(bm.verts[4:6]) | |
bm.edges.new(bm.verts[5:7]) | |
bm.edges.new(bm.verts[6:8]) | |
bm.edges.new((bm.verts[7],bm.verts[4])) | |
bm.edges.ensure_lookup_table() | |
bmesh.ops.triangle_fill(bm, use_beauty=True, use_dissolve=False, edges=bm.edges[:]) | |
bm.to_mesh(me) | |
bm.free() | |
ob = bpy.data.objects.new('test', me) | |
bpy.context.scene.objects.link(ob) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment