home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 90 / CD Actual 90.iso / Software3D / K-3D / k3d-0.4.2.1 / scripts / create_mesh.python < prev    next >
Encoding:
Text File  |  2004-07-23  |  754 b   |  37 lines

  1. #python
  2.  
  3.  
  4. def Work(Document):
  5.  
  6.     mesh = k3dmesh(Document);
  7.     pos1 = 0, 0, 0
  8.     point1 = mesh.create_point(pos1)
  9.     pos2 = 0, 1, 0
  10.     point2 = mesh.create_point(pos2)
  11.     pos3 = 1, 1, 0
  12.     point3 = mesh.create_point(pos3)
  13.     pos4 = 1, 0, 0
  14.     point4 = mesh.create_point(pos4)
  15.  
  16.     polyhedron = mesh.create_polyhedron()
  17.     face = polyhedron.create_face(point1)
  18.     polyhedron.add_point_to_face(face, point2)
  19.     polyhedron.add_point_to_face(face, point3)
  20.     polyhedron.add_point_to_face(face, point4)
  21.  
  22.     # Create an object and an instance for it
  23.     mesh_object = mesh.create_mesh_object()
  24.     mesh_instance = mesh.create_mesh_instance(mesh_object)
  25.  
  26.  
  27. # Main
  28.  
  29. # Find a valid document
  30. if not MyDocument:
  31.     print "No document found\n"
  32.     exit
  33.  
  34. Work(MyDocument)
  35.  
  36.  
  37.