pick

The object under CSS pixel (x, y) of the canvas, as the last presented frame shows it: { nodeId, handleId, triangle, primId, primIdFrom, pointIds?, pointIdsFrom?, worldPositionApprox }, or null off-canvas or over nothing. radius (CSS pixels, 0..32, default 0) takes the nearest hit within it. worldPositionApprox comes from GPU depth: a hint, never a measurement. Ids stay exact where a distant part draws simplified; lod: true marks the rare silhouette pixel where they could not be recovered (ids null, triangle approximate). precision: 'display' marks a display-class handle (GPU f32 geometry): never measure from it or anchor an edit on it. On a display line or topology edge, segment: { index, source: 'lines' | 'topologyEdges', primId, primIdFrom, pointIds?, pointIdsFrom? } names it (a topology edge keeps its face's triangle and ids; a line has triangle 0 and null face ids); on a dot, point: { index, pointId, pointIdFrom }. level ('object' default, 'face', 'edge', 'point', 'auto') adds element: one ElementSet ({ domain, ids, from?, handleId }) at that level. 'face' is the face under the pixel. 'edge' is the nearest visible edge within 5 CSS px: a line's 'curve', a B-rep 'topology-edge' (on a handle with topology edges, only those), else a derived 'edge' between faces or on a boundary, whose ids are its two point ids, sorted, without from. 'point' is the nearest visible point within 7 CSS px. 'auto' takes a point within its radius, else an edge within its radius, else the face. At 'edge', 'point' and 'auto' the result describes the pixel showing the element. element is absent where nothing qualifies or the producer sent no ids.

QueryAsync

Usage

TypeScript
await surface.queryAsync('pick', { x, y, radius?, level? })

Parameters

  • xnumber

    Required

  • ynumber

    Required

  • radiusinteger

    Optional

  • level"object" | "face" | "edge" | "point" | "auto"

    Optional

Returns

object | null with nodeId, handleId, triangle, primId, primIdFrom, pointIds, pointIdsFrom, worldPositionApprox, lod, precision, segment, point, element, in the ok: true envelope.

JSON
{
  "type": [
    "object",
    "null"
  ],
  "properties": {
    "nodeId": {
      "type": "string"
    },
    "handleId": {
      "type": "string"
    },
    "triangle": {
      "type": "integer",
      "minimum": 0
    },
    "primId": {
      "type": [
        "integer",
        "null"
      ]
    },
    "primIdFrom": {
      "type": [
        "integer",
        "null"
      ]
    },
    "pointIds": {
      "type": "array",
      "minItems": 3,
      "maxItems": 3,
      "items": {
        "type": "integer"
      }
    },
    "pointIdsFrom": {
      "type": "array",
      "minItems": 3,
      "maxItems": 3,
      "items": {
        "type": "integer"
      }
    },
    "worldPositionApprox": {
      "type": "object",
      "properties": {
        "x": {
          "type": "number"
        },
        "y": {
          "type": "number"
        },
        "z": {
          "type": "number"
        }
      },
      "required": [
        "x",
        "y",
        "z"
      ]
    },
    "lod": {
      "type": "boolean",
      "enum": [
        true
      ]
    },
    "precision": {
      "type": "string",
      "enum": [
        "display"
      ]
    },
    "segment": {
      "type": "object",
      "properties": {
        "index": {
          "type": "integer",
          "minimum": 0
        },
        "source": {
          "type": "string",
          "enum": [
            "lines",
            "topologyEdges"
          ]
        },
        "primId": {
          "type": [
            "integer",
            "null"
          ]
        },
        "primIdFrom": {
          "type": [
            "integer",
            "null"
          ]
        },
        "pointIds": {
          "type": "array",
          "minItems": 2,
          "maxItems": 2,
          "items": {
            "type": "integer"
          }
        },
        "pointIdsFrom": {
          "type": "array",
          "minItems": 2,
          "maxItems": 2,
          "items": {
            "type": "integer"
          }
        }
      },
      "required": [
        "index",
        "source",
        "primId",
        "primIdFrom"
      ]
    },
    "point": {
      "type": "object",
      "properties": {
        "index": {
          "type": "integer",
          "minimum": 0
        },
        "pointId": {
          "type": [
            "integer",
            "null"
          ]
        },
        "pointIdFrom": {
          "type": [
            "integer",
            "null"
          ]
        }
      },
      "required": [
        "index",
        "pointId",
        "pointIdFrom"
      ]
    },
    "element": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "domain": {
              "type": "string",
              "enum": [
                "edge"
              ]
            },
            "ids": {
              "type": "array",
              "minItems": 2,
              "maxItems": 2,
              "items": {
                "type": "integer"
              }
            },
            "handleId": {
              "type": "string"
            }
          },
          "required": [
            "domain",
            "ids",
            "handleId"
          ]
        },
        {
          "type": "object",
          "properties": {
            "domain": {
              "type": "string",
              "enum": [
                "face",
                "curve",
                "topology-edge",
                "point"
              ]
            },
            "ids": {
              "type": "array",
              "minItems": 1,
              "maxItems": 1,
              "items": {
                "type": "integer"
              }
            },
            "from": {
              "type": "array",
              "minItems": 1,
              "maxItems": 1,
              "items": {
                "type": "integer"
              }
            },
            "handleId": {
              "type": "string"
            }
          },
          "required": [
            "domain",
            "ids",
            "from",
            "handleId"
          ]
        }
      ]
    }
  },
  "required": [
    "nodeId",
    "handleId",
    "triangle",
    "primId",
    "primIdFrom",
    "worldPositionApprox"
  ]
}

See also