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
14
votes
4answers
9k 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, ...
16
votes
2answers
12k 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 ...
3
votes
2answers
444 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 ...
1
vote
1answer
1k views

Can't write bmesh object back to mesh datablock

I'm struggling to learn Blender's structures and types and use Python to modify meshes. In trying to sort out image updating, bmesh and mesh data, I copied the following code from the Blender 2.64 ...
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 ...
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! ...
3
votes
2answers
754 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 ...
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 ...
3
votes
1answer
2k 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 ...
5
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 ...
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 ...
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: ...
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?
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 ...
2
votes
1answer
2k views

BMesh get edge loop

I'm trying to get edge loop, starting from one edge and continuing as far as the loop goes. This atrocity (below) doesn't work, because vertex index order is disrupted. So I have no apparent way of ...
1
vote
1answer
810 views

Custom data of vertices, Vertex Layers

I found this answer (first answer) Python: assign custom tag to vertices I'm pretty excited of this. But I have some questions: 1) How to get all vertices which have 'my_id' custom data? 2) How to ...
6
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 ...
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
760 views

bmesh - extrude face and end up with closed mesh

When you extrude the only face of a plane via the GUI you get a (closed) cube. If you do the same thing using bmesh you get a cube that is open on the bottom side. ...
1
vote
2answers
1k views

What is the fastest way of creating a large mesh/object built from smaller mesh “building blocks”

I realize similar questions have been asked before and I followed the advice given there but I hope to gain more insight on the matter here. I've added a lot of details, I hope it's not too much. I ...
1
vote
1answer
479 views

Python: Edit panel to edit custom bmesh face layers?

With the bmesh module, I added a custom data layer to a mesh, holding information for each face. ...
1
vote
1answer
612 views

Setting mesh's origin in python (2.8)

If I create a cube, the origin is originally at the center of mass. I know how to move the origin to the center of one of its faces using the interface, but how can I do the same thing via Python?
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 ...
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 ...
3
votes
1answer
684 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 ...
2
votes
1answer
3k views

When to use bmesh.update_edit_mesh and when Mesh.update?

When is it appropriate to use one over the other? In example, I have the following: ...
6
votes
1answer
934 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 ...
2
votes
1answer
1k views

Set active vertex through python

I am having a problem trying to set the active vertex in blender. I have a list of vertices but I cannot set the active vertex. I am able to retrieve the active vertex through select_history of the ...
2
votes
1answer
635 views

Does bmesh guarantee order of vertex in a edge according to the time they were added

I would like to represent directions in a single edge in a mesh similar to a curve. However I cannot use curves themselves due to performance issues when dealing with huge amount of curves and not ...
2
votes
2answers
1k views

Bmesh: how can I import custom vertex normals

I have a question concerning BMesh and custom vertex normals editing. At the moment I am writing a little blender importer for a custom data format and I am stuck with importing/manipulating custom ...
2
votes
1answer
407 views

Python: fix normal of a new polygon

I've been working on retopo tools. I have created polygon loops with "bmesh.faces.new()". But i get a problem with face normal orientation. Some faces get inverted direction. Here is my test: http://...
2
votes
1answer
430 views

selection history from “shortest path”?

is it possible to retrieve the selection history(the specific sequence) of vertices selected using "shortest path"? Using bmesh, I can get the selection history by doing: ...
1
vote
0answers
240 views

Calculate a surface by checking if meshes intersect

In addition to this unresolved question, I would like to add another problem: The main problem is that I made a few hundreds of random non overlapping circles that belong to the same mesh object, and ...
1
vote
2answers
622 views

What is the best way to copy/append geometry from one bmesh to another

I get geometry from bisecting some mesh bm_tmp by a plane and I want to copy/append the resulting geometry r['geom_cut'] (only ...
5
votes
3answers
1k 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.
5
votes
1answer
638 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 ...
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
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
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 ...
2
votes
2answers
180 views

How do I use bmesh on a set?

I have an array that is called ccValids, which contains "good" center coordinates for the cylinders I want to create. These cylinders are created as follows: ...
2
votes
2answers
421 views

Python BMESH: For loop breaking trying to split mesh via UV Islands

Perhaps I am not using bmesh properly. I'm trying to create a script that splits a mesh by it's UV islands. The script attempts to iterate through each face of mesh and... select a face. select ...
2
votes
1answer
888 views

Script to separate an object's mesh without using bpy.ops

I've seen several posts suggesting that it's better to write functions that manipulate bpy.data directly, instead of using the bpy.ops operators. I can understand the argument about how operators such ...
1
vote
2answers
75 views

merge vertices at center bmesh

I have a script that makes 2 circles extrude them then bridge loop them and finally solidify. After solidify is done I noticed that the inner vertices are overlapping instead of merged. (See ...
1
vote
1answer
514 views

Is there a better way to rotate the order of vertices of currently selected faces in edit mode?

I've been playing with duplifaces and it turns out the orientation of the copied geometry depends on the order of the vertices in the face (https://developer.blender.org/T30547). Since I'm unhappy ...
1
vote
1answer
53 views

Should I convert my quad mesh to triangles? If so, can I do it in this script?

I have topographical data which is height on a square lat/lon grid and I've generated a mesh with the script shown below. My polygons are all quadrangles (close to, but not quite squares in this case) ...
1
vote
1answer
684 views

There is a way to add custom split normal use Python API?

I can't find a way to achieve custom split normal effect. I want to use python (mesh normal/hard edge or soft edge) data collected from Maya then write to Blender mesh. How to do it using the ...
1
vote
2answers
97 views

How to remove dead BMVerts from a list?

I am trying to fix a bug in my script that happens in rare instances. I believe the bug occurs due to the very last thing the script is doing, which is: ...
1
vote
1answer
252 views

How to obtain selected UV pairs on same edge in Python?

I have a problem about Python scripting in Blender. I want to get selected UV pairs on same edge and write below code. ...
0
votes
2answers
677 views

Rotate bmesh around Vector with Python

I try to rotate a bmesh around a vector as axis. ...
0
votes
1answer
77 views

How to get list of bm.verts that belong to a deform layer?

I have a previously assigned Vertex Groups on my object. After creating the bmesh, if I understand correctly that Vertex Group should now be ...