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

Revision history [back]

click to hide/show revision 1
initial version

Create Openstudio model Object from an .osm File

I know that this question is so incredibly simple but I have been scouring this forum and looking through OpenStudio measures for the last hour without any luck.

I have a .osm file that I have created and saved and I want to turn this .osm file into an OpenStudio Model Object so that I can edit it with OpenStudio SDK. I see that I can initialize a model object from an IDF file but there doesn't seem to be a class method for initializing such a model object from an .osm.

I am sure that there must be a way but it's hiding in plain sight from me. I am using OpenStudio C# bindings but any example code that uses the OpenStudio SDK would be a great answer.

Thank you,

UPDATE: I realized something hiding in plain sight: there's a load() method under 'Static Public Member Functions' in the page that I linked to, which seems to be made for converting .osm files to model objects. However, the following code is still returning an empty model for me:

import OpenStudio
osmPath = "C:\MyModels\model.osm"
model = OpenStudio.Model()
model.load(OpenStudio.Path(osmPath))

SOLVED: This code finally worked for me:

import OpenStudio
osmPath = "C:\MyModels\model.osm"
model = OpenStudio.Model().load(OpenStudio.Path(osmPath)).get()

Create Openstudio model Object from an .osm File

I know that this question is so incredibly simple but I have been scouring this forum and looking through OpenStudio measures for the last hour without any luck.

I have a .osm file that I have created and saved and I want to turn this .osm file into an OpenStudio Model Object so that I can edit it with OpenStudio SDK. I see that I can initialize a model object from an IDF file but there doesn't seem to be a class method for initializing such a model object from an .osm.

I am sure that there must be a way but it's hiding in plain sight from me. I am using OpenStudio C# bindings but any example code that uses the OpenStudio SDK would be a great answer.

Thank you,

UPDATE: I realized something hiding in plain sight: there's a load() method under 'Static Public Member Functions' in the page that I linked to, which seems to be made for converting .osm files to model objects. However, the following code is still returning an empty model for me:

import OpenStudio
osmPath = "C:\MyModels\model.osm"
model = OpenStudio.Model()
model.load(OpenStudio.Path(osmPath))

SOLVED: This code finally worked for me:

import OpenStudio
osmPath = "C:\MyModels\model.osm"
model = OpenStudio.Model().load(OpenStudio.Path(osmPath)).get()

Create Openstudio model Object from an .osm File

I know that this question is so incredibly simple but I have been scouring this forum and looking through OpenStudio measures for the last hour without any luck.

I have a .osm file that I have created and saved and I want to turn this .osm file into an OpenStudio Model Object so that I can edit it with OpenStudio SDK. I see that I can initialize a model object from an IDF file but there doesn't seem to be a class method for initializing such a model object from an .osm.

I am sure that there must be a way but it's hiding in plain sight from me. I am using OpenStudio C# bindings but any example code that uses the OpenStudio SDK would be a great answer.

Thank you,

UPDATE: I realized something hiding in plain sight: there's a load() method under 'Static Public Member Functions' in the page that I linked to, which seems to be made for converting .osm files to model objects. However, the following code is still returning an empty model for me:

import OpenStudio
osmPath = "C:\MyModels\model.osm"
model = OpenStudio.Model()
model.load(OpenStudio.Path(osmPath))

SOLVED: This code finally worked for me:

import OpenStudio
osmPath = "C:\MyModels\model.osm"
model = OpenStudio.Model().load(OpenStudio.Path(osmPath)).get()

Create Openstudio model Object from an .osm File

I know that this question is so incredibly simple but I have been scouring this forum and looking through OpenStudio measures for the last hour without any luck.

I have a .osm file that I have created and saved and I want to turn this .osm file into an OpenStudio Model Object so that I can edit it with OpenStudio SDK. I see that I can initialize a model object from an IDF file but there doesn't seem to be a class method for initializing such a model object from an .osm.

I am sure that there must be a way but it's hiding in plain sight from me. I am using OpenStudio C# bindings but any example code that uses the OpenStudio SDK would be a great answer.

Thank you,