I'm trying to get to the end on a code that will help me scripting the generation of customized stl files.
The general needs I have are to :
- be in python and if possible without other back-end software
- minimize the dependencies
- produce lightweight models
and specifically to :
- generate a 3D mesh for regular shapes
- generate a 3D mesh from text based on different fonts
- wrap the text mesh around a cylinder
- perform boolean operations
So far, I cannot find the right library to perform those operations.
I found the library sdf which is really awesome but generate large models.
Trimesh is great. I managed to generate the meshes of the structure, export to HTML and STL but cannot perform boolean operations without back-end.
I looked a bit into Pymesh but the librairy seems not beeing developped anymore and has a large number of dependencies.
I'm now trying with looked quickly into PyVista but currently can't get into issues with non manifold models.
here is the code that I want manifold
import numpy as np
import pyvista as pv
RES = 20
vertices = np.array([
[20.5, -17.5, 0.0],
[24.39711432, -8.75, 0.0],
[24.39711432, 8.75, 0.0],
[20.5, 17.5, 0.0],
[19.20096189, 8.75, 0.0],
[19.20096189, -8.75, 0.0],
[20.5, -17.5, 0.0]])
profile = pv.MultipleLines(vertices)
profile.plot(color='tan')
extruded = profile.extrude_rotate(resolution=RES**2, rotation_axis=(0, 1, 0))#, capping=False)
print(extruded.is_all_triangles)
print(extruded.is_manifold)
print(extruded.extract_geometry().n_open_edges)
extruded.plot_normals()
# Check if all triangles :
extruded = extruded.fill_holes(4*RES)
print(extruded.is_all_triangles)
print(extruded.is_manifold)
print(extruded.extract_geometry().n_open_edges)
extruded.plot_normals()
extruded.plot(color='tan')
Step 2 is add text around it.