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 a noisy, e.g. reconstructed, mesh. |
|
none |
Keep the largest connected region; remove speckles. |
|
|
Keep the mesh inside a region of interest. |
|
|
Patch holes smaller than this diameter. |
|
|
Sharpen edge features. |
|
|
Remove connected regions smaller than this. |
|
|
Upsample, usually a coarse CAD mesh. |
|
|
Remove high-curvature regions a disk tool cannot follow. |
|
|
Shrink the region along its border. |
|
|
Keep only regions the robot can reach (IK-based). |
|
|
Split the region into rectangles, producing several objects. |