Automatic STL Mesh-to-NURBS Surface Conversion — Module Overview

This functionality is provided by ResurfAutoNurbs.dll. Given an input mesh, the library automatically generates NURBS surfaces that approximate the mesh and exports them to STEP or IGES files.

API Calling Sequence

Call the APIs in the following order:

Step 1: Initialize. Call autonurbs_start() to initialize the library.

Step 2: Supply the input mesh. Call autonurbs_read_stl_mesh() to load a mesh from an .stl file, or call autonurbs_set_mesh() to supply mesh data directly.

Step 3: Set the initial patch count. Call autonurbs_SetInitialQuadNumber() to specify the initial number of surface patches.

Step 4: Generate NURBS surfaces. Call autonurbs_GenerateSurface() to generate the surfaces automatically.

Step 5:Export or retrieve the NURBS surfaces. Call autonurbs_export_surface_step() to save the surfaces to a STEP file, autonurbs_export_surface_igs() to save them to an IGES file, or autonurbs_GetNurbs() to retrieve the data for a surface with a specified index.

Step 6: Finish surface generation. Call autonurbs_end() to end the surface-generation session.

 

API Parameter Reference

  extern "C" __declspec(dllimport) void autonurbs_start();

Purpose: Initializes the library. This must be the first function called.

Parameters: This function takes no parameters.

 

  extern "C" __declspec(dllimport) bool autonurbs_read_stl_mesh(char filename[1024]);

Purpose: Imports a mesh from an .stl file.

Input parameters: char filename[1024] : Path to the .stl file;

Return value: true : Success;false: Failure;

 

  extern "C" __declspec(dllimport) bool autonurbs_set_mesh(double* xScat, double* yScat, double* zScat, int nodesize, int(*elems)[4], int elemsize)

Purpose: Supplies mesh data directly.

Input parameters:

Return value: true : Success;false: Failure;

 

extern "C" __declspec(dllimport) void autonurbs_export_surface_igs(char tx_filename[1024])

Purpose: Exports the surfaces to an .igs file.

Input parameters: char filename[1024] : Path to the .igs file;

 

extern "C" __declspec(dllimport) void autonurbs_export_surface_step(char tx_filename[1024])

Purpose: Exports the surfaces to an .stp file.

Input parameters: char filename[1024] : Path to the .stp file;

 

extern "C" __declspec(dllimport) void autonurbs_SetInitialQuadNumber(int quadnum)

Purpose: Sets the initial number of surface patches.

Input parameters: int quadnum : Initial number of surface patches;

 

extern "C" __declspec(dllimport) void autonurbs_GenerateSurface()

Purpose: Automatically generates NURBS surfaces that approximate the input mesh.

Input parameters: None;

 

extern "C" __declspec(dllimport) int autonurbs_GetFaceCount();

Purpose: Returns the number of NURBS surfaces.

 

extern "C" __declspec(dllimport) bool autonurbs_GetNurbs(int faceid, int* u_num, int* v_num, int* u_degree, int* v_degree, double** u_knot, double** v_knot, double** cpx, double** cpy, double** cpz);

Purpose: Retrieves the data for a generated NURBS surface.

Parameter descriptions (faceid is an input; the remaining parameters are outputs):

 

extern "C" __declspec(dllimport) void autonurbs_end();

Purpose: Ends the surface-generation session.

 

extern "C" __declspec(dllimport) void autonurbs_ResurfLibFreeMemory(void* p);

Purpose: Frees a memory block allocated by the library.

 

 

Back to top