Added operator to replace currently selected objects with occurences of the chosen type. I kept doing this from the code and thought it could be generally useful.
It's working pretty naive now and just replacing objects with occurences preserving the original transform (location/rotation/scale), nothing else is preserved.
Demo - https://imgur.com/a/qm8a6Ns
PS Hopefully I'm not reinventing the wheel and not missed some other similar operator
Also noticed in Sigma Dimensions video that every time user deletes a storey or applies new elevation the selection was jumping to the first storey. Now it's going to be more natural.
Before - https://imgur.com/a/gbn7ryQ
After - https://imgur.com/a/QX2RulF
Search for compatible fitting wasn't taking into account that maybe fitting used for the same segments but fitting's parameters are not the same (such as start_length, end_length, angle and offset between profiles).
I also forgot to promote transition angle to operator's property😬
Error traceback is below - it was trying to set IfcExtrudedAreaSolid.Position to None when in IFC2x3 Position wasn't optional, so now in IFC2X3 it's going to have some default position
RuntimeError: Error: Python: Traceback (most recent call last):
File "\bim\module\model\product.py", line 123, in execute
return IfcStore.execute_ifc_operator(self, context)
File "\bim\ifc.py", line 336, in execute_ifc_operator
result = getattr(operator, "_execute")(context)
File "\bim\module\model\product.py", line 148, in _execute
if self.generate_layered_element(ifc_class, relating_type):
File "\bim\module\model\product.py", line 274, in generate_layered_element
obj = slab.DumbSlabGenerator(relating_type).generate()
File "\bim\module\model\slab.py", line 143, in generate
return self.derive_from_cursor()
File "\bim\module\model\slab.py", line 147, in derive_from_cursor
return self.create_slab()
File "\bim\module\model\slab.py", line 179, in create_slab
representation = ifcopenshell.api.run(
File "\libs\site\packages\ifcopenshell\api\__init__.py", line 66, in run
result = usecase_class(ifc_file, **settings).execute()
File "\libs\site\packages\ifcopenshell\api\geometry\add_slab_representation.py", line 42, in execute
[self.create_item()],
File "\libs\site\packages\ifcopenshell\api\geometry\add_slab_representation.py", line 58, in create_item
extrusion = self.file.createIfcExtrudedAreaSolid(
File "\libs\site\packages\ifcopenshell\file.py", line 337, in create_entity
e[idx] = arg
File "\libs\site\packages\ifcopenshell\entity_instance.py", line 260, in __setitem__
self.wrapped_data.setArgumentAsNull(idx)
File "\libs\site\packages\ifcopenshell\ifcopenshell_wrapper.py", line 4929, in setArgumentAsNull
return _ifcopenshell_wrapper.entity_instance_setArgumentAsNull(self, i)
RuntimeError: Attribute not set
It will make sure you'll be able to see the project's elements in viewport when it's loaded (same way as if you'd select all objects and hit "Numpad .").
Couldn't find any way to make it work without enablging / disabling selection - https://projects.blender.org/blender/blender/issues/112141