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

Replace generic BuildingSurface:Detailed with more specific surface

asked 2016-10-04 11:39:53 -0600

bbrannon4's avatar

updated 2023-03-22 13:08:45 -0600

Does anyone know of an existing script or tool that can convert BuildingSurface:Detailed objects to their respective more specific objects like Wall:Detailed, Floor:Detailed, or RoofCeiling:Detailed?

I was hoping to do it with a RegEx find and replace, but it needs to retain the name of the object, so I think it would need to be a slightly more detailed script, but hoped something similar existed before I wrote a new one.

So for example:

BuildingSurface:Detailed,
    L1-101-EntranceExit_Srf_0,  !- Name
    FLOOR,                   !- Surface Type
    Floor_Slab,              !- Construction Name
...

would be replaced with

Floor:Detailed,
    L1-101-EntranceExit_Srf_0,  !- Name
    Floor_Slab,              !- Construction Name
...
edit retag flag offensive close merge delete

Comments

2

Just curious, why would you like to do this?

Jeremy's avatar Jeremy  ( 2016-10-04 13:23:12 -0600 )edit

I was using Rhino/Honeybee to generate my geometry, and it seems to split out surfaces all as BuildingSurface:Detailed, but it makes it a little easier for me to organize if they are in their own categories. It's not necessary, just a convenience.

bbrannon4's avatar bbrannon4  ( 2016-10-04 15:13:49 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted
4

answered 2016-10-04 13:20:02 -0600

You could do it using Regex. The downside is that you might have to adapt your regex for each type of surface. For your example you could use BuildingSurface:Detailed,\r\n(.*.)\r\n(.*.floor.*.)\r\n(.*.) in the search field and Floor:Detailed,\r\n\1\r\n\3 in the replace field. Then for a wall you could replace .*.floor.*. by .*.wall.*. and Floor:Detailed by Wall:Detailed.

edit flag offensive delete link more
4

answered 2016-10-04 12:04:47 -0600

I would so this in excel, do an =if(x="floor,","Floor:Detailed,",if(x="ceiling,","Ceiling:Detailed,","")) and so on, you an write the whole object really quickly. I use this type of script a lot of changing surface type. You can write the whole thing reasonably quickly using excel. I am sure there are other scripts as well but excel works great for me (and is super easy).

edit flag offensive delete link more

Comments

I'm going to have you removed from UnmetHours.

__AmirRoth__'s avatar __AmirRoth__  ( 2016-10-04 15:19:57 -0600 )edit

@_amiriRoth_ I have a t-shirt with "I heart excel" written on it

Annie Marston's avatar Annie Marston  ( 2016-10-04 16:16:29 -0600 )edit

can you elaborate on this concept/solution? Like, is this a VBA script that modifies the idf text or is there a copy/pates import/export to/from excel used as part of the process? Thanks in advance.

dradair's avatar dradair  ( 2016-10-04 16:52:48 -0600 )edit

@Annie Marston, I will make you a T-Shirt with "I heart OpenStudio" on it if that is all it takes. Also, it's underscore underscore AmirRoth underscore underscore, i.e., the Python way.

__AmirRoth__'s avatar __AmirRoth__  ( 2016-10-04 17:11:03 -0600 )edit

@__AmirRoth__ that might actually work, I am a sucker for a good t-shirt.

Annie Marston's avatar Annie Marston  ( 2016-10-05 07:56:18 -0600 )edit
4

answered 2016-10-04 12:10:55 -0600

updated 2016-10-04 15:32:47 -0600

This (edit - actually, not 100% the same as this converts to simple surfaces) is implemented in eppy in the simplesurface module. Watch out for the typo in the function for coverting all the BUILDINGSURFACE:DETAILED objects to simple surfaces. That should be simplesurface but is actually simplesufrace - issue #138.

Usage is as follows:

from eppy.modeleditor import IDF
from eppy.simplesurface import simplesufrace  # (sic)

iddfile = <path to your idd>
fname = <path to your idf>

IDF.setiddname(iddfile)
idf = IDF(fname)

# get the BuildingSurface:Detailed object
bsd = idf.getidfobject('BUILDINGSURFACE:DETAILED', floorname)

# convert it in place
simplesufrace(idf, bsd, deletebsd=True)  # (again, sic)
edit flag offensive delete link more

Comments

1

Thanks, this also would solve my problem. I used Jeremy's solution because it was a little quicker, but I'll definitly dig into eppy for future use.

bbrannon4's avatar bbrannon4  ( 2016-10-04 15:14:30 -0600 )edit

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: 2016-10-04 11:39:53 -0600

Seen: 309 times

Last updated: Oct 04 '16