API#
Python API#
This class is designed to perform clash detection on 3D meshes. |
- class ClashDetector(
- stage: pxr.Usd.Stage,
- searchset_path: str = '',
- tolerance: float = 0.0,
- clash_data_layer: bool = True,
- logging: bool = False,
Bases:
object
This class is designed to perform clash detection on 3D meshes. It supports checking Prims and Prim Views. Option to export clash detection results to JSON format for further analysis.
- set_scope(searchset_path: str)#
Sets the searchset defining the scope of the clash detection.
- Parameters:
searchset_path (str) – Absolute prim path to define the scope of the clash detection search.
- get_scope()#
Gets the current searchset used for clash detection.
- Returns:
The current searchset used for clash detection.
- Return type:
searchset_path (str)
- get_current_query_id()#
Gets the query ID of the most recent clash detection run.
- Returns:
The unique identifier of the clash detection query.
- Return type:
query.identifier (int)
- get_query_id_by_query_name(query_name: str) int #
Gets the query ID associated with any named query from completed clash detection runs.
- Parameters:
query_name (str) – Unique query name assigned to a clash detection run.
- Returns:
The unique identifier associated with the given query name.
- Return type:
query.identifier (int)
- export_to_json(
- json_path_name: str,
- query_id: int = 0,
- prim_view: bool = False,
Exports detailed clash detection data to JSON format.
- Parameters:
json_path_name (str) – Absolute file path to export data.
query_id (int, optional) – Unique query ID of clash detection results to export. Defaults to most recent clash detection run.
prim_view (bool, optional) – If True, export clash info for all clashing prims in the prim view. Defaults to False.
- Returns:
True on success, False otherwise.
- is_prim_clashing(
- prim: pxr.Usd.Prim,
- query_name: str = '',
Checks if the input prim is clashing with any mesh in the searchset.
- Parameters:
prim (Usd.Prim) – The prim to be checked for clashes.
query_name (str, optional) – Unique query name for this clash detection run. Required if not storing query IDs and need to search query ID after subsequent run(s). Defaults to empty string.
- Returns:
True if clash detected, False otherwise.
- detect_prim_view_clashes(
- prim_view,
- prim_view_query_name: str = '',
Checks if any prims in the input prim view are clashing with any mesh in the searchset.
- Parameters:
prim_view (PrimView) – The prim view to be checked for clashes.
query_name (str, optional) – Unique query name for this clash detection run. Required if not storing query IDs and need to search query ID after subsequent run(s). Note: A top level prim view ID; each prim in the view has own unique query ID, reported with results. Defaults to empty string.
- Returns:
Clashing prims and corresponding prim query ID. Empty list if no clashes detected.
- Return type:
List of namedtuple(‘Clash’, ‘prim_path query_name’)