Meshlab¶
MeshLab (http://www.meshlab.net/) is a free tool that can be installed and used on a Mikado controller. MeshLab can be used to view and edit mesh-based CAD files such as the STL file format. The following tutorials explain CAD editing options that enable optimum results in object recognition.
Of course, you can also use a tool of your choice to implement the modifications to your CAD model.
Basics: Loading and saving STL¶
MeshLab GUI¶
Open MeshLab and load the desired product
Main menu → File → Import Mesh…
Select the desired file (e.g. in the mikado/cells/<cell name>/meshes/<file name>.stl directory)
Confirm “Post-Open Processing” message with OK
Export STL file:
File → Export Mesh As…
Enter new file name
Select STL as format → Save
Hint
Save modified CAD files under a new name so that you can restore old versions at any time.
Center product coordinate system¶
Display product coordinate system
Render → Show axis
MeshLab: Display coordinate system¶
Center coordinate system
Filters → Normals, Curvatures and Orientation → Transform: Move, Translate, Center
“translate center of bbox to the origin”
Apply
MeshLab: Transform coordinate system¶
MeshLab: Coordinate system centered¶
Hint
The coordinate system can also be moved and rotated manually using the “Transform” filter. If the STL is in a unit other than millimetres, this can also be converted here using the “Transform: Scale” filter (see Scale STL).
A preview is possible for most filters by activating the “Preview” option.
Scale STL¶
If you want to change the size of your CAD or change the unit, you can scale the STL using Meshlab.
Load CAD (see Basics: Loading and saving STL)
Scaling CAD
Filters → Normals, Curvatures and Orientation → Transform: Scale
MeshLab: Filter for scaling¶
Activate “Uniform scaling”
Activate “Preview” so that changes are displayed immediately
Adjust the factor for “X axis” (1.0 → 100%, 0.01 → 1%). For example, if you want to convert a CAD that was defined in meters to millimeters, select the value 1000.0
Apply
MeshLab: Filter for scaling - Settings¶
MeshLab: Scaled STL¶
Export STL (see Basics: Loading and saving STL)
STL Reduce number of triangles¶
The number of triangles of a product influences the loading time of a product and in particular the collision checks during path planning. It is recommended to reduce the number of triangles until important product features and structures are still recognizable.
The current number of triangles is shown in the status display at the bottom
Hauptmenü → Filters → Remeshing, Simplification and Reconstruction → Quadric Edge Collapse Decimation
MeshLab: Decimation filter¶
Specify the desired number of triangles → Apply
MeshLab: Decimated model of the T-piece¶
Remove STL surfaces¶
Many CAD design data contain some surfaces and structures that are never visible from a camera view. These include internal structures or, depending on the application, the underside of a product. This property can also be used to reduce the CAD for symmetrical parts. A sphere, for example, is always visible from a single camera as a hemisphere at most. In this case, the lower half of a sphere can be removed for an object search. This increases the maximum score that can be achieved. This leads to more stable and faster object position detection.
Example: For object matching of a sphere, a hemisphere leads to higher scores. However, the collision model must still represent the complete product.¶
Hint
The Product management chapter describes how different CADs can be set up for object searches and collision checks.
The following steps describe how the number of triangles can be decimated.
Load product (see Basics: Loading and saving STL)
Select areas (marked areas are colored red)
- Option 1: Rectangle selectionSelect faces in a rectangular region (“Select Faces in a rectangular region”)
Select selection symbol
Select the area of the CAD with the mouse button held down. All triangles that project into the area are added to the selection.
Hint
Notes on rectangle selection:
If you hold down the “Ctrl” key, the selected area is added to the existing selection
If you hold down the “Shift” key, the selected area is removed from the existing selection
The “ESC” button can be used to switch between selection and camera mode
To exit the selection mode, click on the selected symbol again
MeshLab: Rectangle selection¶
- Option 2: Brush toolSelect areas with the brush tool (“Z-Painting”)
Click on the brush symbol
Select marking brush (red brush)
“Brush” areas with the mouse
Hint
Notes on the brush tool:
Left mouse button adds areas to the selection
Right mouse button removes the selection areas
Brush type and size can be set using the brush options
The “ESC” button can be used to switch between brush and camera mode
To exit the selection mode, click on the selected symbol again
MeshLab: Brush selection¶
Remove areas
- Method 1:Remove structures selected on the product (Remove selected areas)
Selektierte Dreiecke entfernen (“Delete the current set of selected faces and all the vertices surrounded by that faces.”)
MeshLab: Selected triangles removed¶
- Method 2:Select what is visible to the camera on the product (remove all areas that are not part of the selection)
This method is used to select what is visible to the camera on the product (remove all areas that do not belong to the selection)
Invert selection
Filters → Selection → Invert Selection
Apply
MeshLab: Invert selection¶
MeshLab: Selection inverted¶
Selektierte Dreiecke entfernen (“Delete the current set of selected faces and all the vertices surrounded by that faces.”)
STL exportieren (s. Basics: Loading and saving STL)
Hint
View the selection from all sides before removing it. Elongated or misshapen triangles often lead to unwanted selections.
Also save intermediate versions.
Under certain circumstances, it can be helpful to change the Field Of View (FOV). To do this, hold down the “Shift” key while scrolling with the mouse wheel.
STL Automatically remove internal surfaces¶
Section Remove STL surfaces describes how to select and remove surfaces / triangles of a product using manual tools. If you want to remove the internal and therefore invisible triangles of your product, you can also have MeshLab do this automatically. MeshLab offers algorithms that detect hidden triangles.
The following instructions explain the individual steps using the example product ‘locking bolt’. The manufacturer’s CAD data also includes an internal bolt, which is not visible from the outside. In addition, deep holes are also rarely part of the point cloud, which is why triangles can also be removed here. These surfaces are removed in the following steps using Meshlab.
Load product (see Basics: Loading and saving STL)
MeshLab: An example product ‘Locking bar CAD’¶
Calculate ambient occlusion
In this step, a kind of “visibility rating” is calculated for each triangle. In the next step, this value serves as the basis for deciding whether the triangle can be removed or not.
Open the dialog for the Ambient Occlusion Filter under
Filters → Color Creation and Processing → Ambient Occlusion Per Vertex
Activate ‘Use GPU acceleration’, then confirm with ‘Apply’ The calculation is started and a visibility rating is assigned to each vertex as a quality feature. The areas are now displayed brightly if visibility is good and darkly if visibility is low.
MeshLab: “Visibility assessment” using the ambient occlusion filter¶
Select areas based on visibility
The results of the previous step can now be used as the basis for a selection/selection of triangles.
Filters → Selection → Select Faces by Vertex Quality
Set the ‘Min Quality’ parameter to the lowest value.
Activate “Preview”
Adjust ‘Max Quality’ until only the desired areas are selected (colored red)
‘Apply’
Hint
It may not be possible to clearly separate partially covered areas from the areas to be removed. In this case, you can also use manual tools to subsequently adjust the selection (see Remove STL surfaces).
Under ‘Render’ → ‘Render Mode’, you can switch between different types of visualization of the CAD model. The ‘Wireframe’ display, for example, also allows internal surfaces to be visualized as a triangular mesh.
MeshLab: Selection based on the visibility of an area with a low threshold value¶
MeshLab: Selection based on the visibility of a surface with a higher threshold value: further inner surfaces are selected. Selected surfaces are now also added in the lower area, as the structures are located in a depression.¶
Remove areas
Selektierte Dreiecke entfernen (“Delete the current set of selected faces and all the vertices surrounded by that faces.”)
MeshLab: The edited STL now has hardly any internal structures and can now be reworked manually or saved. As a high threshold value was selected in this example, the rings inside the lower holes have also been removed.¶
STL exportieren (s. Basics: Loading and saving STL)
