Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python bindings: no Workspace.to_Model to_Component, etc #4997

Closed
jmarrec opened this issue Oct 12, 2023 · 0 comments · Fixed by #4998
Closed

Python bindings: no Workspace.to_Model to_Component, etc #4997

jmarrec opened this issue Oct 12, 2023 · 0 comments · Fixed by #4998

Comments

@jmarrec
Copy link
Collaborator

jmarrec commented Oct 12, 2023

Issue overview

There are no casting methods to go from Workspace to a Model/Component (nor OptionalModel/OptionalComponent) in the python bindings.

Current Behavior

In [8]: m.clone().to_Workspace()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[8], line 1
----> 1 m.clone().to_Workspace()

AttributeError: 'Workspace' object has no attribute 'to_Workspace'

Expected Behavior

Same as ruby

[1] model(main)> m = Model.new
=> #<OpenStudio::Model::Model:0x0000000118300098 @__swigtype__="_p_openstudio__model__Model">
[2] model(main)> m.clone.to_Workspace
NoMethodError: undefined method `to_Workspace' for #<OpenStudio::Workspace:0x0000000108021670>
from (pry):2:in `__pry__'
[3] model(main)> m.clone.to_Model
=> #<OpenStudio::Model::Model:0x000000010802a798 @__swigtype__="_p_openstudio__model__Model

Steps to Reproduce

See above

Possible Solution

Add the casting methods in swig files

Details

Environment

Some additional details about your environment for this issue (if relevant):

  • Platform (Operating system, version): all
  • Version of OpenStudio (if using an intermediate build, include SHA): all

Context

Trying to clone a model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant