# Adding a new MeshIO Reader

**URL:** https://discourse.kitware.com/t/adding-a-new-meshio-reader/536
**Category:** Simulation Modeling Toolkit (SMTK)
**Created:** [September 15, 2020, 6:26pm UTC](https://discourse.kitware.com/t/adding-a-new-meshio-reader/536 "2020-09-15T18:26:27Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![bram.metsch](https://discourse.kitware.com/letter_avatar_proxy/v4/letter/b/ecd19e/32.png) [@bram.metsch](https://discourse.kitware.com/u/bram.metsch)
#### Post date: [September 15, 2020, 6:26pm UTC](https://discourse.kitware.com/t/adding-a-new-meshio-reader/536/1 "2020-09-15T18:26:27Z")

</div>

I am trying to implement a new MeshIO reader to use inside a CMB plugin. I have derived a class from MeshIO, implemented read() and importMesh(). Furthermore, I have written a second class that adds the reader to smtk::io::ImportMesh.SupportedIOTypes (via the STARTUP functionality in paraview\_plugin\_add\_auto\_start) . I can conform that this registration is actually performed while loading the plugin.  
However, I am not able to access the reader through the Modelbuilder GUI - the file type which it should add support for is not listed. So, I must have missed something, but I cannot figure out from the documentation. While further investigating the code I found out that the built-in readers somehow are processed by the pqSMTKRegisterImportersBehavior, but it is not clear to me how I can register my own reader here. Can somebody give some advice on this?

---

<div class="post-metadata">

### Author: ![tj.corona](https://discourse.kitware.com/user_avatar/discourse.kitware.com/tj.corona/32/35_2.png) [@tj.corona](https://discourse.kitware.com/u/tj.corona)
#### Post date: [September 15, 2020, 6:36pm UTC](https://discourse.kitware.com/t/adding-a-new-meshio-reader/536/2 "2020-09-15T18:36:22Z")

</div>

You may want to follow the instance of `MeshIOVTK`; in it, there are `AutoInit_Construct` and `AutoInit_Destruct` methods that you may be missing. Also, make sure your MeshIO class adds file types and extensions to its `Formats` instance. These are used during dispatch. Finally, you can break/put print statements in `smtk/io/ImportMesh.cxx`’s call operators to see which importer is considered and how the importer is making its selection.

> the built-in readers somehow are processed by the pqSMTKRegisterImportersBehavior, but it is not clear to me how I can register my own reader here

This should happen automatically, so you don’t need to worry about it.

---

<div class="post-metadata">

### Author: ![bram.metsch](https://discourse.kitware.com/letter_avatar_proxy/v4/letter/b/ecd19e/32.png) [@bram.metsch](https://discourse.kitware.com/u/bram.metsch)
#### Post date: [November 9, 2020, 11:01am UTC](https://discourse.kitware.com/t/adding-a-new-meshio-reader/536/3 "2020-11-09T11:01:51Z")

</div>

Sorry for the late reply, but thank you very much, basically it works now.  
However I need to preload the .so before starting the modelbuilder to actually be able to use the reader,  
converting it into a paraview plugin did not work.
