Bulk method for assigning IFC Class to native Blender mesh?

This is not a particularly pretty use case.
I have a blend file with ~2000 mesh objects, and I'd like to assign them all to a bog-standard IfcBuildingElementProxy class so I can do various IFC-related stuff to them.
Currently I simply select all the mesh, go to the Object tab and press 'Assign IFC Class':

For 2000 objects this freezes, although I think it is slowly working it's way through them.
I know that this operation isn't particularly simple what with having to create all the IFC-based information in the background for each object - but is there anything that I could do differently to make it better?
(I realise that not doing it in the first place is probably the best option...) thanks

Tagged:
Bedsonsteverugi

Comments

  • It would also be great if the script could get a value from each mesh (from a standard Blender custom property. For example IFCSaveAs with a value of IfcPipeFitting) and then use this value to save the file as an IFC with each mesh having an IFC classification based on it's IFCSaveAs value....

  • If you're happy to write a script, it may be faster. If you know the structure of your meshes / know where styles are and aren't applied, that would speed it up too.

  • I've written a loop script using bpy.ops.bim.assign_class on each mesh. I don't know if it has anything to do with the speed of the operation, but for each object, I'm getting this prompt:

    Failed to create a cache: H5Fopen failed.

    Writing the loop gives me an indication of progress, which is about 7 minutes per 1000 objects, not too horrible really.

  • CSNCSN
    edited October 2024

    Well I managed to fix the cache issue - for whatever reason I didn't have a 'cache' folder in the following path:
    %USERPROFILE%\AppData\Roaming\Blender Foundation\Blender\4.2\extensions\.local\lib\python3.11\site-packages\bonsai\bim\data
    I just made the folder and the Fail error disappears. Might be a bug, should probably file a report, but it's Friday :)

  • This cache folder shouldn't really be a subfolder of the static data folder. Ideally it would be outside site_packages altogether, as site_packages ought to be read-only, or the cache location should at least made configurable.

    ie. On this Linux system I would want this cache in $HOME/.cache/bonsai

Sign In or Register to comment.