ddg.conversion.blender.halfedge module
- ddg.conversion.blender.halfedge.hes_to_bmesh(hes, co_attr='co', bpy_data=None)[source]
Converts a given half-edge surface into a bmesh.
The returned bmesh can then be used for handing over the surface to Blender.
- Parameters:
- hesddg.halfedge.Surface
The half-edge 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 half-edge surface.
- ddg.conversion.blender.halfedge.vertex_objects(heobj, bobj, collection=None, location_attr='co', rotation_attr=None, scale_attr=None, material_attr=None)[source]
places a Blender object at every vertex of the given half-edge object.
- Parameters:
- heobjddg.halfedge.Surface
Half-edge object of which each vertex will have a given Blender object placed on it.
- bobjbpy.types.Object
Blender object to duplicate.
- collectionbpy.types.Collection , (default=None)
Links all duplicate objects to given collection. if None, then duplicates are not linked.
- location_attrstr (default=’co’)
Name of vertex attribute storing the Euclidean coordinates.
- rotation_attrstr (default=None)
Name of vertex attribute storing a 4x4 rotation matrix to be applied to the duplicate.
- scale_attrstr (default=None)
Name of vertex attribute storing a 4x4 scaling matrix to be applied to the duplicate.
- material_attrstr (default=None)
Name of vertex attribute storing name of Blender material or a Blender material to be applied to the duplicate.
- Returns:
- vobjs: list
- List of Blender objects placed at each vertex of given half-edge object.
- ddg.conversion.blender.halfedge.edge_objects(heobj, bobj, collection=None, location_attr='co', rotation_attr=None, scale_attr=None, material_attr=None)[source]
Places a Blender object at every edge of the given half-edge object.
- Parameters:
- see vertex_object.
- Returns:
- vobjs: list
- list of Blender objects placed at each edge of given half-edge object.
Notes
Half-edge edge’s does not natively store a location attribute this must be calculated and added as an attribute before hand.
- ddg.conversion.blender.halfedge.face_objects(heobj, bobj, collection=None, location_attr='co', rotation_attr=None, scale_attr=None, material_attr=None)[source]
places a Blender object at every face of the given half-edge object.
- Parameters:
- see vertex_object.
- Returns:
- vobjs: list
- list of Blender objects placed at each face of given half-edge object.
Notes
Half-edge face’s does not natively store a location attribute this must be calculated and added as an attribute before hand.
- ddg.conversion.blender.halfedge.vertex_spheres(heobj, location_attr='co', sphere_radius=0.1, sphere_subdivision_steps=2, material_attr=None, scale_attr=None, collection=None)[source]
Places a Blender object sphere at every vertex of a given half-edge object.
- Parameters:
- heobjddg.halfedge.Surface
Helfedge object of which each vertex will have a sphere placed
- location_attrstr (default=’co’)
name of vertex attribute storing the euclidean coordinates.
- sphere_radiusfloat (default =0.1)
Radius of the icospheres at the vertices.
- sphere_subdivision_stepsint (default=2)
Number of subdivisions of the icospheres at the vertices.
- materialstr (default=None)
Name of vertex attribute storing name of Blender material or a Blender material to applied to the vertex sphere.
- scale_attrstr (default=None)
Name of vertex attribute storing a 4x4 scaling matrix to be applied to the vertex sphere.
- collectionbpy.types.Collection (default=None)
- links all duplicate objects to given collection
- Returns:
- List of Blender spheres at each vertex
- ddg.conversion.blender.halfedge.edge_tubes(heobj, tube_radius=0.05, tube_resolution=20, fill_tube_caps=True, material_attr=None, location_attr='co', scale_attr=None, collection=None, atol=None, rtol=None)[source]
Places a Blender object cylinder at every edge of a given half-edge object.
- Parameters:
- heobjddg.halfedge.Surface
Half-edge object of which each edge will have a cylinder placed.
- tube_radiusfloat (default=0.5)
Radius of the edge tube.
- tube_resolutionint (default=20)
Resolution of the edge tube, i.e., number of faces of a tube.
- fill_tube_capsbool (default=True)
Decides whether the ends of the tubes are closed by faces (or left open).
- materialstr (default=None)
Name of vertex attribute storing name of Blender material or a Blender material to applied to the edge tube.
- scale_attrstr (default=None)
Name of vertex attribute storing a 4x4 scaling matrix to be applied to the edge tube.
- location_attrstr (default=’co’)
name of vertex attribute storing the euclidean coordinates.
- collectionbpy.types.Collection (default=None)
links all duplicate objects to given collection.
- atol, rtolfloat (default=None)
If None, the global defaults will be used. See
ddg.nonexactfor details.
- Returns:
- List of Blender cylinders placed along each edge.
- 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, atol=None, rtol=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.
- atol, rtolfloat (default=None)
If None, the global defaults will be used. See
ddg.nonexactfor details.
- Returns:
- blender.types.Object
Blender object that stores tubes and spheres as children.
Deprecated since version 0.1.0: This will be removed in 0.2.0. Use
vertex_spheresandedge_tubesinstead.