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

using OpenStudio model, how do I get the uuid value of a object-list field?

asked 2020-07-28 09:58:33 -0500

swami's avatar

updated 2020-07-28 15:36:56 -0500

Developing an app using openstudio modelobject

  1. Loaded a sample osm file into model
  2. Traversing the model to extract (.osm file) data
  3. for an object-list field, able to obtain referred object name.
  4. Since it is possible that the object name may not be unique, I would like to know the object's uuid rather than its name (from the object-list field) so that I can access the correct object.

Appreciate any help

edit retag flag offensive close merge delete

Comments

Are you asking how to get an OpenStudio object's UUID via the OpenStudio SDK?

shorowit's avatar shorowit  ( 2020-07-28 10:08:23 -0500 )edit

Boy! You guys are fast.

Yes, the SDK. Not Openstudio app. Sorry for not being clear. I am developing a C# app using OpenStudio.dll (2.9.0) etc. Thank you

swami's avatar swami  ( 2020-07-28 10:15:41 -0500 )edit

I looked at some of the handle utilities. However, could not figure out how to read off the UUID's Here is an example

OS:Construction, {7954b1de-6a1c-40aa-8ff5-ebcc278e204b}, ! Handle 000 Exterior Door, ! Name {fd5f6384-4bd6-4a16-aaf2-e2e57c7ac5e3}, ! Surface Rendering Name {6e535b8c-5f4e-49b4-9c8c-53def4ee5b3e}, ! Layer 1 {83088629-4598-4a88-9e3c-cbedee5e2f96}; ! Layer 2

Reading the Layer 1 & Layer 2 values (using idfObject.getString(4).get()) gives me the names of the material, not the UUID listed here.

swami's avatar swami  ( 2020-07-28 12:48:00 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
5

answered 2020-07-28 12:55:31 -0500

updated 2020-07-28 17:17:21 -0500

You can use foo.handle to get an OpenStudio::UUID object for any OpenStudio ModelObject. I don't know the exact syntax in C#, but here's an example in interactive Ruby:

image description

Edit:

If you want to get the UUID of a referenced object, you can do exactly as above by getting the referenced object and then calling .handle on it. Here's an example of getting the UUID of a layer in a construction:

image description

Edit 2:

If you want to get the UUID for a generic IdfObject, instead of calling foo.getString(4).get, you can call foo.idfObject.getString(4).get.

edit flag offensive delete link more

Comments

Given an object, I am able to read the UUID. No problem Like in the example I cited earlier, the problem is when I read an object-list field's value which is a uuid referring to another object, the result is not the uuid but the name of that object. I need to be able to read the field's literal uuid value. Thanks

swami's avatar swami  ( 2020-07-28 15:22:51 -0500 )edit

Thank you. Although that certainly works, I want to be able to get the same info just using a generic idfObject, the field sequence number and field type -- all without converting the object to any specific object like LayeredConstruction

swami's avatar swami  ( 2020-07-28 16:57:14 -0500 )edit

Any thoughts on this?

swami's avatar swami  ( 2020-07-30 07:38:06 -0500 )edit

Did you see the solution in my second edit? I believe this is what you want: foo.idfObject.getString(4).get

shorowit's avatar shorowit  ( 2020-08-03 10:25:58 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Careers

Question Tools

Stats

Asked: 2020-07-28 09:58:33 -0500

Seen: 291 times

Last updated: Jul 28 '20