Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
2

Format IDF files using command line

asked 2019-12-05 15:41:58 -0500

mldichter's avatar

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.

edit retag flag offensive 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

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-12-17 10:44:00 -0500

mldichter's avatar

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Careers

Question Tools

1 follower

Stats

Asked: 2019-12-05 15:41:58 -0500

Seen: 267 times

Last updated: Dec 17 '19