Choosing an API Layer#

ovclash, the clash detection library for USD scenes, has two supported API layers, the canonical API and the Suite API. Each has a C ABI (application binary interface) and one Python package. Neither layer is deprecated. Pick by need, not by recency.

  • One library. Both C ABIs are compiled into the one ovclash shared library. There is no separate Suite library to link. The Suite C ABI is implemented on top of the canonical C ABI.

  • Two peer Python packages. ovclash binds the canonical C ABI, and ovclash_suite binds the Suite C ABI. Neither package wraps the other, and a name that exists in both is a different object in each. Both packages ship in the ovclash wheel and share one loader, so the native library loads once.

  • Same shape. Every C entry point except a few string getters returns a status struct. Values come back in out-parameters, and ownership is explicit.

  • No shared handles. You can use both APIs in one process, but they share no handles. Only the optional ovstage headers share types; see Language mapping.

  • Product features are Suite-only. Persistence, export and .clashDetection container support exist only in the Suite API, because they are product behavior, not engine behavior.

Comparison#

Canonical (ovclash)

Suite (ovclash_suite)

Use when

You want direct engine control with the least indirection: open a stage, scope it, run the pipeline, and read overlaps and overlap reports.

You want the product workflow without assembling it: run a named query, store the results and export them.

C handles

ovclash_context_t*, a context.

ovclash_suite_runtime_t* runs queries, and ovclash_suite_data_t* opens a store. Model handles such as ovclash_suite_query_t* and ovclash_suite_clash_info_t* hold records.

Python classes

ClashRuntime. Results come back as plain records, such as OverlapDetails, and as OverlapReport objects.

ClashDetection runs queries, and ClashData opens a store. The object model is ClashQuery, ClashInfo and ClashFrameInfo.

C status

ovclash_result_t with OVCLASH_STATUS_*.

ovclash_suite_result_t with OVCLASH_SUITE_STATUS_*.

Persistence

None. Results live only in the context. The next run, ovclash_reset_context() and ovclash_release_context() drop them. On ovstage, ovclash_release_memory() drops them too.

SQLite .ovclashdb files and JSON directory stores. The SQLite store also reads and writes .clashDetection containers. A custom store can plug in: AbstractClashDataSerializer in Python, and the fetch-and-save serializer callbacks of ovclash_suite_serializer.h in C.

Export

None.

HTML and JSON: export_to_html() and export_to_json() in Python, the ovclash_suite_export_rows_* entry points in C.

Python report buffers

Borrowed, zero-copy BufferView objects that export to NumPy, Warp and DLPack. They are valid until the report is released.

Owned copies. ClashDetection.get_overlap_report2() returns ArrayView copies and releases the native report.

Async start

ovclash_run_pipeline_async() in C, ClashRuntime.run_async() in Python.

ovclash_suite_run_pipeline_async() in C, ClashDetection.run_async_pipeline() in Python.

Async handle release

ovclash_finish_pipeline() destroys the ovclash_async_t*. There is no separate destroy call.

ovclash_suite_async_destroy() releases the ovclash_suite_async_t*, also after a finish or a cancel.

Asynchronous Pipelines covers both async handles and both Python AsyncPipeline classes.

The same query in both packages#

The two programs of this section run one static query on time_sampled.usda and print the one overlap. The stage ships in samples/data/, both in the wheel’s ovclash package and in the SDK archive. Run the programs from that directory, or pass the stage’s full path.

With ovclash:

from ovclash import ClashRuntime

with ClashRuntime() as runtime:
    runtime.open_stage("time_sampled.usda")
    runtime.set_scope(["/Root/Xform_Primitives/Cube"], ["/Root/Xform_Primitives/Plane"])
    runtime.run_pipeline()
    for index in range(runtime.get_overlap_count()):
        record = runtime.get_overlap_record(index)
        print(record.name0, record.name1, record.type.name, record.nb_elements)
/Root/Xform_Primitives/Cube /Root/Xform_Primitives/Plane MESH_VS_MESH 10

With ovclash_suite:

from ovclash_suite import ClashDetection

clash = ClashDetection()
try:
    clash.open_stage("time_sampled.usda")
    clash.set_scope_paths(["/Root/Xform_Primitives/Cube"], ["/Root/Xform_Primitives/Plane"])
    clash.run_pipeline()
    for index in range(clash.get_nb_overlaps()):
        overlap = clash.get_overlap_data(index)
        print(overlap.name0, overlap.name1, overlap.type.name, overlap.nb_elements)
finally:
    clash.destroy()
/Root/Xform_Primitives/Cube /Root/Xform_Primitives/Plane NORMAL 10

The differences in this small case:

  • ClashRuntime is a context manager. ClashDetection is not, so destroy it explicitly.

  • The scope setters differ: set_scope() records the scope for the next pipeline, and set_scope_paths() applies it to the runtime at once.

  • The same overlap reports MESH_VS_MESH in one package and NORMAL in the other; see Same names, different types.

To store the result, the Suite API adds ClashData and fetch_and_save_overlaps(); see Suite Workflows.

Same names, different types#

These names exist in both Python packages: AsyncPipeline, BackendInfo, backend_info, OverlapReportFlag, OverlapType, PipelineStepData, QueryStats and RunSettings. Each package defines its own type or function under that name. Import from one package and stay there. Do not pass a value from one package to the other.

The differences:

Name

ovclash

ovclash_suite

RunSettings

