IfcOpenshell inside Bonsai: load new elements without reloading the whole file?
I have a script that creates IfcElements using IfcOpenShell. I'm running the script inside Blender.
I would like to display the new elements inside Bonsai without having to reload the whole Ifc file since this takes quite some time.
import bonsai.tool as tool
model = tool.Ifc.get()
new_members = ... # adding new element to (e.g.a wall)
tool.Ifc.set(model)
Comments
check out...
might be the latest, not sure
pulled from: https://github.com/C-Claus/BlenderScripts/commit/8afe7bf5c3ecd54e1c940d589f5d845adbef8fdb
Would it be good, to bake this function into Bonsai somehow? Quite a few have asked for it in the past.
Thank you, but this reloads the whole Project.
Isn't there a way to only reload the changed elements?
I guess if I create a element with Bonsai, It's not reloading the whole Project?
Not sure.
It's probably a rabbit hole, but IfcGit selectively reloads parts of the model that have been edited when you load the commit, it's hooked to the whole Git setup aswell though and is done through the UI, but maybe that is a start?
No, IfcGit reloads the entire model, it just uses a custom function that keeps the current view in the viewport so it looks like a partial update
TIL, it's quite efficient at doing that, thankyou Bruno
Sounds like a rabbit hole of bugs, who knows what else could have changed in the file 😁
i've had a look how the file is reloaded in IfcGit.
bonsai.tool.IfcGit.load_project('path/to/file.ifc')
works realy well