replace block of code in osm file

asked 2020-09-16 13:02:19 -0600

xchen's avatar

Hi, is there a way to replace a block of code in the osm file, like an OS:Space object, with text from a csv or txt file, using the openstudio API?

In the model:


Space 1 Name,

Space 1 Handle,

line 1,

line 2,

line 3;

Replace with the following lines from an external file:


Space 1 Name,

Space 1 Handle,

line 11,

line 12,

line 13;

edit retag flag offensive close merge delete


This isn't an ideal way to work with the OpenStudio APi and is only possible for fields within an object not the object itself. It would be easy to create a corrupted model that may not open, crash while using, it or fail to run. This field level API access is how EnergyPlus Measure in OpenStudio work, but at that point object names and not objects handles are used to refer to other objects so editing fields is much simpler. This is done using methods like object.setString(6,"hello") or object.getString(6)

David Goldwasser's avatar David Goldwasser  ( 2020-09-17 17:17:39 -0600 )edit