SteveDoyle2 / pyNastran

A Python-based interface tool for Nastran's file formats
Other
384 stars 147 forks source link

Can more conversion formats be supported #779

Closed karma0704 closed 4 months ago

karma0704 commented 4 months ago

Nastran now supports many conversion formats, which is great. I wonder if it can support more formats. For example, the current conversion to vtk file only supports the generation of vtk files in XML format. Can it be added to support VTK files in ordinary text format, such as The following VTK formats: """

vtk DataFile Version 3.1

USELESS LINE ASCII DATASET UNSTRUCTURED_GRID POINTS    12 float 0 0 0 1 0 0 1 1 0 0 1 0 0 0 1 1 0 1 1 1 1 0 1 1 2 0 0 2 1 0 2 0 1 2 1 1

CELLS    2   18 8      0      1      2      3      4      5      6      7 8      1      8      9      2      5     10     11      6

CELL_TYPES    2 12 12

POINT_DATA    12 SCALARS v float LOOKUP_TABLE default 0 1 1 0 0 0 0 0 0 0 0 0 """

SteveDoyle2 commented 4 months ago

It used to be like that, but I don't want to maintain the data format. I just want to use the same code as the gui does. If you can figure out how to write that using vtk, then maybe.

I guess the bigger issue is I don't understand the use case. Where are you trying to use it? What's the issue with vtu? What is the advantage of an ascii file over something that's mostly binary?

karma0704 commented 4 months ago

It used to be like that, but I don't want to maintain the data format. I just want to use the same code as the gui does. If you can figure out how to write that using vtk, then maybe.

I guess the bigger issue is I don't understand the use case. Where are you trying to use it? What's the issue with vtu? What is the advantage of an ascii file over something that's mostly binary?

Because files in this format are much smaller than files in xml format, only about 20% of the size of the original file

SteveDoyle2 commented 4 months ago

I added a compression_level flag (0-9) that should help somewhat with big data. I found out that that vtk format is legacy, so I'd prefer not to write it. There's a vtkHDFReader class and presumably a vtkHDFWriter class that would be much smaller. Not sure how to do it though. Could you look into it?

karma0704 commented 4 months ago

OK, thank! i try it