Custom Deformation [CAD]¶
Module for custom deformations to CAD geometries.
- class CustomDeformation(func, u_knots_to_add=0, v_knots_to_add=0, t_knots_to_add=0, tolerance=0.0001)[source]
Bases:
pygem.cad.cad_deformation.CADDeformation
,pygem.custom_deformation.CustomDeformation
Class to perform a custom deformation to the CAD geometries.
- Parameters
func (callable) – the function definying the deformation of the input points. This function should take as input: i) a 2D array of shape (n_points, 3) in which the points are arranged by row, or ii) an iterable object with 3 components. In this last case, computation of deformation is not vectorizedand the overall cost may become heavy.
u_knots_to_add (int) – the number of knots to add to the NURBS surfaces along u direction before the deformation. This parameter is useful whenever the gradient of the imposed deformation present spatial scales that are smaller than the local distance among the original poles of the surface/curve. Enriching the poles will allow for a more accurate application of the deformation, and might also reduce possible mismatches between bordering faces. On the orther hand, it might result in higher computational cost and bigger output files. Default is 0.
v_knots_to_add (int) – the number of knots to add to the NURBS surfaces along v direction before the deformation. This parameter is useful whenever the gradient of the imposed deformation present spatial scales that are smaller than the local distance among the original poles of the surface/curve. Enriching the poles will allow for a more accurate application of the deformation, and might also reduce possible mismatches between bordering faces. On the orther hand, it might result in higher computational cost and bigger output files. Default is 0.
t_knots_to_add (int) – the number of knots to add to the NURBS curves before the deformation. This parameter is useful whenever the gradient of the imposed deformation present spatial scales that are smaller than the local distance among the original poles of the surface/curve. Enriching the poles will allow for a more accurate application of the deformation, and might also reduce possible mismatches between bordering faces. On the orther hand, it might result in higher computational cost and bigger output files. Default is 0.
tolerance (float) – the tolerance involved in several internal operations of the procedure (joining wires in a single curve before deformation and placing new poles on curves and surfaces). Change the default value only if the input file scale is significantly different form mm, making some of the aforementioned operations fail. Default is 0.0001.
- Variables
u_knots_to_add (int) – the number of knots to add to the NURBS surfaces along u direction before the deformation.
v_knots_to_add (int) – the number of knots to add to the NURBS surfaces along v direction before the deformation.
t_knots_to_add (int) – the number of knots to add to the NURBS curves before the deformation.
tolerance (float) – the tolerance involved in several internal operations of the procedure (joining wires in a single curve before deformation and placing new poles on curves and surfaces).
- Example
>>> from pygem.cad import CustomDeformation >>> def move(x): >>> return x + x**2 >>> deform = CustomDeformation(move) >>> deform('original_shape.iges', dst='new_shape.iges')