Prioritize existing data types for templates props for safety

Noticed working on #5596 and #5708 a few issue when pset template is changing the prop types.

E.g. prop had string data type and now template suggests that it should be a float.
Previously, it might error trying to cast a string to a float. Now it will show a float until user will set it to null, then next time it will be loaded from the template data type.

Another example - prop was a string and now it's a boolean. Previously, it would be cast to boolean implicitly. E.g. "test" -> bool("test") -> True. And if user wouldn't be paying attention then enabling pset editing and saving it would make them lose "test" value.

Now - https://imgchest.com/p/na7ke99wb78
Before - https://imgchest.com/p/5xy23rr3z4l
This commit is contained in:
Andrej730
2024-11-07 14:56:51 +05:00
parent 3ad713d5c6
commit 832ad6d318
3 changed files with 27 additions and 7 deletions
@@ -394,6 +394,7 @@ def get_properties(
"id": prop.id(),
"class": prop.is_a(),
"value": results[prop_name],
"value_type": v.is_a() if v else None,
}
elif ifc_class == "IfcPropertyEnumeratedValue":
# 2 IfcPropertyEnumeratedValue.EnumerationValues