Search found 23 matches

by AlphaNow
Wed Oct 02, 2013 6:13 pm
Forum: Python
Topic: Check if a poly is a face
Replies: 29
Views: 18650

Is there an easy way to access the name of the currently open file? I don't need the path, but I wanted to have my exporter default to a name based off the name of the currently open file. I've dived all through the API and haven't found anything to let me access that.
by AlphaNow
Wed Oct 02, 2013 5:03 pm
Forum: Python
Topic: Check if a poly is a face
Replies: 29
Views: 18650

Hm dunno if there's a faster builtin way (other than using select loose operator), but should work: import bpy, bmesh for ob in bpy.context.scene.objects: if ob.type != 'MESH': continue bm = bmesh.new() bm.from_object(ob, bpy.context.scene) if len(bm.faces) > 0 and 0 not in (len(e.link_faces) for e...
by AlphaNow
Wed Oct 02, 2013 6:23 am
Forum: Python
Topic: Check if a poly is a face
Replies: 29
Views: 18650

hm maybe you actually mean to analyse these two cases? http://abload.de/img/facesvs.edgesrls0p.png For the left cube, test should return True, for the right (no faces) False? [print(ob.name, len(ob.data.polygons) > 0) for ob in bpy.context.scene.objects] That sounds promising. I will have to test i...
by AlphaNow
Tue Oct 01, 2013 7:56 pm
Forum: Python
Topic: Check if a poly is a face
Replies: 29
Views: 18650

Okay, so, new problem now. I can select all of the faces with 3 or greater verts. then invert. In order to do this, I'm using the following code (frankensteined together from looking at CoDEmanX's script) def check_face(obj): C.scene.objects.active = obj if(obj.type == 'MESH'): bpy.ops.object.editmo...
by AlphaNow
Tue Oct 01, 2013 2:57 pm
Forum: Python
Topic: Check if a poly is a face
Replies: 29
Views: 18650

verts and edges are NOT faces, polygons are (triangles, quads and ngons). Face access goes via .polygons See my addon, it counts tris, quads and ngons separately: https://svn.blender.org/svnroot/bf-extensions/contrib/py/scripts/addons/mesh_face_info_select.py I'll give it a try on my test dataset. ...
by AlphaNow
Tue Oct 01, 2013 7:43 am
Forum: Python
Topic: Check if a poly is a face
Replies: 29
Views: 18650

The data structures involved in a mesh are: * an array of vertices - X, Y, Z, and maybe a W if we are doing homogenous stuff * a list of edges - an edge is between two points. Each point is represented as an index into the vertex array, so each element is two numbers * a list of faces - a face is a...
by AlphaNow
Tue Oct 01, 2013 5:57 am
Forum: Python
Topic: Check if a poly is a face
Replies: 29
Views: 18650

really dunno what you mean, a polygon is a face and vice versa. What's your definition of face? A triangle? A quad? Both of them, so everything which isn't an Ngon? If you start with a new blender file, delete the camera, lamp, and starter cube, and then add a mesh plane. Then, go down to Mesh->Del...
by AlphaNow
Mon Sep 30, 2013 7:49 pm
Forum: Python
Topic: Check if a poly is a face
Replies: 29
Views: 18650

Check if a poly is a face

I am writing a custom export script to parse all the objects in a blender file, filter them by name, then check to make sure that they are manifold. I am using Blender 2.68a. I've created a blender file with some basic 2d and 3d meshes, as well as some that should fail my test criteria. I've sorted ...