3

Replace generic BuildingSurface:Detailed with more specific surface

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
...
bbrannon4's avatar
1.7k
bbrannon4
asked 2016-10-04 11:39:53 -0500
Aaron Boranian's avatar
14.1k
Aaron Boranian
updated 2023-03-22 13:08:45 -0500
edit flag offensive 0 remove flag close merge delete

Comments

2

Just curious, why would you like to do this?

Jeremy's avatar Jeremy (2016-10-04 13:23:12 -0500) 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 -0500) edit
add a comment see more comments

3 Answers

4

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)
Jamie Bull's avatar
5.1k
Jamie Bull
answered 2016-10-04 12:10:55 -0500, updated 2016-10-04 15:32:47 -0500
edit flag offensive 0 remove flag delete 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 (2016-10-04 15:14:30 -0500) edit
add a comment see more comments
4

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.

Jeremy's avatar
1.6k
Jeremy
answered 2016-10-04 13:20:02 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
4

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

Annie Marston's avatar
4.3k
Annie Marston
answered 2016-10-04 12:04:47 -0500
edit flag offensive 0 remove flag delete link

Comments

I'm going to have you removed from UnmetHours.

__AmirRoth__'s avatar __AmirRoth__ (2016-10-04 15:19:57 -0500) 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 -0500) 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 -0500) 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 -0500) 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 -0500) edit
add a comment see more comments