This script allows you to load your mesh and align it with the origin coordinates. It's a handy tool for those who work in reverse engineering, or any field that requires precise mesh alignment.
To use this script, you must have Python installed on your computer along with the following libraries:
pip install numpy pyvista scipy scikit-learn
-
Select your mesh file as a .ply file. This will be the input mesh you wish to align.
-
Choose at least three points on the mesh to define a plane. You can add as many points as you like for more accurate alignment.
-
Confirm the alignment of the selected plane to one of the world coordinate system axes by pressing
x
,y
, orz
. -
Select points again for the second axis. Make sure to confirm the selection with
x
,y
, orz
, ensuring that this axis is different from the first one chosen. -
Once the second axis is selected and confirmed, the mesh will be aligned according to these two axes.
-
Press the
s
key to save the aligned mesh. It will be saved astransformed_mesh.stl
in the same folder.
Here's a screenshot to help you visualize the process: