Loading FACET files in VTK in Python

Hello, I am developing a GUI that features an interactive viewing window for rendering a 3d object. The files that must be used for the rendered object are .FACET files. Currently I am using the vtkFacetReader to load in these files and is created using ‘reader = vtk.vtkFacetReader()’. My problem is that the facet reader seems very picky about which files it accepts. I also can’t find any documentation regarding using the vtkFacetReader in Python. So far the reader will not accept any FACET file that contains more than one part, will not accept parts that have spaces in their names (though I have written a script that ensures there are no spaces in names), and will not accept files where the “big” part and “little” part have different names. Currently I run a script that converts a FACET file into a FACET file that VTK will run. My problem is that I don’t have a ton of data to test this script on to ensure that it will always work. I’m beginning to wonder if there is a better way to load these files in without needing to modify the file. Maybe there’s a way to load the data from the file directly into the renderer? Does anyone have any suggestions or tips? I apologize if the formatting is rough, I’m on mobile.

The FACET reader looks very old. Basically just critical feature additions (CanReadFile) and automated fixups (typos, static analysis, style changes, etc.) since its addition in Dec 2004. I’d say that anything beyond basics would need some focused attention to improve the reader to read more complicated data structures.

Cc: @mwestphal

Do you have any suggestions for loading FACET files? The use of FACET files is a hard constraint and cannot be changed. Is it possible to write my own facet reader that directly loads data into the renderer? That seems like it may be my next step.

You probably want to improve the current vtkFacetReader to support any feature you may want, and contribute your changes back into VTK.

I am completely willing to improve vtkFacetReader. How do I go about this? Is there a way to use the changes I make in the source code within my application for proper testing?

How do I go about this?

Please read this :slight_smile:


Is there a way to use the changes I make in the source code within my application for proper testing?

Of course, every changes made in VTK will require a test to be added