First time here? Check out the Help page!

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 8 years ago

bbrannon4's avatar

updated 2 years ago

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
...
Preview: (hide)

Comments

2

Just curious, why would you like to do this?

Jeremy's avatar Jeremy  ( 8 years ago )

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  ( 8 years ago )

3 Answers

Sort by » oldest newest most voted
4

answered 8 years ago

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.

Preview: (hide)
link
4

answered 8 years ago

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).

Preview: (hide)
link

Comments

I'm going to have you removed from UnmetHours.

__AmirRoth__'s avatar __AmirRoth__  ( 8 years ago )

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

Annie Marston's avatar Annie Marston  ( 8 years ago )

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  ( 8 years ago )

@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__  ( 8 years ago )

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

Annie Marston's avatar Annie Marston  ( 8 years ago )
4

answered 8 years ago

updated 8 years ago

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)
Preview: (hide)
link

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  ( 8 years ago )

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: 8 years ago

Seen: 343 times

Last updated: Oct 04 '16