Is there a more efficient way to make changes using python to the current model inside Rhino without using Grasshopper?
The below script works but I am looking for a quicker way that I could develop into a Pollination app:
from honeybee.model import Model
# Load the Honeybee Model from the JSON file
hbjson_path = r"path_to_model\model_name.hbjson"
model = Model.from_hbjson(hbjson_path)
#Make changes to the model below...
#write changes to file, reload hbjson into Rhino
model.to_hbjson(name=None,
folder=r"path_to_model\hbjson_out",
indent=None,
included_prop=None,
triangulate_sub_faces=False)
You can use get_hbjson and send_hbjson functions from pollination_streamlit_io to get the model from Rhino and replace it in Rhino after the update. See the sample code here as an example:
Here is the live version of the app:
Here is a short preview. The app gets the model from Rhino, renames the faces, and then replaces the model in Rhino with the updated model.
One thing to keep in mind is that it looks like we don’t register these changes in the Rhino plugin. This means the Undo command won’t undo these changes. I would consider this a bug.
Unfortunately, we haven’t kept up with the documentation as we changed it frequently. We used to have an app that was used for documentation but I made it private.