NURBSSurface#

class ansys.geometry.core.shapes.surfaces.nurbs.NURBSSurface(origin: ansys.geometry.core.math.Point3D = ZERO_POINT3D, reference: ansys.geometry.core.math.vector.UnitVector3D = UNITVECTOR3D_X, axis: ansys.geometry.core.math.vector.UnitVector3D = UNITVECTOR3D_Z, geomdl_object: geomdl.NURBS.Surface = None)#

Bases: ansys.geometry.core.shapes.surfaces.surface.Surface

Represents a NURBS surface.

Notes

This class is a wrapper around the NURBS surface class from the geomdl library. By leveraging the geomdl library, this class provides a high-level interface to create and manipulate NURBS surfaces. The geomdl library is a powerful library for working with NURBS curves and surfaces. For more information, see https://pypi.org/project/geomdl/.

Overview#

transformed_copy

Create a transformed copy of the surface.

contains_param

Check a parameter is within the parametric range of the surface.

contains_point

Check a point is contained by the surface.

project_point

Project a point to the surface.

from_control_points

Create a NURBS surface from control points and knot vectors.

fit_surface_from_points

Fit a NURBS surface to a set of points.

parameterization

Get the parametrization of the NURBS surface.

evaluate

Evaluate the surface at the given parameter.

geomdl_nurbs_surface

Get the underlying geomdl NURBS surface object.

control_points

Get the control points of the NURBS surface.

degree_u

Get the degree of the surface in the U direction.

degree_v

Get the degree of the surface in the V direction.

knotvector_u

Get the knot vector for the u-direction of the surface.

knotvector_v

Get the knot vector for the v-direction of the surface.

weights

Get the weights of the control points.

origin

Get the origin of the surface.

dir_x

Get the reference direction of the surface.

dir_z

Get the axis direction of the surface.

__eq__

Determine if two surfaces are equal.

Import detail#

from ansys.geometry.core.shapes.surfaces.nurbs import NURBSSurface

Property detail#

property NURBSSurface.geomdl_nurbs_surface: geomdl.NURBS.Surface#

Get the underlying geomdl NURBS surface object.

Notes

This property gives access to the full functionality of the NURBS surface coming from the geomdl library. Use with caution.

property NURBSSurface.control_points: list[ansys.geometry.core.math.Point3D]#

Get the control points of the NURBS surface.

property NURBSSurface.degree_u: int#

Get the degree of the surface in the U direction.

property NURBSSurface.degree_v: int#

Get the degree of the surface in the V direction.

property NURBSSurface.knotvector_u: list[ansys.geometry.core.typing.Real]#

Get the knot vector for the u-direction of the surface.

property NURBSSurface.knotvector_v: list[ansys.geometry.core.typing.Real]#

Get the knot vector for the v-direction of the surface.

property NURBSSurface.weights: list[ansys.geometry.core.typing.Real]#

Get the weights of the control points.

property NURBSSurface.origin: ansys.geometry.core.math.Point3D#

Get the origin of the surface.

property NURBSSurface.dir_x: ansys.geometry.core.math.vector.UnitVector3D#

Get the reference direction of the surface.

property NURBSSurface.dir_z: ansys.geometry.core.math.vector.UnitVector3D#

Get the axis direction of the surface.

Method detail#

classmethod NURBSSurface.from_control_points(degree_u: int, degree_v: int, knots_u: list[ansys.geometry.core.typing.Real], knots_v: list[ansys.geometry.core.typing.Real], control_points: list[ansys.geometry.core.math.Point3D], weights: list[ansys.geometry.core.typing.Real] = None, origin: ansys.geometry.core.math.Point3D = ZERO_POINT3D, reference: ansys.geometry.core.math.vector.UnitVector3D = UNITVECTOR3D_X, axis: ansys.geometry.core.math.vector.UnitVector3D = UNITVECTOR3D_Z) NURBSSurface#

Create a NURBS surface from control points and knot vectors.

Parameters:
degree_uint

Degree of the surface in the U direction.

degree_vint

Degree of the surface in the V direction.

knots_ulist[Real]

Knot vector for the U direction.

knots_vlist[Real]

Knot vector for the V direction.

control_pointslist[Point3D]

Control points for the surface.

weightslist[Real], optional

Weights for the control points. If not provided, all weights are set to 1.

deltafloat, optional

Evaluation delta for the surface. Default is 0.01.

originPoint3D, optional

Origin of the surface. Default is (0, 0, 0).

referenceUnitVector3D, optional

Reference direction of the surface. Default is (1, 0, 0).

axisUnitVector3D, optional

Axis direction of the surface. Default is (0, 0, 1).

Returns:
NURBSSurface

Created NURBS surface.

classmethod NURBSSurface.fit_surface_from_points(points: list[ansys.geometry.core.math.Point3D], size_u: int, size_v: int, degree_u: int, degree_v: int, origin: ansys.geometry.core.math.Point3D = ZERO_POINT3D, reference: ansys.geometry.core.math.vector.UnitVector3D = UNITVECTOR3D_X, axis: ansys.geometry.core.math.vector.UnitVector3D = UNITVECTOR3D_Z) NURBSSurface#

Fit a NURBS surface to a set of points.

Parameters:
pointslist[Point3D]

Points to fit the surface to.

size_uint

Number of control points in the U direction.

size_vint

Number of control points in the V direction.

degree_uint

Degree of the surface in the U direction.

degree_vint

Degree of the surface in the V direction.

originPoint3D, optional

Origin of the surface. Default is (0, 0, 0).

referenceUnitVector3D, optional

Reference direction of the surface. Default is (1, 0, 0).

axisUnitVector3D, optional

Axis direction of the surface. Default is (0, 0, 1).

Returns:
NURBSSurface

Fitted NURBS surface.

NURBSSurface.__eq__(other: NURBSSurface) bool#

Determine if two surfaces are equal.

NURBSSurface.parameterization() tuple[ansys.geometry.core.shapes.parameterization.Parameterization, ansys.geometry.core.shapes.parameterization.Parameterization]#

Get the parametrization of the NURBS surface.

The parameter is defined in the interval [0, 1] by default. Information is provided about the parameter type and form.

Returns:
tuple[Parameterization, Parameterization]

Parameterization in the U and V directions respectively.

abstractmethod NURBSSurface.transformed_copy(matrix: ansys.geometry.core.math.matrix.Matrix44) NURBSSurface#

Create a transformed copy of the surface.

NURBSSurface.evaluate(parameter: ansys.geometry.core.shapes.parameterization.ParamUV) ansys.geometry.core.shapes.surfaces.surface_evaluation.SurfaceEvaluation#

Evaluate the surface at the given parameter.

Parameters:
parameterParamUV

Parameter to evaluate the surface at.

Returns:
SurfaceEvaluation

Evaluation of the surface at the given parameter.

abstractmethod NURBSSurface.contains_param(param: ansys.geometry.core.shapes.parameterization.ParamUV) bool#

Check a parameter is within the parametric range of the surface.

abstractmethod NURBSSurface.contains_point(point: ansys.geometry.core.math.Point3D) bool#

Check a point is contained by the surface.

The point can either lie within the surface or on its boundary.

abstractmethod NURBSSurface.project_point(point: ansys.geometry.core.math.Point3D) ansys.geometry.core.shapes.surfaces.surface_evaluation.SurfaceEvaluation#

Project a point to the surface.

This method returns the evaluation at the closest point.