mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Fix error editing IfcQuantityCounts in IFC4X3
Full error traceback:
Error: Python: Traceback (most recent call last):
File "\ifcopenshell\entity_instance.py", line 361, in __setitem__
self.method_list[idx](self.wrapped_data, idx, entity_instance.unwrap_value(value))
File "\ifcopenshell\ifcopenshell_wrapper.py", line 9271, in setArgumentAsInt
return _ifcopenshell_wrapper.entity_instance_setArgumentAsInt(self, i, v)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: in method 'entity_instance_setArgumentAsInt', argument 3 of type 'int'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "\bonsai\bim\ifc.py", line 443, in execute_ifc_operator
result = getattr(operator, "_execute")(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\bonsai\bim\module\pset\operator.py", line 142, in _execute
ifcopenshell.api.run(
File "\ifcopenshell\api\__init__.py", line 92, in run
return usecase_function(ifc_file, should_run_listeners=should_run_listeners, **settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\ifcopenshell\api\__init__.py", line 258, in wrapper
raise e
File "\ifcopenshell\api\__init__.py", line 252, in wrapper
result = usecase(*args, **settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\ifcopenshell\api\pset\edit_qto.py", line 135, in edit_qto
return usecase.execute()
^^^^^^^^^^^^^^^^^
File "\ifcopenshell\api\pset\edit_qto.py", line 149, in execute
self.update_existing_properties()
File "\ifcopenshell\api\pset\edit_qto.py", line 166, in update_existing_properties
self.update_existing_property(prop)
File "\ifcopenshell\api\pset\edit_qto.py", line 180, in update_existing_property
prop[3] = float(value)
~~~~^^^
File "\ifcopenshell\entity_instance.py", line 363, in __setitem__
raise TypeError(
TypeError: attribute 'CountValue' for entity 'IFC4X3_ADD2.IfcQuantityCount' is expecting value of type 'INT', got 'float'.
This commit is contained in:
@@ -177,7 +177,11 @@ class Usecase:
|
||||
ifcopenshell.api.pset.edit_qto(self.file, qto=prop, properties=value["HasQuantities"])
|
||||
elif prop.is_a("IfcPhysicalSimpleQuantity"):
|
||||
value = value.wrappedValue if isinstance(value, ifcopenshell.entity_instance) else value
|
||||
prop[3] = float(value)
|
||||
# 3 IfcPhysicalSimpleQuantity.XXXValue
|
||||
if self.file.schema == "IFC4X3" and prop.is_a("IfcQuantityCount"):
|
||||
prop[3] = int(value)
|
||||
else:
|
||||
prop[3] = float(value)
|
||||
del self.settings["properties"][name]
|
||||
|
||||
def add_new_properties(self) -> list[ifcopenshell.entity_instance]:
|
||||
|
||||
Reference in New Issue
Block a user