hoops_ai.cadaccess

CAD Access Module

The CAD Access module provides comprehensive capabilities for loading, reading, and accessing CAD models from various file formats. It serves as the entry point for bringing CAD data into the HOOPS AI ecosystem.

This module supports industry-standard CAD formats including STEP, IGES, STL, OBJ, and many others through the powerful HOOPS Exchange library. It provides both high-level convenience classes and low-level access to geometric data including B-Rep (Boundary Representation) and mesh information.

For detailed usage examples and programming patterns, see the CAD Data Access Programming Guide.

Classes

HOOPSLoader()

HOOPSModel(intern_model[, filesource])

HOOPSTools()

class hoops_ai.cadaccess.hoops_exchange.hoops_access.HOOPSLoader

Bases: CADLoader

create_from_file(filename)

Reads a CAD file and initializes the CAD model.

Parameters:

filename (str)

Return type:

HOOPSModel

get_general_options()

Returns the current settings (dict) for loading the CAD file, so the user can see or modify them.

Return type:

Dict[str, Any]

get_model()

Returns the CAD model.

Return type:

HOOPSModel

set_general_options(general_options)

Sets the settings used when loading the CAD file.

Parameters:

general_options (Dict[str, Any])

Return type:

None

class hoops_ai.cadaccess.hoops_exchange.hoops_access.HOOPSModel(intern_model, filesource='')

Bases: CADModel

Parameters:
  • intern_model (Any)

  • filesource (str)

get()
Return type:

Any

get_body()

get body

Return type:

Any

get_brep(body_index=0)

get brep.

Parameters:

body_index (int)

Return type:

BrepAccess

get_filesource()
get_mesh(body_index=0)

get meth.

Parameters:

body_index (int)

Return type:

HOOPSMesh

class hoops_ai.cadaccess.hoops_exchange.hoops_access.HOOPSTools

Bases: CADTools

adapt_brep(model, brep_options=None)

Helper that reads settings to adapt/prepare the BREP model.

Parameters:
Return type:

None

adapt_tesselation(model, tess_options)

.

Parameters:
Return type:

None

apply_filter()

Filter.

Return type:

Dict[str, Any]

brep_options()

Helper that reads settings to adapt/prepare the BREP model.

Return type:

Dict[str, Any]

exportOBJ(model, filepath)

Export the model to a desired CAD format.

Parameters:

model (CADModel)

Return type:

Any

exportSTEP(model, filename)

Export the model to STEP formart

Parameters:

model (CADModel)

Return type:

Any

exportStreamCache(model, filename, is_white_background=True, overwrite=False)

Export the model to Stream Cache format.

Parameters:

model (CADModel)

Return type:

Any

extract_holes(model)

Check and extract holes in the cad files. Only for Parasolid Files

Parameters:

model (CADModel)

Return type:

Dict[str, List[Any]]

tesselation_options()
Return type:

Dict[str, Any]

Classes

HOOPSBrep(body)

class hoops_ai.cadaccess.hoops_exchange.hoops_brep.HOOPSBrep(body)

Bases: BrepAccess

Parameters:

body (Any)

build_face_adjacency_graph()

Builds and returns the face adjacency graph.

Returns:

The face adjacency graph.

Return type:

nx.Graph

get_bounding_box()

Returns the bounding box of the CAD model as (xmin, ymin, zmin, xmax, ymax, zmax).

Return type:

Tuple[float, float, float, float, float, float]

get_diagonal_length()

Computes the diagonal length of the model’s bounding box.

Returns:

Diagonal length.

Return type:

float

get_edge_attributes(edge_idx, attributes_specification)

Computes the edge attributes for a given edge index.

Parameters:
  • edge_idx (int)

  • attributes_specification (Dict)

Return type:

tuple

get_edge_indices()

Returns a list of edge indices.

Return type:

List[int]

get_edge_indices_map()

Returns a mapping from edge indices to edges (if needed).

Returns:

Mapping from edge indices to edge objects.

Return type:

Dict[int, object]

get_face_attributes(face_idx, attributes_specification)

Computes the face attributes for a given face index.

Parameters:
  • face_idx (int)

  • attributes_specification (Dict)

Return type:

tuple

get_face_centroids()

Computes and returns the centroids of the faces.

Returns:

Mapping from face indices to their centroid coordinates.

Return type:

Dict[int, np.ndarray]

get_face_indices()

Returns a list of face indices.

Return type:

List[int]

sample_points_on_face(face_index, num_points=512)

Samples points on a face given its index.

Parameters:
  • face_index (int) – Index of the face.

  • num_points (int, optional) – Number of points to sample. Defaults to 512.

Returns:

List of sampled points as NumPy arrays.

Return type:

List[np.ndarray]

sample_points_on_faces(face_indices, num_points=512)

Samples points on all faces and returns a list.

Returns:

List of lists of sampled points for each face.

Return type:

List[List[np.ndarray]]

Parameters:
ugrid(edge_index, num_u=10, us=False, method='point', reverse_order_with_edge=True)

Creates a 1D grid of samples from the given edge index in the shape.

Parameters:
Return type:

numpy.ndarray

uvgrid(face_index, num_u=10, num_v=10, uvs=False, method='point', reverse_order_with_face=True)

Creates a 2D UV-grid of samples from the given face index in the shape.

Parameters:
Return type:

numpy.ndarray