Questions tagged [bmesh]

Blender's new mesh system that was added in 2.63, with full support for N-sided polygons instead of only triangles and quads.

Filter by
Sorted by
Tagged with
25
votes
1answer
964 views

Closing “Fibonacci's Hole”

Creating a sphere using the points defined by Spherical Fibonacci Mapping. For the most part it is easy to "skin" by using two consecutive fibonacci numbers as steps to loop on the index. And get ...
18
votes
5answers
12k views

Efficient way to get selected vertices via python (without iterating over the entire mesh)

What's the best/fastest way to construct a list of selected vertices for a mesh object in python? I want to avoid iterating over every vertex in the mesh if possible, since that seems like a really ...
16
votes
2answers
11k views

how to use BMesh to add verts, faces, and edges to existing geometry

I've puzzled about this for a while, but haven't found an answer I understood. This snippet below does add geometry (3 verts and a face) but it also generates an error, Does going to object mode make ...
15
votes
1answer
13k views

How can n-gons be selected?

Editing a mesh for a while I didn't notice that I created a n-gon. After adding a subsurf modifier the mesh heavily deformed, it took while until I found this: Is there an easy way to select n-gons?
14
votes
4answers
8k views

What is the technical difference between an Ngon and a bunch of Triangles?

I read somewhere that Ngons were nothing more than triangles masked as an Ngon. Some testing reveals this is not true, at least to some extent. Here are two sub-surfed cylinders, one with an Ngon, ...
10
votes
4answers
1k views

Scripting: low level join meshes / elements (hopefully with bmesh)?

Currently I only know of one way to join meshes - using the join operator: bpy.ops.object.join() This has an annoying overhead of additional operations required ...
10
votes
2answers
9k views

How to add a UV Map to a Mesh Using Python

I've made a script that creates a mesh in Blender using a binary file containing mesh data. That works fine, but now I need to get textures on the mesh and I want to create a UV map from the UV data ...
9
votes
3answers
2k views

How to keyframe mesh vertices in Python

I'm updating all the vertex coordinates of a mesh frame-by-frame in python and need to animate but can not figure out how. Here is a small abstracted script - the python isn't pretty, but it makes an ...
8
votes
1answer
1k views

How do I stop vertex normals getting overwritten when I enter edit mode?

I'm trying to make a script to apply vertex normals based on selected faces. So far I have written the script and it works fine, but if I exit edit mode and then re-enter edit mode, the normals get ...
7
votes
2answers
3k views

Assigning material to every second face via python

I want to do something like this with a python script and selecting the vertex in the middle: I tried with many ideas as: ...
7
votes
1answer
3k views

Select neighbour faces from a mesh with python

I am new to blender and python and try to get the hang of it. PS: Everything should be achieved via python script. I want to create a low poly model via ico-sphere. That's really easy because I just ...
6
votes
2answers
2k views

how to create and extrude a bmesh face

I would like to programmatically create and extrude polygons. I've found several examples of code (e.g. here), but none of them are currently working for me. As a simple example, I am trying to get ...
6
votes
1answer
914 views

Are there any tools for making irregular polygons regular?

Are there any tools in Blender that take irregular polygons and make them regular (approximate a circle)? I'm specifically looking for a solution that works with preexisting polygons. Also, it would ...
5
votes
2answers
709 views

Selecting a face in a script so that you can edit eg resize it?

I was trying to write a script to generate an object from primitives but came across a problem I couldn't solve. The code generates a cylinder and finds the face as well as putting it into edit mode. ...
5
votes
1answer
451 views

How can I find out the correct order of vertices to create a quad face with bmesh?

Let's say I have 4 vertices and want to create a quad face with bmesh. Is there way to figure out the right order of the vertices to not get a face like this But rather a face like this.
5
votes
1answer
630 views

Getting the number of faces a certain vertex is part of

I am in edit mode and using bmesh to get all faces. I am iteration through the faces and their vertices. Now I want to know on how many faces the vertex, I currently have, is part of. For example ...
5
votes
2answers
1k views

