pymapdl
pymapdl copied to clipboard
Documentation / wrapping of the VTK interfaces
Pyansys already has great VTK export capabilities, as it uses VTK for representation already. But it doesn't have a documented way to export either geometries, meshes or results to vtk, which adds a lot of functionality (in my case, creating raytraced renders of my structure in paraview).
These exports are already possible. For area geometry you can export through the use of mapdl.geometry.generate_surface().save(), and at the mesh level you can export through the use of mapdl.mesh._grid.save() (I'm guessing the results are also exportable in this way, but I haven't gotten there yet).
Both of this interfaces to the unstructured grid object (and subsequently, its save() function) I found by looking at the code of mapdl.eplot() and mapdl.aplot(). My suggestion is to either document how to get these vtk objects (just giving "publicity" to the already existing interfaces) and then refering to the pyvistas documentation for further processing, or create a simple wrapper function of the save method at the geometry and mesh level (mapdl.geometry.export_vtk() and mapdl.mesh.export_vtk()). Giving publicity to these features through the docs (making it obvious that pyansys can already do this) would probably attract new users, as vtk is already widely used for postprocessing purposes.
PS: I know I'm making a lot of issues related to features and design of the library itself lately. If you want me to tone it down and keep the issue board only for functionality/serious issues, please tell me.
PS: I know I'm making a lot of issues related to features and design of the library itself lately. If you want me to tone it down and keep the issue board only for functionality/serious issues, please tell me.
The more the merrier. I just have to work on the documentation to make this useful. Good on you to dig through the code to figure out how to implement this on your own, but I need to clean up the APIs. Working on this right now in #376.
Results are indeed exportable via VTK, and those APIs need to be exposed as well. I feel these are critical features as we need to make MAPDL usable in a broad set of applications, not just confined to the MAPDL world.
Actually, along those lines, if you could create list of features you need to make MAPDL more accessible from VTK, I'd really appreciate that. GitHub lets you create cool lists with check boxes:
- [ ] Item a
- [ ] Item b
- [ ] Item c
- [ ] etc...
I can then either start ticking them off one at a time, or get them in one go with a single PR. Also, If possible I'd like you to look over the APIs to make sure they fit your needs.
As of now I haven't yet gotten to result exploration in my project, but I plan to have some initial results to explore in a couple of weeks, so I will make that checklist then, once I'm more familiar with how the existing VTK support works, so the list is as useful as I can make it.
I'll keep working on the API and add documentation/examples along the way. You can evaluate it in a few weeks once I've merged the PR, pushed the next minor/patch release, and let the dust settle.
Hi @CesarRodriguezPereira, would it be possible to add specific features you'd like documented or exposed? Ready to update the docs right now.
Hi @akaszynski.
I think the main thing to document as far as VTK goes would be how to work with mapdl.mesh._grid and storing model results in that grid. There is already an (example)[https://mapdldocs.pyansys.com/examples/00-mapdl-examples/transient_thermal.html] in the docs, where the nodal temperatures are saved to the grid, but explicit documentation would be great.
With this process of storing solutions in the VTK explained in the docs and a link to the pyvista docs (so people can learn about the object they're creating, how to save to a file, how to make custom plots, etc), I think the exporting process would be perfectly documented.
Hi @akaszynski After having worked longer with pyansys I finally have a few things that would make the VTK interfacing a bit better:
- [ ] Add easier 3D result exporting methods (instead of having to merge a dictionary to a hidden _grid() method.
- [ ] Return vtk plot object when plotting, instead of just the camera position.
- [ ] Add some interface to the plot labels. For example, modal analysis lists the frequency as time, this could be easily corrected by the end user.
These are the main things that I think would make the vtk interface a lot better, giving a bit more control to the user, and would allow end users to make better stuff with these vtks (quicker export for postprocessing in programs such as paraview, or embeding vtk plots/animations on websites, these kinds of things).
PS: I don't know if any of these are already implemented, right now I'm using 0.58.5 so I'm a bit behind
#355
Pinging @akaszynski for updates.
Pinging @akaszynski for updates.
We just need a separate section for this. Once I'm done with the SciPy tutorial ping me.
pinging @akaszynski
I think the main thing to document as far as VTK goes would be how to work with mapdl.mesh._grid and storing model results in that grid.
Key point here. It seems you want to have an easy way to take a model (pyvista mesh) and add values, and then later plot them. I agree we should document those.
@akaszynski @CesarRodriguezPereira I will taking over this issue (as all the others).
I'm not sure how much time I will be able to commit to this though.