@@ -0,0 +1,1237 @@
+# -*- coding: utf-8; -*-%0A#%0A# Copyright 2015, Kabuku Inc. http://www.kabuku.co.jp%0A#%0A# This repository hosts sample codes used in the articles in rinkak (https://www.rinkak.com)%0A#%0A# %3CThe article for this code%3E%0A# https://www.rinkak.com/blog/blender-python-modeling-5%0A#%0A%0A__author__ = %22Takuro Wada%22%0A__copyright__ = %22Copyright 2015, Kabuku Inc.%22%0A__license__ = %22MIT%22%0A%0Aimport bpy%0A%0A%0Adef delete_all():%0A    for item in bpy.context.scene.objects:%0A        bpy.context.scene.objects.unlink(item)%0A%0A    for item in bpy.data.objects:%0A        bpy.data.objects.remove(item)%0A%0A    for item in bpy.data.meshes:%0A        bpy.data.meshes.remove(item)%0A%0A    for item in bpy.data.materials:%0A        bpy.data.materials.remove(item)%0A%0A%0Adef add_cube_by_data():%0A    mesh = bpy.data.meshes.new('CubeMeshByData')%0A    obj = bpy.data.objects.new('CubeObjectByData', mesh)%0A    bpy.context.scene.objects.link(obj)%0A%0A    vertices = %5B(x, y, z) for x in %5B-1, 1%5D for y in %5B-1, 1%5D for z in %5B-1, 1%5D%5D%0A%0A    faces = %5B%0A        (4, 5, 1, 0),%0A        (0, 1, 3, 2),%0A        (2, 3, 7, 6),%0A        (6, 7, 5, 4),%0A        (3, 1, 5, 7),%0A        (0, 2, 6, 4)%0A    %5D%0A%0A    mesh.from_pydata(vertices, %5B%5D, faces)%0A    mesh.update()%0A%0A%0Aif __name__ == %22__main__%22:%0A    delete_all()%0A    add_cube_by_data()%0A%0A

Add tut5