Mesh Operations

MeshOperationService (client.mesh_operation) processes the mesh of a scene object and saves the result as new objects. Use it to clean up scanned meshes or to cut out the region to work on before generating a tool path.

Note

MeshOperationService requires the mesh_operation license (Activate Licenses).

Both RPCs take the source object_name. If the object has more than one visual mesh, set mesh_filename to choose one.

Extracting an area

ExtractArea(AreaExtractionRequest) cuts out the part of the mesh inside a polygon and saves it as extracted_object_name. The boundary points must lie on the mesh surface (within 1 mm). They are in the coordinates of the mesh file, scaled by Mesh.scale; the object pose and the visual origin are not applied. The source mesh must be .stl or .obj.

area_extraction_request = AreaExtractionRequest(
    object_name="mesh_1",
    extracted_object_name="extracted_area_1",
    boundary=[
        Vector3(x=0.2, y=0.2, z=0.0),
        Vector3(x=0.4, y=0.2, z=0.0),
        Vector3(x=0.4, y=0.4, z=0.0),
        Vector3(x=0.2, y=0.4, z=0.0),
    ])
try:
    area_extraction_response = client.mesh_operation.stub.ExtractArea(area_extraction_request)
    if area_extraction_response.status.code == 0:
        print("Area extraction successful, saving extracted area to the scene...")
    else:
        print(f"Area extraction failed: {area_extraction_response.status.message}")
        return

Filtering a mesh

FilterMesh(FilterMeshRequest) applies one filter and saves the result. If the filter produces one mesh, it is named filtered_object_name_prefix; if it produces several, they share that prefix. filtered_object_names lists them.

filter_mesh_request = FilterMeshRequest(
    object_name="mesh_1",
    filtered_object_name_prefix="filtered_mesh_1",
    smooth_mesh=SmoothMesh(
        num_iterations=5,
        pass_band=0.1
    )
)
try:
    filter_mesh_response = client.mesh_operation.stub.FilterMesh(filter_mesh_request)
    if filter_mesh_response.status.code == 0:
        print(f"Mesh filtering successful, filtered objects saved as: {list(filter_mesh_response.filtered_object_names)}")
    else:
        print(f"Mesh filtering failed: {filter_mesh_response.status.message}")
        return

Available filters

Set exactly one of these FilterMeshRequest fields. Mesh filters are in flexiv.pdk.mesh_operation.filter.parameters_pb2; area filters in flexiv.pdk.mesh_operation.area_filter.parameters_pb2.

Field

Parameters

Use

smooth_mesh

pass_band (0.01–0.1 typical; smaller is smoother), num_iterations (10–100 typical)

Smooth a noisy, e.g. reconstructed, mesh.

largest_region

none

Keep the largest connected region; remove speckles.

bounding_box

bbox_center, bbox_orientation, bbox_size (world frame)

Keep the mesh inside a region of interest.

fill_holes

hole_size (m)

Patch holes smaller than this diameter.

sharpen

num_iterations, strength

Sharpen edge features.

minimum_surface_area

minimum_surface_area (m²)

Remove connected regions smaller than this.

uniform_resampling

num_points_per_unit_area (per m²)

Upsample, usually a coarse CAD mesh.

bump_valley_removal

tool_disk_radius (m), area factors, angle thresholds (rad)

Remove high-curvature regions a disk tool cannot follow.

border_offset

offset (m, inward), minimum_component_area_after_border_offset (m²), flag_fallback_to_original_if_empty (keep the original if the result would be empty)

Shrink the region along its border.

reachability_removal

system_name, tool_name, reachability_threshold (0–0.95), minimum_component_area_after_reachability_removal (m²)

Keep only regions the robot can reach (IK-based).

region_division

rect_length, rect_width (m), minimum_area_after_division

Split the region into rectangles, producing several objects.