How to delete all faces with distance to other object

I want to delete all faces (of "Mesh") with a distance > 0.5 to the nearest point of an other object ("Sphere"). Unfortunately it deletes the whole object. Thanks for helping! ...
5
votes
1answer
373 views

Boolean Operations

I'm trying to manipulate a number of BMesh items in code with the hope of stitching them together, via boolean operators, to produce more complex geometries/meshes. Do BMesh instances support boolean ...
5
votes
3answers
987 views

BMesh polygons with holes

Is it possible to create a BMesh polygon (BMFace) with holes via Python? Use case. I need that for my addons that import geographical data. A polygon for Rome has a hole for Vatican City.
4
votes
2answers
1k views

How is possible to create a tetrakaidecahedron? How can I keep only the edges?

The idea I have is to start from the tetrakaidecahedron, have the edges and create something organical as the photomicrograph below. Photomicrograph of open-cell foamed urethane
4
votes
2answers
3k views

How to fix ngons overlapping wire edges?

I am trying to make a retopo of my human head. But it seems that I already have several ngons because I couldn't create an edge loop. So I checked it with mesh lint and it showed me the ngons But ...
4
votes
3answers
2k views

Finding the lists of connected indices associated with disjoint mesh elements

Is there a fast way (without looping over all edges/faces/verts) using ops.mesh or bmesh to get the lists of indices associated ...
4
votes
2answers
2k views

Is there a way to select edges marked as sharp via python?

There is an operator to select sharp edges, and an operator to select edges marked as sharp if you have already an edge marked as sharp selected, but is there a way to select edges marked as sharp ...
4
votes
1answer
444 views

How to find a mesh loops and rings

I'm trying to find a clear, safe, simple explanation to the ring and loop madness. I select an edge: Then I run this script: ...
4
votes
1answer
1k views

Applying per-vertex colors to new Bmesh

I'm having trouble applying vertex colors through Python to a mesh. The mesh is imported from a file which has vertex info, face info (vertex indices), and a list of colors that corresponds to each ...
4
votes
1answer
362 views

Is there a way to clear sharp edges using bmesh in python?

I'm trying to speed up an addon that had to toggle into Edit Mode for sometimes thousands of object by staying at the object level using bmesh instead of ...
4
votes
2answers
1k views

Use the bevel-tool from python script

I want to use the bevel-tool to add a face between two other faces. The bevel-tool should use the selected edge(s) as geometry.location is given via a selected edge. This is what I have This is ...
4
votes
1answer
607 views

Replacing all mesh elements in a Mesh object

I'm working on the Animation Nodes Addon and want to create some new nodes which can work with mesh data like polygons. To output the created mesh I have to put it onto an object like this: ...
4
votes
1answer
1k views

Order of vertices added using Python script and bmesh

I am using Blender 2.71 and Python 3.4.0 and I would like to add a row of vertices in such a way that I can call them using bmesh.verts[] in the same order that I ...
4
votes
1answer
775 views

How to access vertex_color layer directly from inside BMVert

I want to access vertex colors directly from inside BMVerts, but I don't know how. I am able to access vertex colors indirect for inside BMFaces: ...
3
votes
1answer
4k views

How do I prevent particle objects from intersecting each other and going though the floor?

The first step is to "throw" a group of steel tubes at a floor. They should bounce, and roll a bit. When they come to rest the next animated step begins: They will use shape keys to morph into an ...
3
votes
2answers
734 views

Removing doubles on imported 3DXML ngon mesh

Pertaining to building objects created from the script shown in the answer here https://blender.stackexchange.com/a/42590/15543 The import data has seperate vert data for each surface, so each face ...
3
votes
2answers
611 views

Creating pockets using bmesh/python

I'm trying to figure out how to create a pocket using bmesh (Python Console). The regular workflow to create the example below could be as follows — Add a Cube in Object Mode, tab into Edit Mode and ...
3
votes
2answers
5k views

