Closed Cocco17 closed 3 years ago
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 BMW_simple.obj
?
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 print
statements. Are those part of the output as well?
I don't have experience with Jupyter or Pyqtgraph. Based on the stack trace, I'd think File "/Users/X/test_pywavefront.py", line 45
is the place to look. Presumably that is line 45 of your code above?
Some things to try:
BMW_Easy.obj
file with PyWavefront only. There are some example renderers in the examples directory.pyqtgraph.opengl.GLMeshItem
is expecting a different format. See if you can transform the output from PyWavefront to the format expected by pyqtgraph. Maybe an array/list?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...)
Thanks for your input! Just managed to transform the outputs in the suitable format for PyQtGraph (extracted all faces into a separate array)
@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. This is the code I used to transform the pywavefront object to a plot in pyqtgraph:
# 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: