<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
  <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>NMesh and edges</title></head>

<body>
<big style="font-weight: bold;"><big><big><big>NMesh and edges</big></big></big></big><br>
<br>
<a href="#general">General facts</a><br>
<a href="#edata">Edge data in NMesh</a><br>
<a href="#storeornote">Storing or not storing edges at NMesh.update</a><br>
<a href="#synch">Synchronizing edge list with face list</a><br>
<a href="#addedges">Adding edges</a><br>
<a href="#dedge">Deleting edge</a><br>
<h1><a name="general"></a>General facts</h1>
In blender, a mesh has not always edges data. (Mesh.medge
pointer can be NULL).<br>
<br>
If a mesh has no edges informations, the edges selection is not
restored after quiting mesh edition.<br>
<br>
When a mesh has no edges informations, edges that don't belong to any
face (edges that have been created by selecting two vertices and
pressing F-key) are stored as faces with only two vertices. When edges
informations are available, those faces are replaces by real edges. If
you select a mesh with two-vertices-faces and create edge data (by
clicking on <span style="font-style: italic;">Edges > Make</span>
button in the Mesh panel of button window), then faces with only two
edges will still exists and also corresponding edges will exist. But as
soon as you enter edit mode, faces with two edges are destroyed.<br>
<br>
Between two vertices there can be zero or one edge. There is never more
than one edge that links two vertices.<br>
<h1><a name="edata"></a>Edge data in NMesh</h1>
As for the mesh in blender, a NMesh has not always edges data.<br>
A member function of the NMesh class, creates edges data if they don't
exist.<br>
Another member function can query if edges data exists.<br>
<br>
<span style="font-weight: bold;">NMesh.addEdgesData</span>()<br>
<span style="font-weight: bold;">NMesh.hasEdgesData</span>()<br>
<br>
The edges are stored as a list of NMEdge objects:<br>
<span style="font-weight: bold;">NMesh.edges</span><br>
<br>
NMEdge has four data members:<br>
v1, v2, crease, flag<br>
<br>
<h1><a name="storeornote"></a>Storing or not storing edges at
NMesh.update</h1>
<span style="color: rgb(51, 51, 255);"><span style="color: rgb(153, 0, 0);"></span></span>A parameter to NMesh.update() will enable edge data storage.<br>
If a NMesh has edge data and if this parameter is set,
then they will be stored. Else no edge data will be stored.<br>
<span style="font-weight: bold;">NMesh.update</span>(recalc_normals=0, store_edges=0)<br>
<span style="color: rgb(51, 51, 255);"></span><span style="font-weight: bold;">PutRaw</span>(nmesh, name=None, recalculate_normals=1, store_edges=0) <br>
<h1><a name="synch"></a>Synchronizing edge list with face list</h1>
There is a link between the edges in a mesh and the list of faces. When
a face is added then for each pair of vertices, if no edge already
exists, a new edge is created.<br>
<br>
That means that when a NMesh has edge data, then the user should not
directly modify NMesh.faces list.<br>
A member of NMesh class add face to face list and creates edge that do
not exist if the NMesh has edge data.<br>
face=<span style="font-weight: bold;">NMesh.addFace</span>(face)<br>
<br>
If a face exists but some of its edges don't exist when calling
NMesh.update(), then they will be created with default values and added
to the blender Mesh.<br>
<h1><a name="addedges"></a>Adding edges</h1>
To create edges, NMesh object has a member function that first check if
the same edge already exists. If it exists, this function won't create
a new edge but return the found one. If it does not exist a new NMEdge
is created and added to the edge list.<br>
edge=<span style="font-weight: bold;">NMesh.addEdge</span>(v1, v2)<br>
<h1><a name="dedge"></a>Deleting edge</h1>
Deleting an edge implies deleting faces that uses this edge.<br>
To delete an edge, NMesh object has a member function:<br>
NMesh.<span style="font-weight: bold;">removeEdge</span>(v1, v2)<br>
<br>
<span style="color: rgb(51, 51, 255);"></span>
</body></html>