SketchNurbs#

class ansys.geometry.core.sketch.nurbs.SketchNurbs#

Bases: ansys.geometry.core.sketch.edge.SketchEdge

Represents 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_curve_from_points

Fit a NURBS curve to a set of points.

contains_point

Check if the curve contains a given point within a specified tolerance.

geomdl_nurbs_curve

Get the underlying NURBS curve.

control_points

Get the control points of the curve.

degree

Get the degree of the curve.

knots

Get the knot vector of the curve.

weights

Get the weights of the control points.

start

Get the start point of the curve.

end

Get the end point of the curve.

visualization_polydata

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.degree: int#

Get the degree 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.PolyData

VTK 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, tolerance: ansys.geometry.core.typing.Real = 1e-06) bool#

Check if the curve contains a given point within a specified tolerance.

Parameters:
pointPoint2D

The point to check.

toleranceReal, optional

The tolerance for the containment check, by default 1e-6.

Returns:
bool

True if the curve contains the point within the tolerance, False otherwise.

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.

Parameters:
pointslist[Point2D]

The points to fit the curve to.

degreeint, optional

The degree of the NURBS curve, by default 3.

Returns:
SketchNurbs

A new instance of SketchNurbs fitted to the given points.