NURBS-Python (geomdl)

repository·5.x·Indexed 20 days ago

https://github.com/orbingol/nurbs-python

A pure Python, object-oriented B-Spline and NURBS evaluation library for modeling curves, surfaces, and volumes. It provides tools for spline evaluation, knot manipulation, curve/surface fitting, and conversion between B-Spline and NURBS. The library includes a compatibility module for CAD data transformation and supports visualization via Matplotlib, Plotly, and VTK, as well as I/O support for OBJ, STL, CSV, and custom text formats.

Tokens
57.5K
Snippets
200
Records
299
Agent score
72%

What's inside geomdl

  1. Overview of NURBS-Python (geomdl) features

    5.x

    NURBS-Python (geomdl) is an object-oriented, pure Python library for B-Spline and NURBS operations. It provides implementations for generating and evaluating curves, surfaces, and volumes.

    Key Capabilities:

    • Geometry Generation: Curve, surface, and volume generation/evaluation.
    • Fitting: Surface and curve fitting using interpolation and least squares approximation.
    • Algorithms: Knot vector/surface grid generation, tessellation, voxelization, and ray intersection.
    • Construction: Use the construct module to build surfaces/volumes and extract isosurfaces.
    • Data Formats:
      • CAD Import/Export: 3DM, SAT, STL, OBJ, VTK.
      • Text-based: JSON, YAML, libconfig.
      • Templating: Jinja2 support for file imports.
    • Visualization: Integration with Matplotlib, Plotly, and VTK for animation and visualization.
    • Performance: While pure Python, Cython compilation options are available for higher performance.
  2. Overview of the ACIS Importer (rwsat)

    5.x

    The ACIS importer, known as rwsat, is a tool used to convert ACIS .sat files into the geomdl JSON format. It requires 3D ACIS Modeler for the conversion process.

    rwsat provides two primary command-line programs:

    • sat2json: Converts ACIS .sat files to geomdl JSON format.
    • satgen: Generates sample geometries.

    Common use cases include importing geometry data from .sat files into geomdl via exchange.import_json or converting ACIS files to other formats supported by geomdl such as OBJ, STL, and OFF.

  3. Overview of NURBS-Python (geomdl)

    5.x

    NURBS-Python (geomdl) is a pure Python, self-contained, object-oriented library for B-Spline and NURBS modeling. It provides data structures and an API for both rational and non-rational splines.

    Core Algorithms

    The library includes efficient and extensible implementations for:

    • Spline evaluation and Derivative evaluation
    • Knot manipulation: Insertion, removal, and vector refinement
    • Degree manipulation: Elevation and reduction
    • Fitting: Curve and surface fitting using interpolation and least squares approximation

    Visualization

    You can visualize curves and surfaces using customizable options via the following libraries:

    • Matplotlib
    • Plotly
    • VTK
  4. Access Advanced API features for specialized tasks

    5.x

    The Advanced API provides specialized modules for complex geometric computations and low-level engine access. These are intended for users performing advanced analysis or custom implementations.

    Advanced Modules:

    • module_abstract: Abstract base classes and interfaces.
    • module_evaluators: Geometric evaluators.
    • module_utilities: General purpose geometric utilities.
    • module_voxelize: Voxelization tools.
    • module_elements: Finite element-related modules.
    • module_ray: Ray casting and intersection tools.
  5. Perform geometric operations on curves and surfaces

    5.x

    The geomdl.operations module provides a suite of common geometric operations for NURBS curves and surfaces. You can use this module to manipulate the structure or properties of geometric entities. Supported operations include:

    • Knot manipulation: Insertion, removal, and refinement of knots.
    • Decomposition: Splitting curves/surfaces or performing Bézier decomposition.
    • Evaluations: Computing tangents, normals, and binormals.
    • Hodograph computations: Generating hodograph curves and surfaces.
    • Transformations: Translation, rotation, and scaling.
  6. Use the Control Points Manager for managing control points

    5.x

    The geomdl.control_points module provides specialized manager classes to handle control points for curves, surfaces, and volumes. It is recommended to use these manager classes instead of the compatibility module for more efficient and structured control point management.

    Available manager classes:

    • CurveManager: For managing control points of NURBS curves.
    • SurfaceManager: For managing control points of NURBS surfaces.
    • VolumeManager: For managing control points of NURBS volumes.
  7. Generate and validate knot vectors with the knotvector module

    5.x
    The geomdl.knotvector module provides utility functions for generating and validating knot vectors, which are essential for defining the parameter space of NURBS curves and surfaces. Use this module to ensure knot vectors satisfy the mathematical requirements for a given degree and number of control points.