File: create_mesh.python

package info (click to toggle)
k3d 0.4.3.0-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 51,716 kB
  • ctags: 81,610
  • sloc: cpp: 283,698; ansic: 64,095; xml: 61,533; sh: 9,026; makefile: 5,282; python: 431; perl: 308; awk: 130
file content (36 lines) | stat: -rw-r--r-- 718 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#python


def Work(Document):

	mesh = k3dmesh(Document);
	pos1 = 0, 0, 0
	point1 = mesh.create_point(pos1)
	pos2 = 0, 1, 0
	point2 = mesh.create_point(pos2)
	pos3 = 1, 1, 0
	point3 = mesh.create_point(pos3)
	pos4 = 1, 0, 0
	point4 = mesh.create_point(pos4)

	polyhedron = mesh.create_polyhedron()
	face = polyhedron.create_face(point1)
	polyhedron.add_point_to_face(face, point2)
	polyhedron.add_point_to_face(face, point3)
	polyhedron.add_point_to_face(face, point4)

	# Create an object and an instance for it
	mesh_object = mesh.create_mesh_object()
	mesh_instance = mesh.create_mesh_instance(mesh_object)


# Main

# Find a valid document
if not MyDocument:
	print "No document found\n"
	exit

Work(MyDocument)