point_cloud_settings#
This module provides the PointCloudSettings class, which stores configuration for a point cloud
extraction used in clash detection. Instances are persisted via ClashData.
Classes#
PointCloudSettings#
- class omni.physxclashdetectioncore.point_cloud_settings.PointCloudSettings(
- identifier: int = -1,
- point_cloud_prim_path: str = '',
- destination_path: str = '',
- save_to_session_layer: bool = True,
- skip_rendering: bool = True,
- max_lod_level: int = 1000000,
Settings for a point cloud extraction used in clash detection.
A value class that stores configuration for a point cloud extraction. All members are set via the constructor and exposed through properties with setters.
- Parameters:
identifier (int) – Unique identifier. -1 means not yet assigned / uninitialized.
point_cloud_prim_path (str) – USD prim path of the point cloud to extract.
destination_path (str) – Destination path where extraction results are written as
UsdGeom.Points.save_to_session_layer (bool) – If True, extraction results are saved to the session layer. Defaults to True.
skip_rendering (bool) – If True, the resulting point cloud is not rendered in the viewport. Defaults to True.
max_lod_level (int) – Maximum level-of-detail level used during extraction. Defaults to
MAX_LOD_LEVEL(1 000 000).
Class Constants:
- VERSION: int = 2#
SQLite table schema version; read by
ClashDataSerializerSqliteto validate and migrate saved data.
- MAX_LOD_LEVEL: int = 1000000#
Default maximum LOD level used when no explicit value is provided.
Methods:
- serialize_to_dict() Dict[str, Any]#
Converts the PointCloudSettings instance to a dictionary in JSON-serializable format.
- Returns:
Dictionary containing the serialized PointCloudSettings data.
- Return type:
Dict[str, Any]
- classmethod deserialize_from_dict(
- data: Dict[str, Any],
- reset_identifier: bool = False,
Deserializes a PointCloudSettings instance from a JSON-serializable dictionary.
- Parameters:
data (Dict[str, Any]) – Dictionary containing serialized PointCloudSettings data.
reset_identifier (bool) – If True, the identifier is reset to -1 after deserialization.
- Returns:
New instance if deserialization succeeds, None if it fails.
- Return type:
Optional[PointCloudSettings]
- __repr__() str#
Returns a string representation of the PointCloudSettings instance showing all field values.
- Returns:
A string representation of the PointCloudSettings instance.
- Return type:
str
- __eq__(other: object) bool#
Checks equality by comparing all fields of two PointCloudSettings instances.
- Parameters:
other (object) – The object to compare against.
- Returns:
True if all fields are equal, False otherwise. Returns False if
otheris not a PointCloudSettings instance.- Return type:
bool
- reset_identifier() None#
Resets the identifier to -1 (unassigned). Used after deserialization when a fresh identity is needed.
Properties:
- identifier: int#
Gets or sets the unique identifier. -1 means not yet assigned or uninitialized.
- point_cloud_prim_path: str#
Gets or sets the USD prim path of the point cloud to extract.
- destination_path: str#
Gets or sets the destination path where extraction results are written as
UsdGeom.Points.
- save_to_session_layer: bool#
Gets or sets whether extraction results are saved to the session layer. When False, results are saved to the root layer.
- skip_rendering: bool#
Gets or sets whether the resulting point cloud is skipped during rendering. When True, the point cloud is not rendered in the viewport.
- max_lod_level: int#
Gets or sets the maximum level-of-detail level used during extraction. Higher values include more detail at the cost of more memory.
Example#
Creating and persisting PointCloudSettings via ClashData:
from omni.physxclashdetectioncore.point_cloud_settings import PointCloudSettings
from omni.physxclashdetectioncore.clash_data import ClashData
from omni.physxclashdetectioncore.clash_data_serializer_sqlite import ClashDataSerializerSqlite
from pxr import Usd, UsdUtils
# Open a stage and connect ClashData
stage = Usd.Stage.Open("/path/to/scene.usd")
stage_id = UsdUtils.StageCache.Get().Insert(stage).ToLongInt()
clash_data = ClashData(ClashDataSerializerSqlite())
clash_data.open(stage_id)
# Create settings for a point cloud extraction
pc_settings = PointCloudSettings(
point_cloud_prim_path="/World/ScanData",
destination_path="/World/ScanData/Extracted",
save_to_session_layer=True,
skip_rendering=True,
max_lod_level=10, # limit LOD for faster extraction
)
# Persist the settings
record_id = clash_data.insert_point_cloud_settings(pc_settings)
print(f"Inserted PointCloudSettings with id={record_id}")
# Retrieve by ID
loaded = clash_data.find_point_cloud_settings(record_id)
assert loaded.point_cloud_prim_path == "/World/ScanData"
# Retrieve by prim path
by_path = clash_data.find_point_cloud_settings_by_point_cloud_prim_path("/World/ScanData")
# Update
pc_settings.max_lod_level = 50
clash_data.update_point_cloud_settings(pc_settings)
# Remove
clash_data.remove_point_cloud_settings_by_id(record_id)
clash_data.save()
clash_data.close()
clash_data.destroy()