10 CAD
2 operations.
10.0.1 searchCadObjects
GET /api/datasets/{slug}/cad-objects
Queries the extracted CAD model by property value — equipment, piping lines, plant unit, insulation, heat-tracing. cui_risk=true returns the lines that are both insulated and heat-traced (corrosion-under-insulation risk). Answers questions the 3D viewer cannot, straight from the design data.
Why it exists. ‡ Query the plant model by what its objects are made of and how they are fitted — insulated, heat-traced, which unit — so questions like corrosion under insulation are answered from the engineering data rather than by eye.
Called by — components/workspaces/assets-register-client.tsx
Reached from — /w/data-explorer/assets · /w/integrity/assets
Query the extracted CAD model (cad_objects, via the v_cad_objects projection) by property value — equipment, piping lines, plant unit, insulation and heat-tracing — which the APS viewer cannot do. Set cui_risk=true for the objects that are BOTH insulated and heat-traced (the corrosion-under-insulation risk set). Returns an empty list with hasCad:false when the dataset declares no CAD model. RLS-scoped through the security_invoker view.
Authentication: SupabaseAuth, CookieAuth
Returns — success · hasCad · objects · total · distinct_lines · truncated · limit
Field names as the handler returns them; the source states no types for them.
Effect — reads datasets · v_cad_lines · v_cad_objects
Parameters
| Name | In | Required | Type | Notes |
|---|---|---|---|---|
slug |
path | yes | string | |
equip_no |
query | no | string | |
line_no |
query | no | string | |
tag_no |
query | no | string | |
unit_code |
query | no | string | |
q |
query | no | string | |
insulated |
query | no | string — one of true, false |
|
heat_traced |
query | no | string — one of true, false |
|
cui_risk |
query | no | string — one of true, false |
|
distinct |
query | no | string — one of line |
|
limit |
query | no | integer |
Responses
| Status | Meaning | Body |
|---|---|---|
200 |
Matched CAD objects. | |
400 |
Missing dataset slug. | Error |
401 |
Not authenticated. | Error |
404 |
Dataset not found or access denied. | Error |
500 |
Failed to query CAD objects. | Error |
10.0.2 getCadObjectsNearPoint
GET /api/datasets/{slug}/cad/locate
Says what stands at a GPS point in the CAD model: the point in CAD coordinates and the objects around it, nearest first, grouped by equipment tag — the world-to-CAD placement the render routes use, without rendering.
Converts a WGS84 point (longitude, latitude, ellipsoidal height) into the dataset’s CAD frame through the same placement renderCadModel uses for a camera — the tile transform, the scene’s ENU alignment offset and the landmark-fitted correction — and returns the CAD objects whose centroids lie within radius_m, nearest first, with a per-equipment-tag summary (count, nearest distance, description). Needs the dataset’s calibration (501 without one, like the render route). Distances are centroid-to-point, so a long pipe run reads far even when its wall is beside the point. Runs under the caller’s RLS.
Authentication: SupabaseAuth, CookieAuth
Returns — hasCad · point_cad_ft · radius_m · objects_within · objects · assets · placement_version · truncated
Field names as the handler returns them; the source states no types for them.
Effect — reads datasets · v_cad_objects
Parameters
| Name | In | Required | Type | Notes |
|---|---|---|---|---|
slug |
path | yes | string | |
lon |
query | no | number, nullable | |
lat |
query | no | number, nullable | |
h |
query | no | number, nullable | |
radius_m |
query | no | number | |
limit |
query | no | integer |
Responses
| Status | Meaning | Body |
|---|---|---|
200 |
The point in the CAD frame and what is around it. | |
400 |
A coordinate is missing or out of range. | Error |
401 |
Not authenticated. | Error |
404 |
Dataset not found (or not visible to the caller). | Error |
500 |
Server error. | Error |
501 |
No world-to-CAD calibration for this dataset. | Error |