ddg.conversion.blender.halfedge module

ddg.conversion.blender.halfedge.hes_to_bmesh(hes, co_attr='co', bpy_data=None)[source]

Converts a given halfedge surface into a bmesh.

The returned bmesh can then be used for handing over the surface to blender.

Parameters:
hesddg.halfedge.Surface

The halfedge surface that shall be converted to a bmesh.

co_attrcoordinate attribute

The type of coordinates that will be taken for conversion.

bpy_databmesh (optional, default=None)

When given, bmesh to save the data into.

Returns
——-
bmesh

The bmesh corresponding to the input halfedge surface.

ddg.conversion.blender.halfedge.hes_to_tubes_and_spheres_blender_object(hes, co_attr='co', tube_resolution=20, fill_tube_caps=True, tube_radius=0.05, sphere_subdivision_steps=2, sphere_radius=0.1, parent_kwargs={}, kwargs_generator=None)[source]

Converts a given half-edge surface to a blender object consisting of tubes and spheres.

The tubes represent the edges and the spheres represent the vertices of the surface. Their respective blender objects are linked to a common parent object. Smooth shading is always enabled.

Parameters:
hesddg.halfedge.Surface

The half-edge surface that shall be converted to a Blender object.

co_attrstr (default=’co’)

The name of vertex attribute storing the euclidean coordinates.

tube_resolution: int (default=20)

Resolution of the edge tube, i.e., number of faces of a tube.

fill_tube_caps: bool (default=False)

Decides whether the ends of the tubes are closed by faces (or left open).

tube_radius: float (default=.05)

Radius of the edge tube.

sphere_subdivision_steps: int (default=2)

Number of subdivisions of the icospheres at the vertices.

sphere_radius: float (default=.1)

Radius of the icospheres at the vertices.

parent_kwargs: dict (default={})

Dictionary containing the keyword arguments that are handed to ddg.to_blender_object_helper when initializing the parent blender object.

kwargs_generator: function (default=None)

Function of signature kwargs_generator(cell) returning a kwargs dictionary where a cell can either be a vertex or an edge. If such a function is given, the returned dictionary will be handed over to ddg.to_blender_object_helper when creating the tubes and spheres. For example, it simply could return different material names for vertex spheres and edge tubes, respectively.

Returns:
blender.types.Object

Blender object that stores tubes and spheres as children.

ddg.conversion.blender.halfedge.hes_to_mesh(hes, name='Halfedge mesh', co_attr='co')[source]
ddg.conversion.blender.halfedge.hes_to_blender_object(hes, name='Halfedge object', co_attr='co', parent=None, matrix=array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]]))[source]