A curated subset of the native settings. ClashRuntime.set_run_settings() sets every other setting to its ovclash_reset_settings() value.

The complete native run-settings payload. ClashDetection takes a mapping keyed by SettingId, the enum of Suite setting keys, instead; run_settings_to_query_settings_json() takes this class.

RunSettings.use_usdrt (stored only, no effect)

Defaults to False.

Defaults to True.

RunSettings.time_codes_per_second

Defaults to 24.0; applied only while set_times is true.

Defaults to 24.0. The native default, default_run_settings(), is 0.0.

RunSettings.max_local_depth_mode

A MaxLocalDepthMode: DISABLED = 0 (default), MINIMAL = 1, MEDIUM = 2, HIGH = 3.

An int: 0 minimal, 1 medium (default), 2 high. 3 is rejected. It applies only while compute_max_local_depth is true, and that flag defaults to False.

RunSettings.set_times

Applies start_time, end_time and time_codes_per_second. When it is false, the query is static.

Only enables the end_time >= start_time check. The time fields always apply.

RunSettings.nb_tasks

With legacy multithreading (single_threaded and new_task_manager both false), a value outside 1..255 raises ValueError.

Accepts 0 to 1000000. The engine clamps the value.

OverlapType

The pair type of an overlap: MESH_VS_MESH = 0, POINT_VS_MESH = 1, UNDEFINED.

The classification of a clash record: NORMAL = 1 (alias MESH_MESH), DUPLICATE = 2, POINT_CLOUD_MESH = 3, UNDEFINED.

AsyncPipeline

Has is_cancelled().

Has no is_cancelled().

BackendInfo

Has native_library_path.

Has no native_library_path.

PipelineStepData

Has step_progress.

Has no step_progress. Adds read-only aliases with the m prefix, such as mProgress.

OverlapReportFlag and QueryStats have the same members and values in both packages. Only the class differs.

The two OverlapType enums by value:

Value

ovclash.OverlapType

ovclash_suite.OverlapType

0

MESH_VS_MESH: a mesh-vs-mesh pair

No member

1

POINT_VS_MESH: a point-vs-mesh pair

NORMAL, alias MESH_MESH: a mesh-vs-mesh clash record

2

No member

DUPLICATE: a duplicate mesh pair

3

No member

POINT_CLOUD_MESH: a point-vs-mesh clash record

0x7FFFFFFF

UNDEFINED

UNDEFINED

Two values are easy to misread:

  • OverlapType value 1 is POINT_VS_MESH in ovclash and NORMAL (mesh-vs-mesh) in ovclash_suite. Both UNDEFINED members are 0x7FFFFFFF, not zero. Compare a value with == against the member you mean, and never test it with != 0.

  • max_local_depth_mode is offset by one: 1 is MINIMAL in ovclash and medium in ovclash_suite. Penetration depth describes both scales.

import ovclash
import ovclash_suite

print(ovclash.OverlapType(1).name)  # POINT_VS_MESH
print(ovclash_suite.OverlapType(1).name)  # NORMAL
print(ovclash.RunSettings().max_local_depth_mode.name)  # DISABLED
print(ovclash_suite.RunSettings().max_local_depth_mode)  # 1, the Suite's medium mode
print(ovclash.RunSettings is ovclash_suite.RunSettings)  # False

Settings maps every setting across the C structs and both Python packages, with its default and effect.

Language mapping#

C / C++

Python

Canonical

include/ovclash/ovclash.h: C/C++ Quickstart

import ovclash: Python Quickstart, ovclash Python Package

Suite

include/ovclash_suite/ovclash_suite.h: Suite Workflows

import ovclash_suite: Suite Workflows, ovclash Python Package

  • The headers and link artifacts ship only in the SDK archive. The wheel ships no headers.

  • C API Conventions gives the status, string and input rules of both C ABIs. The comments in the headers that the language mapping names are the per-function reference; References in the package lists every header.

  • Each C ABI also has an optional header whose functions only the ovstage build exports: include/ovclash/ovclash_ovstage.h and include/ovclash_suite/ovclash_suite_ovstage.h.

  • The Suite ovstage header includes the canonical one. It reuses its ovclash_ovstage_owner_operation_fn and ovclash_ovstage_binding_t types, and with the binding its optional ovclash_ovstage_composition_t.

The Suite-only workflows have their own pages:

Kit compatibility#

The wheel ships a third Python package, omni.physxclashdetectioncore. It is not a peer of the other two. It is a Kit-free compatibility package that re-exports ovclash_suite names, so existing Kit imports keep resolving outside Kit.

  • Use it only to port code that already imports it.

  • New code imports ovclash_suite directly.

Kit Compatibility lists what the package covers and what it does not.

Which skill to read#

A skill is a focused playbook, Markdown plus code snippets, that teaches an agent or a person one task with ovclash. The skills ship in skills/ at the package root, in the wheel and in the SDK archive, and References in the package lists them with the other references that ship. Four API skills each cover one API in one language:

Skill

API

Language

skills/ovclash-basics/

Canonical

Python

skills/ovclash-c-api/

Canonical

C/C++

skills/ovclash-suite-python/

Suite

Python

skills/ovclash-suite-c-api/

Suite

C/C++

One task skill, skills/ovclash-clash-processor/, needs no code: it runs queries on your own stages from the command line with The Clash Processor.

The skill catalog, skills/README.md at the package root, which References in the package also lists, says when to use each skill.