fabex.utilities.silhouette_utils#
Functions#
|
Offset the silhouette of a curve or font object in Blender. |
|
Get the silhouette of objects based on the specified type. |
|
Gets the silhouette for the given operation. |
|
Get the outline of a geometric object based on specified parameters. |
Module Contents#
- silhouette_offset(context, offset, style=1, mitrelimit=1.0)[source]#
Offset the silhouette of a curve or font object in Blender.
This function takes an active curve or font object in Blender and creates an offset silhouette based on the specified parameters. It first retrieves the silhouette of the object and then applies a buffer operation to create the offset shape. The resulting shape is then converted back into a curve object in the Blender scene.
- Parameters:
context (bpy.context) – The current Blender context.
offset (float) – The distance to offset the silhouette.
style (int?) – The join style for the offset. Defaults to 1.
mitrelimit (float?) – The mitre limit for the offset. Defaults to 1.0.
- Returns:
A dictionary indicating the operation is finished.
- Return type:
dict
- get_object_silhouette(stype, objects=None, use_modifiers=False)[source]#
Get the silhouette of objects based on the specified type.
This function computes the silhouette of a given set of objects in Blender based on the specified type. It can handle both curves and mesh objects, converting curves to polygon format and calculating the silhouette for mesh objects. The function also considers the use of modifiers if specified. The silhouette is generated by processing the geometry of the objects and returning a Shapely representation of the silhouette.
- Parameters:
stype (str) – The type of silhouette to generate (‘CURVES’ or ‘OBJECTS’).
objects (list?) – A list of Blender objects to process. Defaults to None.
use_modifiers (bool?) – Whether to apply modifiers to the objects. Defaults to False.
- Returns:
The computed silhouette as a Shapely MultiPolygon.
- Return type:
shapely.geometry.MultiPolygon
- get_operation_silhouette(operation)[source]#
Gets the silhouette for the given operation.
This function determines the silhouette of an operation using image thresholding techniques. It handles different geometry sources, such as objects or images, and applies specific methods based on the type of geometry. If the geometry source is ‘OBJECT’ or ‘COLLECTION’, it checks whether to process curves or not. The function also considers the number of faces in mesh objects to decide on the appropriate method for silhouette extraction.
- Parameters:
operation (Operation) – An object containing the necessary data
- Returns:
The computed silhouette for the operation.
- Return type:
Silhouette
- get_object_outline(radius, o, Offset)[source]#
Get the outline of a geometric object based on specified parameters.
This function generates an outline for a given geometric object by applying a buffer operation to its polygons. The buffer radius can be adjusted based on the radius parameter, and the operation can be offset based on the Offset flag. The function also considers whether the polygons should be merged or not, depending on the properties of the object o.
- Parameters:
radius (float) – The radius for the buffer operation.
o (object) – An object containing properties that influence the outline generation.
Offset (bool) – A flag indicating whether to apply a positive or negative offset.
- Returns:
The resulting outline of the geometric object as a MultiPolygon.
- Return type:
MultiPolygon