changing an object's mesh

Ok I might as well let it out that I’m working on Fiber 2.0. I’m almost done, but I need some help! I need to have access to a mesh’s matrix right after I create it. Since the Matrix property is part of Blender.Object I thought I needed to create a new mesh OBJECT, and then append the NMesh data to it. Here’s what I have so far:

import Blender
from Blender import NMesh, Object
BL_VERSION = Blender.Get('version')

#Create new mesh OBJECT
GuideOBJ = Object.New(Object.Types.MESH)
GuideOBJ.name = "Fiber.Guide"

#Try and modify the Object's mesh
#Note this method is for 2.23
if BL_VERSION <= 2.25:
   me = GuideOBJ.data
else:
   me = GuideOBJ.getData()

me.verts.append(NMesh.Vert(0,0,0))
me.verts.append(NMesh.Vert(1,1,1))

face=NMesh.Face()
face.v.append(me.verts[0])
face.v.append(me.verts[1])
me.faces.append(face)	
	
NMesh.PutRaw(me,"Fiber.Guide")
Blender.Redraw()

When you run this it creates 2 things: an object named “Fiber.Guide” without the correct mesh, and a mesh named “Fiber.Guide” without the correct object! How do I link these together into 1 object? Thanks!

if you use the Blender.NMesh.PutRaw() function, it returns the object that is create (or used).


obj = NMesh.PutRaw(me,"Fiber.Guide")

instead of creating the object with Blender.Object.New()

Martin

Sweet I didn’t know that!