Buy Now

Creating a Mesh

< Previous | Contents | Manuals Home | Boris FX | Next >

โ€ŒCreating a Mesh

The following code creates a small planar mesh.

# ; Create Test Mesh import SyPy

hlev = SyPy.SyLevel() hlev.OpenExisting()

# hlev.OpenSynthEyes()


def WriteVerts(msh, hgrid, vgrid): vc = 1

for v in range(0, vgrid+1): for h in range(0, hgrid+1):

tu = float(h) / float(hgrid) tv = float(v) / float(vgrid)

pu = (tu - 0.5)*2 # raw image coordinates pv = (tv - 0.5)*2

msh.Call("SetVtx", vc, [pu, pv, 0])

msh.Call("SetVtxTexCo", vc, [tu, 1.0 - tv]) vc += 1

msh.Call("UpdateVtxs") msh.Call("UpdateTexCos")

def WriteFaces(msh, hgrid, vgrid): fc = 1

stride = hgrid+1

for v in range(0, vgrid): for h in range(0, hgrid):

vb = v*stride + h + 1; # Vertex numbers start at one msh.Call("SetFace", fc, [vb, vb+1, vb+stride+1]) msh.Call("SetFaceShow", fc, 3)

fc += 1

msh.Call("SetFace", fc, [vb, vb+stride+1, vb+stride]) msh.Call("SetFaceShow", fc, 6)

fc += 1


hlev.Begin()

msh = hlev.CreateNew("MESH") msh.nm = "My New Mesh" msh.kind = "Test"

hgrid = 16

vgrid = 9

WriteVerts(msh, hgrid, vgrid) WriteFaces(msh, hgrid, vgrid) hlev.Accept("Create test mesh")


ยฉ2026 Boris FX, Inc.ย โ€”ย UNOFFICIALย โ€”ย Converted from original PDF.


Subscribe to our newsletter

Get all the latest news, blog posts and product updates from Boris FX, delivered directly to your inbox.

In order to provide you with the content requested, we need to store and process your personal data. For more information on how to unsubscribe and our commitment to protecting your privacy, please review our Privacy Policy.

Welcome!

Thanks for opting-in to our newsletter. You'll receive an email momentarily with your confirmation.

Please select your language

The website is currently localized into the following languages