How can I triangulate a mesh without changing the object?

I have to triangulate the object's mesh because the format I export to only understands triangles. Now I not only want to export geometry but also the uv-mappings for the mesh. Let's call the ...
3
votes
2answers
430 views

Adding Edge Loops Around Airplane Window

I would like to add an edge loop around each one of these windows and are not 100% sure on the best way to do it even after watching some videos. If someone could point me in the right direction that ...
3
votes
1answer
663 views

Access color of a point given the 3D position (on the surface of a polygon)

My problem consists in accessing the color of a given point (I know the 3D coordinates (x,y,z) that lies on one surface of a mesh. I use raytracing to get the 3D position of the point casting a ray ...
3
votes
1answer
590 views

creating n random points on face of mesh

I'm trying to select 400 or so random points on the face of a mesh using a script (just on the face, not inside the volume) but I'm not sure how to do that. I've tried looking into the following ...
3
votes
1answer
309 views

making angle label - spin vertices with python script

I would like to make an simple angle label such as this: using the python script to construct it. The problem is trying to spin a MeshVertex, as the code looks for a Mesh object instead when using ...
3
votes
1answer
1k views

Cut BMesh with python

Goal: Efficiently cut out (holes) or trim off regions of dense meshes defined by editable polyline or bezier curves which are snapped to a mesh surface. Uses: My narrow use is to cut teeth out of ...
3
votes
2answers
1k views

how add properties to operator modal draw?

UPDATE Here another example in order to clarify this question, I did a video in order to resume the problem https://www.youtube.com/watch?v=yShhJOzkJBk: here the addon working without the BGL CODE.....
3
votes
1answer
852 views

Manipulate Vertex group names in the bmesh API

When importing an object with my own script (Yes, I need one, no functional script exists) I want to import it with help of the bmesh-module. It seems to be the ...
3
votes
2answers
47 views

Argument values in `bmesh.ops.similar_verts()`

Can someone please help me understand the values for the arguments in the function bmesh.ops.simlar_verts(bm, verts, type, thresh, compare) I understand that: <...
3
votes
1answer
245 views

Using custom vertex data in render

Can float vertex layer data added with bmesh, be used in rendering? Let us say we added some data to all verteces: bm.verts.layers.float.new('G') Can this "G" ...
3
votes
1answer
1k views

Error after script selects object and tries to change to “EDIT” mode

This script builds a 3-digit, 7-segment red LED display and cycles through 0-315 in steps of 45. But it doesn't quite work. When changing the first digit to "EDIT" mode in order to change the ...
3
votes
1answer
323 views

Align Object A to Object B to their respective active faces with python

i want to Align two objects depending on their active faces like in this gif below didn't find any answers but only this clue below from this question: Align to face normal vector but it only align ...
3
votes
1answer
992 views

What is the loop order of bmesh faces?

Let's suppose I create a bmesh with the following commands: import bmesh bm = bmesh.new() bm.from_mesh(obj.data) bmesh.ops.triangulate(bm, faces=bm.faces) Have a ...
3
votes
2answers
158 views

Problem with BMesh Vertex Location Precision

I'm writing an add-on that imports vertex locations and builds a BMesh by placing vertices at those locations. I'm running into precision issues, since the imported data can be large floating point ...
3
votes
1answer
145 views

OSM skillion roof with bmesh… need an alternative to ray_cast

OSM buildings with the skillion roof shape, are often tagged with only direction and levels. ...
3
votes
1answer
785 views

How to discretize a 3D mesh to generate a 3D binary matrix

I apply the algorithm proposed by TLousky discretize a mesh to discretize the entire mesh. I get this result ...
3
votes
0answers
45 views

Getting Color Values Produced by Dynamic Paint

I am having trouble with the python code to get the colors of vertices when using Dynamic Paint. If I try painting a cube using the Vertex Paint mode I can get the rgb values of the vertices using the ...

1 2 3 4 5