-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems with wavefront object as GLMeshItem in Pyqtgraph #133
Comments
Hello, thanks for the bug report! A few questions/requests: Did you launch your command from a command line? If so, are you able to include the full command you used to launch, as well as reformatting the output to Markdown? You can use the same "```" technique as you used for the script contents. Are you also able to include the contents of Thanks! |
Hi @greenmoss! Thanks for the quick reply. The commands are part a Jupyter notebook that I use to test parts of my code before applying them in my main code. I just edited the output accordingly, sorry about that! Attached you can find the Wavefront model - it's a model from the www that I simplified using Blender and exporting it to a wavefront object. Another weird thing that is happening: In Blender I could choose the Forward and Top Axis, which I have chosen to be the same as in my GLViewWidget. However, when importing the model as a GLLinePlot, the model is rotate 90° to the left of the x-axis. Using the rotating function seems to fail as the model is then not shown anymore.. But I guess that is an issue with pyqtgraph, isn't it? |
Thanks for the reformat! Looking at your code, there are some I don't have experience with Jupyter or Pyqtgraph. Based on the stack trace, I'd think Some things to try:
|
Thanks for your input! Just managed to transform the outputs in the suitable format for PyQtGraph (extracted all faces into a separate array). (Print statements are just for debugging purposes.. I have used one of the examples and exchanged the model and it works fine, so the problem is definitely due to format issues...) |
@Cocco17 Pls Can you point me in the right direction to towards how you managed to transform the output in the suitable format for pyqtgraph. ? I`m having simiar issues. |
Hi @nitieaj! Sorry for the late response, had a few days of vacation. # Vehicle
vehicle = scene = pywavefront.Wavefront('./vehicle.obj', strict=False, create_materials=True, collect_faces=True)#, cache=True) # Cache is currently not working?!
# Conversion - Pywavefront to PyQtGraph GLMeshItem
vertices_array = np.asarray(vehicle.vertices)
faces_array = []
for mesh_lists in vehicle.mesh_list:
for faces in mesh_lists.faces:
faces_array.append(np.array([faces[0],faces[1],faces[2]]))
faces_array = np.asarray(faces_array)
# Plotting the data in PyQtGraph
vehicleMesh = gl.MeshData(vertexes=vertices_array, faces=faces_array)
vehicleGL = gl.GLMeshItem(meshdata=vehicleMesh, drawEdges=True, edgeColor=(0,1,0,1), smooth=True)
vehicleGL.scale(100,100,100)
self.graphicsView.addItem(vehicleGL)
self.graphicsView_viewResults.addItem(vehicleGL) However, I did not manage to add the textures/materials of the model. I'm not sure whether this is possible or not with PyQtGraph - if you find a way, please let me know! Furthermore, the cache function in pywavefront has not been working for me. The created binary file cannot be processed after its creation - again, if you find a solution, happy to hear back from you! |
Hi there!
I'm trying to use PyWavefront to read an wavefront object and visualise it using Pyqtgraph.
Using the faces and vertices data for GLLinePlotItem and GLScatterPlotItem works fine, but there seems to be a compatibility issue with the vertices and faces data with GLMeshItem:
Does anybody try to use PyWavefront in combination with Pyqtgraph already? Can any body help me to find the problem and a solution? Looking forward for some help, thanks a lot in advance!
The code:
The text was updated successfully, but these errors were encountered: