I have CAD models with colors already applied (.obj (with .mtl)). How do I import the .obj file and apply the .mtl file to display the colors correctly? I have not found a clear or concise way of doing this.
Also, would the same method apply to a .vrml file which contains color information?
I am not familiar with OSPRay settings or creating my own color editor colormap.
Thank you, I love using Paraview to display scientific results, I would just love to be able to overlay that data on great looking CAD models.
Do I have to ‘edit’ the python file each time I want to load an .obj file? I’m assuming I have to change the ‘User conifguration’ each time and change the ‘objToLoad’ and ‘mtlToLoad’ variables.
Are the installation steps: Macros–>Add new macro? I changed the path and file names to load and then loaded the macro, but nothing appears to happen when I click the macro’s button.
Are ‘objToLoad’ and ‘mtlToLoad’ the correct variable names? I don’t see those being used in the script?
The script will assume a file /path/to/your/file.mtl.
This will create a /path/to/your/file-pv-state.pvsm file that correspond to a state file that can be loaded in Paraview which will then contains all the textures and various settings the obj/mtl contains.
This is what I get when I run it from the cmd prompt:
Traeback (most recent call last):
File “obj-mtl-importer.py”, line 358, in
loadScene(objPath, ‘%s.mtl’ % objPath[:-4])
File “obj-mtl-importer.py”, line 337, in loadScene
objReader = OBJParser(objFilePath, ‘usemtl’)
File “obj-mtl-importer.py”, line 47, in init
self.parseLine(line.rstrip(’/n’))
File “obj-mtl-importer.py”, line 120, in parseLine
self.vn.append(float(tokens[3]))
ValueError: could not convert string to float: \
Dear Jourdain
I have finished the exchange from .obj and the assumed file .mtl. And also there is no error when I compile the script. Finally I got the .pvsm file, but how should I open it in paraview. I check that paraview can not be open the .pvsm type. How should I do this ?
Regards.
Feng
Thanks for your reply. I tried to load state with my .pvsm file. There is no visualization in the paraview. Can I send you my file? I am confused.
Regards.
Feng
example3.rar (1.4 MB)
There are files which I used. First I run the command /patch/to/…/pvpython obj-mtl-importer.py /patch/to…/1.obj and I got a new file 1-pv-state.pvsm and I load state in paraview with it(all files in this compressed file). But there is just nothing in paraviewer…
Regards
Dear Sebastien
I have deal with it. I load state and then view it in the database window. And I got the result which include image and obj mesh.
Thanks a lot
Regards~~
Feng
Hi, can you explain how do you show the rendering. I followed all the step, have my state loaded with several objects in the pipeline but nothin is showed.
Thanks
Reynlado