I'm currently working on a project which use PyQt5 to be able to display 3D object using opengl.GLViewWiget
I have already download a .stl file and a base of PyQt5 module
self.Widget3D = opengl.GLViewWidget(self.centralwidget)
self.Widget3D.setGeometry(QtCore.QRect(1000, 100, 351, 271))
self.Widget3D.setObjectName("Widget3D")
I have a problem with .STL file I have install numpy-stl
and read through its document but haven't really find a way to extract it and use with GLMeshItem
as far as I find is this example code
#Extract vertex points and face faces from the STL file.
points, faces = self.loadSTL(filename)
meshdata = gl.MeshData(vertexes=points, faces=faces)
mesh = gl.GLMeshItem(meshdata=meshdata, smooth=True, drawFaces=False, drawEdges=True, edgeColor=(0, 1, 0, 1))
self.viewer.addItem(mesh)
The self.loadSTL
part is unclear for me for how to really use the numpy-stl
in this code