select_mesh_triangles
Preview which triangles a region resolves to before painting materials, returning counts and IDs without modifying the mesh to catch empty selections early.
Instructions
Resolve a region into a triangle selection and REPORT it, without modifying anything. Read-only companion of set_mesh_material_id_in_region: same region parameters, same resolver, so a region previewed here paints exactly those triangles there. Use it to avoid the failure mode where a mis-specified box selects 0 triangles and the paint call still returns success. Coordinates are LOCAL to the dynamic mesh, not world.
Returns: { actor_name, region, triangles_selected: int, mesh_triangle_count: int, is_empty: bool, triangle_ids: [int], triangle_ids_truncated: bool }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| center | No | Local [x,y,z] centre. Used by box/sphere, and as the plane origin. | |
| extent | No | Local [x,y,z] HALF-size in cm. Required by region='box'. | |
| invert | No | Invert the spatial selection (default false). | |
| normal | No | [x,y,z] direction. Plane normal for region='plane', facing direction for 'normal_angle'. Default [0,0,1]. | |
| radius | No | Radius in cm. Required by region='sphere'. | |
| region | No | 'all' (default) | 'box' | 'sphere' | 'plane' | 'normal_angle' | 'material_id' | 'polygroup' | 'connected_component' (one physical PIECE, by the island index that get_mesh_components_detail reports). | |
| actor_name | Yes | Label or name of the target DynamicMeshActor. | |
| polygroup_id | No | Polygroup to select when region='polygroup'. | |
| max_angle_deg | No | Max angle from normal in degrees for region='normal_angle' (default 15). | |
| component_index | No | Island index when region='connected_component'. Get it from get_mesh_components_detail, which reports each piece's size and bounding box. | |
| polygroup_layer | No | Optional extended polygroup layer index for region='polygroup'. | |
| max_triangle_ids | No | Cap on how many IDs to return when include_triangle_ids is on (default 1000). When the cap truncates, triangle_ids_truncated is true — the count in triangles_selected is still the real one. | |
| source_material_id | No | MaterialID to select when region='material_id'. | |
| min_triangle_points | No | How many of a triangle's 3 points must be inside for it to count, 1-3 (default 3 = fully contained). | |
| include_triangle_ids | No | Also return the resolved triangle IDs (default false; they can be thousands). The returned array is what set_mesh_material_id scope='triangles' consumes. |