My main aim is to get the Drawing views of a STL file. I have tried the SolidWorks Method of converting a STL file to SLDPRT and then take the drawing views, but the drawing views in that case contains a lot of noise and is not accurate. SO, I am trying the Trimesh module. So far, with
slicex = meshx.section(plane_origin=meshx.centroid, plane_normal=[0,0,30])
slice_2D, to_3D = slicex.to_planar()
slice_2D.show()
and by changing the Plane_normal array values, I get the required cross section (which is somewhat similar to the three views), but I do not know how to save the image shown in the Console of Spyder as JPEG or PNG. I need the drawing views for further image analysis.
Any leads on this method or any other method to get the drawing views would be much appreciated! Thank you!
The best results I've seen for this is using matplotib and saving a scatter plot. You are able to adjust the resolution or save as a vector once it is in that format:
More details on the file format and options are here. This also works well for saving a full 2D mesh or a planar view of a 3D mesh, using the Trimesh.vertices as points.
ALTERNATIVE
If you're wanting to replicate what
slice_2D.show()does, you can just borrow from its code (which uses matplotlib):