First time here? Check our help page!
2

Format IDF files using command line

Is there a way to run whatever the IDF Editor runs to format the txt of the IDF file, meaning one field per line, field name added as comment, field lines indented, order objects in the IDF file by type, etc?

Based on the comments in the txt file after being formatted, I need a command line something for whatever does this,

!-Generator IDFEditor 1.50
!-Option SortedOrder

The only way I know to get the IDF file formatted and sorted is by opening the IDF Editor, adding a new object, saving the IDF, deleting the newly created object, then saving again.

I need correct formatting for a script I have written to compare PNNL models at different years and in different geographical locations. This very concisely summarizes what ASHRAE standards changed that were applicable to the building type, but the comparison is highly dependent on standard formatting and correct field names.

mldichter's avatar
2.6k
mldichter
asked 2019-12-05 15:41:58 -0500
edit flag offensive 0 remove flag close merge delete

Comments

@mldichter if you're mostly interested in ordering objects in a consistent manner, you could use Eppy to open and save the file.

Jeremy's avatar Jeremy (2019-12-05 17:32:57 -0500) edit

There's definitely a python script somewhere on Unmethours that Jamie Bull wrote (for windows only). Edit: cf https://unmethours.com/question/535/s...

Julien Marrec's avatar Julien Marrec (2019-12-06 02:16:55 -0500) edit

@Jeremy The order doesn't matter within an object type, but having the objects types separated into groups does matter. More importantly, adding the field names as comments and indenting consistently.

mldichter's avatar mldichter (2019-12-06 10:12:35 -0500) edit

@Jamie Bull Do you have a windows python script for this?

mldichter's avatar mldichter (2019-12-06 10:13:44 -0500) edit

@mldichter if the order doesn't matter, reading and saving the file using Eppy will output an idf file with objects types separated into groups. I think the script Julien refers to is to mimic what the IDF Editor does.

Jeremy's avatar Jeremy (2019-12-06 18:29:35 -0500) edit
add a comment see more comments

1 Answer

1

Thanks to @Julien Marrec, there is a post with a python script that does the job. I submitted an answer at the bottom of the post that could run on my laptop, but the script is a little dangerous.

mldichter's avatar
2.6k
mldichter
answered 2019-12-17 10:44:00 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments