DHI/mikeio

Readable pfs.write() output for non-unique-keyword pfs sections (e.g. in .plc)

wu-hao-liang opened this issue · 2 comments

For some pfs files with non-unique keywords, the output generated by mikeio.PfsDocument.write() is different from what produced by MIKE ZERO (pfs2004.dll)

Take the following plc files as an example ("ImageFileName","AxisUnit","PROPERTIES" are not unique keywords)
MIKE ZERO will write the pfs sections in a way like "Breadth-First Search" of the tree
PLC_MIKEZERO_pfs2004

mikeio will write the pfs sections in a way like "Detph-First Search" of the tree
PLC_MIKEIO_pfswrite

Both PLC files work normally producing a plot, but I hope the mikeio will write as the same style as MIKE ZERO.
This is more readable, and it can help when sometimes there is a need for people to read or revise PFS directly through a text editor.

This feature request is not urgent, but I hope it can be added in some later version.


I may submit my alternative solution of pfs.write() here later

Thanks for pointing this out. Not sure what we can do about it.
In MIKE IO we are trying to model the structure of a PFS Document in a simplified way, which doesn't match 1:1 with the original document. Based on the syntax in the example, there is no way to detect which data belonging to each IMAGE_FILE, unless you have specific knowledge that this is a pfs file for PLC and each item starts with the line ImageFileName = ...

of a PFS Document in a simplified way,

Thanks. it might be better to be able to choose a simple output style or the MIKE-ZERO-LIKE style, especially for the non-unique keywords. The section in the screenshot is just an example, I mean keeping the same style in one PFS file is good enough, not need to detect the item or section.