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

When does and doesn't the OpenStudio API retrieve properties with methods?

asked 2016-04-04 13:43:09 -0600

pflaumingo's avatar

updated 2017-10-03 16:23:13 -0600

I was curious as to when the OpenStudio API retrieves properties with a method or just by directly accessing the property? For example, using a space object conveniently named "space", why is the call to get it's name space.name() where as to get it's spaceType is simply space.spaceType? These both will return optional objects, but the call for the name property is a method. I'm using the C# bindings.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-04-05 05:10:24 -0600

Here's a "I don't know really, but I'll try anyways" answer.

space.name doesn't work? What about space.spaceType()? I'm no C++ expert and certainly know nothing about C#, but it does look like spaceType is a method as well no? See Space.cpp#L486

One thing is that all OpenStudio objects actually have a name (and a handle), and this method (.name) isn't defined in the class itself (nowhere in Space.cpp, Space.hpp, Space_Impl.hpp) while the space.spaceType is actually defined there. That might be it.

edit flag offensive delete link more

Comments

1

Yeh, I thought it was too, but I get compile errors unless used as I've stated above. I wonder if it's something to do with SWIG, which I know very little about. The name and handles seems to be inherited from IdfObject and spaceType is local to the object, but defaultConstructionSet is also local and used like a method (space.defaultConstructionSet()).

pflaumingo's avatar pflaumingo  ( 2016-04-05 10:29:55 -0600 )edit

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: 2016-04-04 13:43:09 -0600

Seen: 138 times

Last updated: Apr 05 '16