clash_detect_export#

This module provides export functionality for clash detection results to various formats.

Classes#

ExportColumnDef#

class omni.physxclashdetectioncore.clash_detect_export.ExportColumnDef(order: int, name: str, alignment: bool = False)#

A class for defining export column properties.

This class encapsulates the properties of a column definition used for exporting data, including the order of the column, its name, and its text alignment.

Parameters:
  • order (int) – The order of the column in the export.

  • name (str) – The name of the column.

  • alignment (bool) – The alignment of the text in the column; False for left alignment, True for right alignment. Defaults to False.

Properties:

order: int#

Order of the column.

name: str#

Name of the column.

alignment: bool#

Alignment of the column. False for left alignment, True for right alignment.

Functions#

omni.physxclashdetectioncore.clash_detect_export.export_to_json(
column_defs: Sequence[ExportColumnDef],
rows: Sequence[Sequence[str]],
additional_info: dict[str, str] | None = None,
) bytes#

Convert the given data to a JSON format.

Parameters:
  • column_defs (Sequence[ExportColumnDef]) – List of column definitions.

  • rows (Sequence[Sequence[str]]) – Data rows to be exported.

  • additional_info (Optional[dict[str, str]]) – Additional info as name-value pairs. Defaults to None.

Returns:

JSON representation of the data encoded in UTF-8.

Return type:

bytes

Example:

from omni.physxclashdetectioncore.clash_detect_export import export_to_json, ExportColumnDef

column_defs = [
    ExportColumnDef(0, "Clash ID"),
    ExportColumnDef(1, "Min Distance", True),
    ExportColumnDef(2, "Object A"),
    ExportColumnDef(3, "Object B")
]

rows = [
    ["0x1a2b3c", "0.523", "/World/ObjectA", "/World/ObjectB"],
    ["0x4d5e6f", "1.234", "/World/ObjectC", "/World/ObjectD"]
]

additional_info = {
    "Stage": "/path/to/stage.usd",
    "Query": "Full Scene"
}

json_bytes = export_to_json(column_defs, rows, additional_info)
omni.physxclashdetectioncore.clash_detect_export.export_to_html(
title: str,
subtitle: str,
column_defs: Sequence[ExportColumnDef],
rows: Sequence[Sequence[str]],
additional_info: dict[str, str] | None = None,
) bytes#

Convert the given data to an HTML format.

Parameters:
  • title (str) – Title of the HTML document.

  • subtitle (str) – Subtitle of the HTML document.

  • column_defs (Sequence[ExportColumnDef]) – List of column definitions.

  • rows (Sequence[Sequence[str]]) – Data rows to be exported.

  • additional_info (Optional[dict[str, str]]) – Additional info as name-value pairs. Defaults to None.

Returns:

HTML representation of the data encoded in UTF-8.

Return type:

bytes

Example:

from omni.physxclashdetectioncore.clash_detect_export import export_to_html, ExportColumnDef

column_defs = [
    ExportColumnDef(0, "Clash ID"),
    ExportColumnDef(1, "Min Distance", True),
    ExportColumnDef(2, "Object A"),
    ExportColumnDef(3, "Object B")
]

rows = [
    ["0x1a2b3c", "0.523", "/World/ObjectA", "/World/ObjectB"],
    ["0x4d5e6f", "1.234", "/World/ObjectC", "/World/ObjectD"]
]

additional_info = {
    "Stage": "/path/to/stage.usd",
    "Query": "Full Scene"
}

html_bytes = export_to_html(
    "Clash Detection Results",
    "/path/to/stage.usd",
    column_defs,
    rows,
    additional_info
)