1

This: create mesh then add vertices to it in python (see snippet below) used mesh.from_pydata(verts, edges, faces).

I would like to just create a mesh of vertices, no edges, no faces.

I would think I would delete:

edges = []
faces = [[0, 1, 2, 3]]

But what would I replace mesh.from_pydata(verts, edges, faces) with?

import bpy

mesh = bpy.data.meshes.new("myBeautifulMesh") # add the new mesh obj = bpy.data.objects.new(mesh.name, mesh) col = bpy.data.collections.get("Collection") col.objects.link(obj) bpy.context.view_layer.objects.active = obj

verts = [( 1.0, 1.0, 0.0), ( 1.0, -1.0, 0.0), (-1.0, -1.0, 0.0), (-1.0, 1.0, 0.0), ] # 4 verts made with XYZ coords edges = [] faces = [[0, 1, 2, 3]]

mesh.from_pydata(verts, edges, faces)

Jacer
  • 23
  • 7

1 Answers1

2

This should work (edited to add - I just tried it, it works):

vertices = [( 1.0,  1.0,  0.0), 
            ( 1.0, -1.0,  0.0),
            (-1.0, -1.0,  0.0),
            (-1.0,  1.0,  0.0),
           ]
edges = []
faces = []
new_mesh = bpy.data.meshes.new('new_mesh')
new_mesh.from_pydata(vertices, edges, faces)

See How to create mesh through the Blender Python API, which describes how to create a mesh of just a vertex, no edges or faces.

KickAir8p
  • 2,352
  • 2
  • 8
  • 22