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

How to remove all objects that contain a certain word in the objectname in one time?

asked 2021-06-18 04:45:48 -0600

Jasper's avatar

Hello,

I have several IDF files from which I need to remove all objects with a certain word in the objectname. For example, I would like to delete all objects in 1 time that contain the word 'WCBOVEN '.

How can I best approach this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-06-18 14:03:45 -0600

sashadf1's avatar

updated 2021-06-18 14:29:17 -0600

I would recommend downloading EnergyPlus Python https://pypi.org/project/eppy/. You can typically load in the IDF into a Jupyter notebook (https://jupyter.org/) and hopefully find a method to change large chunks of text in the IDF automatically.

Eppy description: "You can programmatically navigate, search, and modify EnergyPlus idf files using eppy."

You can "Make a large number of changes in an idf file with a few lines of eppy code."

"Use conditions and filters when making changes to an idf file"; in this case, based on the WCBOVEN condition.

Make changes to multiple idf files! You mentioned "several" IDFs.

You need these lines to load the IDF:

import sys pathnameto_eppy = 'c:/eppy' pathnameto_eppy = '../' sys.path.append(pathnameto_eppy)

loop through several IDFs?

from eppy import modeleditor from eppy.modeleditor import IDF iddfile = "../eppy/resources/iddfiles/Energy+V7_2_0.idd" #replace with your version of E+ here fname1 = "../eppy/resources/idffiles/V_7_2/smallfile.idf" #replace with your version of E+ and IDF name (smallfile replacement)

IDF.setiddname(iddfile) idf1 = IDF(fname1)

Look for an eppy method/function to delete all objects based on WCBOVEN in object name condition. Another option may be to write an E+ measure to do this instead, if you are generating your model through OpenStudio/PAT or another GUI that supports E+ measures. You can follow this post for that strategy: https://unmethours.com/question/29576...

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

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2021-06-18 04:45:48 -0600

Seen: 205 times

Last updated: Jun 18 '21