如何通过Python API在Blender 2.50中创建简单网格

如何通过Python API在Blender 2.50中创建简单网格,python,blender,blender-2.50,Python,Blender,Blender 2.50,我想通过Python API在Blender(2.50)中创建一个简单的网格,但是API文档中的示例还不起作用 我尝试了以下方法,但效果不佳 这不起作用,因为网格对象没有任何面或顶点成员 是否有任何选项可以执行此操作?请尝试2.5x API的文档。我知道,尽管顶部有大的警告,但使用最多的部分现在相当稳定。我还没试过 编辑: 我认为相关的一点是——似乎你创建了一个顶点、面等的列表,并将其传递给这个。这似乎与我能找到的最新例子有所不同。尝试查看您的脚本文件夹-可能有一个您可以查看的示例 编辑2:我已

我想通过Python API在Blender(2.50)中创建一个简单的网格,但是API文档中的示例还不起作用

我尝试了以下方法,但效果不佳

这不起作用,因为网格对象没有任何
顶点
成员

是否有任何选项可以执行此操作?

请尝试2.5x API的文档。我知道,尽管顶部有大的警告,但使用最多的部分现在相当稳定。我还没试过

编辑:

我认为相关的一点是——似乎你创建了一个顶点、面等的列表,并将其传递给这个。这似乎与我能找到的最新例子有所不同。尝试查看您的脚本文件夹-可能有一个您可以查看的示例


编辑2:我已经更新了链接,指向当前的live文档。那里的注释表明,现在可能有更好的方法来实现这一点,但我已经很久没有完成任何blender脚本编写了,因此我无法提供更多帮助。

感谢neil,我从文档中找到了以下部分:

我将尝试以下脚本并报告结果:


感谢您的链接,即使我已经知道了这一点。您能给我指一下文档中的一个特定页面吗?我还没有找到一个工作示例。我无法用文档编写一个工作示例。你能帮我一下吗?对不起,我没有对新的API做任何事情,我只是看一下文档,看看我在别处读到的东西。你可能会在Python和插件论坛的blenderartists.org上得到更多的帮助。
   from Blender import *
   import bpy

   editmode = Window.EditMode()    # are we in edit mode?  If so ...
   if editmode: Window.EditMode(0) # leave edit mode before getting the mesh

   # define vertices and faces for a pyramid
   coords=[ [-1,-1,-1], [1,-1,-1], [1,1,-1], [-1,1,-1], [0,0,1] ]  
   faces= [ [3,2,1,0], [0,1,4], [1,2,4], [2,3,4], [3,0,4] ]

   me = bpy.data.meshes.new('myMesh')          # create a new mesh

   me.verts.extend(coords)          # add vertices to mesh
   me.faces.extend(faces)           # add faces to the mesh (also adds edges)

   me.vertexColors = 1              # enable vertex colors 
   me.faces[1].col[0].r = 255       # make each vertex a different color
   me.faces[1].col[1].g = 255
   me.faces[1].col[2].b = 255

   scn = bpy.data.scenes.active     # link object to current scene
   ob = scn.objects.new(me, 'myObj')

   if editmode: Window.EditMode(1)  # optional, just being nice