mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
util.selector.set_element_value ignore values within tolerance #4439
This commit is contained in:
@@ -367,7 +367,15 @@ def set_element_value(
|
||||
return
|
||||
matrix = ifcopenshell.util.placement.get_local_placement(element.ObjectPlacement)
|
||||
coord_i = "xyz".index(key)
|
||||
matrix[coord_i][3] = float(value) if value else 0.0
|
||||
|
||||
# check if value is within tolerance to avoid api calls
|
||||
prev_value = matrix[coord_i][3]
|
||||
new_value = float(value) if value else 0.0
|
||||
TOLERANCE = 1.0e-5
|
||||
if new_value + TOLERANCE > prev_value > new_value - TOLERANCE:
|
||||
return
|
||||
|
||||
matrix[coord_i][3] = new_value
|
||||
ifcopenshell.api.run(
|
||||
"geometry.edit_object_placement", ifc_file, product=element, matrix=matrix, is_si=False
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user