hoops_ai.cadaccess.HOOPSBrep

class hoops_ai.cadaccess.HOOPSBrep(brep)

Bases: BrepAccess

Parameters:

brep (Any)

build_face_adjacency_graph()

Builds and returns the face adjacency graph.

Returns:

The face adjacency graph.

Return type:

nx.Graph

face_sample_points(face_index, pointsamples=25, uvs=False, method='point', reverse_order_with_face=True)

Creates a discretization of samples from the given face index in the shape.

Takes a single pointsamples parameter and computes grid dimensions from it. If sqrt(pointsamples) is exact, uses that for both dimensions. Otherwise, rounds up and filters the results.

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

  • pointsamples (int) – Total number of points to sample (will compute grid dimensions)

  • uvs (bool) – If True, include UV parameters (NOT YET SUPPORTED in new API)

  • method (str) – Sampling method - “point”, “normal”, or “inside”

  • reverse_order_with_face (bool) – Reverse order (NOT YET IMPLEMENTED)

Returns:

Sampled data with shape (pointsamples, features)

Return type:

np.ndarray

Note

  • uvs parameter is currently ignored (new API doesn’t expose UV data via Sampling2D)

  • reverse_order_with_face is currently ignored

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.

Returns:

(surface_type, surface_description, face_area, centroid, loops_count)

where centroid is a numpy array of shape (3,) with x, y, z coordinates.

Return type:

tuple

Parameters:
  • face_idx (int)

  • attributes_specification (Dict)

get_face_centroids()

Computes and returns the centroids of the faces.

Returns:

Array of centroid coordinates.

Return type:

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:
  • edge_index (int) – Index of the edge to sample

  • num_u (int) – Number of samples along the edge

  • us (bool) – If True, include parameter values (NOT YET SUPPORTED in new API)

  • method (str) – Sampling method - “point” returns both points and tangents (legacy behavior)

  • reverse_order_with_edge (bool) – Reverse order (NOT YET IMPLEMENTED)

Returns:

For method=”point”, returns shape (num_u, 6) with [x,y,z,tx,ty,tz]

Other methods not yet implemented.

Return type:

np.ndarray

Note

  • us parameter is currently ignored (new API doesn’t expose parameter values via Sampling1D)

  • reverse_order_with_edge is currently ignored

  • method=”normal” not yet implemented (always returns points+tangents)