SketchNurbs#
- class ansys.geometry.core.sketch.nurbs.SketchNurbs#
Bases:
ansys.geometry.core.sketch.edge.SketchEdgeRepresents a NURBS sketch curve.
Warning
NURBS sketching is only supported in 26R1 and later versions of Ansys.
Notes
This class is a wrapper around the NURBS curve class from the geomdl library. By leveraging the geomdl library, this class provides a high-level interface to create and manipulate NURBS curves. The geomdl library is a powerful library for working with NURBS curves and surfaces. For more information, see https://pypi.org/project/geomdl/.
Overview#
Fit a NURBS curve to a set of points. |
|
Create an exact rational NURBS for a partial ellipse arc. |
Check if the curve contains a given point within a specified tolerance. |
Get the underlying NURBS curve. |
|
Get the control points of the curve. |
|
Get the degree of the curve. |
|
Get the knot vector of the curve. |
|
Get the weights of the control points. |
|
Get the start point of the curve. |
|
Get the end point of the curve. |
|
Get the VTK polydata representation for PyVista visualization. |
Import detail#
from ansys.geometry.core.sketch.nurbs import SketchNurbs
Property detail#
- property SketchNurbs.geomdl_nurbs_curve: geomdl.NURBS.Curve#
Get the underlying NURBS curve.
Notes
This property gives access to the full functionality of the NURBS curve coming from the geomdl library. Use with caution.
- property SketchNurbs.control_points: list[ansys.geometry.core.math.point.Point2D]#
Get the control points of the curve.
- property SketchNurbs.knots: list[ansys.geometry.core.typing.Real]#
Get the knot vector of the curve.
- property SketchNurbs.weights: list[ansys.geometry.core.typing.Real]#
Get the weights of the control points.
- property SketchNurbs.start: ansys.geometry.core.math.point.Point2D#
Get the start point of the curve.
- property SketchNurbs.end: ansys.geometry.core.math.point.Point2D#
Get the end point of the curve.
- property SketchNurbs.visualization_polydata: pyvista.PolyData#
Get the VTK polydata representation for PyVista visualization.
- Returns:
pyvista.PolyDataVTK pyvista.Polydata configuration.
Notes
The representation lies in the X/Y plane within the standard global Cartesian coordinate system.
Method detail#
- SketchNurbs.contains_point(point: ansys.geometry.core.math.point.Point2D, tol: float = 1e-06) bool#
Check if the curve contains a given point within a specified tolerance.
- classmethod SketchNurbs.fit_curve_from_points(points: list[ansys.geometry.core.math.point.Point2D], degree: int = 3) SketchNurbs#
Fit a NURBS curve to a set of points.
- classmethod SketchNurbs.partial_ellipse(center: ansys.geometry.core.math.point.Point2D, major_radius: pint.Quantity | ansys.geometry.core.misc.measurements.Distance | ansys.geometry.core.typing.Real, minor_radius: pint.Quantity | ansys.geometry.core.misc.measurements.Distance | ansys.geometry.core.typing.Real, start_angle: pint.Quantity | ansys.geometry.core.misc.measurements.Angle | ansys.geometry.core.typing.Real, end_angle: pint.Quantity | ansys.geometry.core.misc.measurements.Angle | ansys.geometry.core.typing.Real, angle: pint.Quantity | ansys.geometry.core.misc.measurements.Angle | ansys.geometry.core.typing.Real = 0) SketchNurbs#
Create an exact rational NURBS for a partial ellipse arc.
- Parameters:
- center
Point2D Center of the ellipse.
- major_radius
Quantity|Distance|Real Semi-major axis length (x-direction before rotation).
- minor_radius
Quantity|Distance|Real Semi-minor axis length (y-direction before rotation).
- start_angle
Quantity|Angle|Real Parametric start angle. Defaults to radians when given as a
Real.- end_angle
Quantity|Angle|Real Parametric end angle. Defaults to radians when given as a
Real. The arc sweeps counter-clockwise whenend_angle > start_angle.- angle
Quantity|Angle|Real, default: 0 Rotation of the ellipse about its center (radians when
Real).
- center
- Returns:
SketchNurbsExact rational quadratic NURBS (degree 2) for the requested arc. The arc is split into segments of at most 90° for numerical stability.
- Raises:
ValueErrorIf either radius is non-positive.
ValueErrorIf
start_angleequalsend_angle(zero-length arc).