Object Polygons
Add this script to a "Batch Script" editor (F10) and execute it with Script > Run.
Get a torus object's polygons, store them in a list container, and print out their number:
polygonObject = scene.getObject("Torus01") polygons = polygonObject.getFaces() scene.message("Number of polygons: "+str(len(polygons)))
Object Vertices
Add this script to a "Batch Script" editor (F10) and execute it with Script > Run.
Get a torus object's vertices, store them in a list container, and print out their number:
polygonObject = scene.getObject("Torus01") vertices = polygonObject.getVertices() scene.message("Number of vertices: "+str(len(vertices)))
Polygon Vertices
Add this script to a "Batch Script" editor (F10) and execute it with Script > Run.
Get a torus object's polygons, store them in a list container, and get the three vertices of each polygon. Then, calculate each polygon's midpoint and place a particle there:
polygonObject = scene.getObject("Torus01") polygons = polygonObject.getFaces() vertices = polygonObject.getVertices() vertexPosition = Vector.new(0,0,0) container = scene.get_PB_Emitter("Container01") for polygon in polygons: vertexIndices = polygon.getIndices() vertex0 = vertices[vertexIndices[0]] vertex1 = vertices[vertexIndices[1]] vertex2 = vertices[vertexIndices[2]] vertex0Pos = vertex0.getPosition() vertex1Pos = vertex1.getPosition() vertex2Pos = vertex2.getPosition() vertexPosition = vertex0Pos + vertex1Pos + vertex2Pos vertexPosition.set(vertexPosition.x / 3, vertexPosition.y / 3, vertexPosition.z / 3) container.addParticle(vertexPosition, Vector.new(0,0,0))