create cube in blender using python codes

Publicado em: 04 Abril 2023
no canal de: Rover
193
5

create cube in blender using python codes
#shorts

Python Code

import bpy

Define cube vertices
verts = [(1, 1, -1), (1, -1, -1), (-1, -1, -1), (-1, 1, -1), (1, 1, 1), (1, -1, 1), (-1, -1, 1), (-1, 1, 1)]

Define cube edges
edges = [(0, 1), (1, 2), (2, 3), (3, 0), (4, 5), (5, 6), (6, 7), (7, 4), (0, 4), (1, 5), (2, 6), (3, 7)]

Define cube faces
faces = [(0, 1, 2, 3), (4, 5, 6, 7), (0, 4, 7, 3), (1, 5, 4, 0), (2, 6, 5, 1), (3, 7, 6, 2)]

Create mesh and object
mesh = bpy.data.meshes.new("Cube")
object = bpy.data.objects.new("Cube", mesh)

Set location and add to scene
object.location = bpy.context.scene.cursor.location
bpy.context.scene.collection.objects.link(object)

Create mesh from data
mesh.from_pydata(verts, edges, faces)
mesh.update()


Nesta página do site você pode assistir ao vídeo on-line create cube in blender using python codes duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Rover 04 Abril 2023, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 193 vezes e gostou 5 espectadores. Boa visualização!