B
by bernd on 9 Jan 2025, edited 9 Jan 2025
#
There is a "Load from Memory" checkbox already on Patch GUI in Bonsai, but it uses all elements from the loaded ifc and not the visible ones.

B
by bernd on 21 Jan 2025
#
Noone an idea ... How to get all GUID from all visible objects in Bonsai by python?
S
by steverugi on 21 Jan 2025, edited 21 Jan 2025
#
not sure this is correct (just trying to guess here)
visible object can be found with
import bpy
import ifcopenshell
from bonsai import tool
model = tool.Ifc.get()
objlst = bpy.data.objects
for obj in objlst:
if obj.name.startswith("Ifc") and obj.visible_get():
print(obj.name)
which prints a list of Blender "turned on" objects in the model returning IfcClass/name, you can make a dictionary out of it or a list
from there maybe you could use ifcopenshell.util.selector(model, query)
that accepts name and type in it to narrow them down to valid IfcBuildingElement
after that the GUID comes with element.id()
sorry I am not much of an expert in python, just curious to see how this can be achieved
M
by mastrolube on 21 Jan 2025, edited 22 Jan 2025
#
+2 votes
Python programmer here.
The best way is to create a new recipe with ifcpatch

Have a look here:
https://docs.ifcopenshell.org/ifcpatch.html
and here
https://github.com/IfcOpenShell/IfcOpenShell/tree/v0.8.0/src/ifcpatch/ifcpatch/recipes
This is the location on your system where you save new recipes: %AppData%\Blender Foundation\Blender\4.2\extensions\.local\lib\python3.11\site-packages\ifcpatch\recipes
Restart blender to make them available :)