BIM: prevent user to remove core properties

This commit is contained in:
Florian Foinant-Willig
2025-03-16 20:50:02 +01:00
committed by Kacper Donat
parent d5e2fdf8fd
commit 8a4c61ec5a
43 changed files with 568 additions and 551 deletions

View File

@@ -605,7 +605,7 @@ class BIM_Classification:
obj.StandardCode = code
elif hasattr(obj, "IfcClass"):
if not "Classification" in obj.PropertiesList:
obj.addProperty("App::PropertyString", "Classification", "IFC")
obj.addProperty("App::PropertyString", "Classification", "IFC", locked=True)
if code != obj.Classification:
if not changed:
FreeCAD.ActiveDocument.openTransaction(
@@ -634,7 +634,7 @@ class BIM_Classification:
self.isEditing.StandardCode = code
else:
if not "Classification" in self.isEditing.PropertiesList:
self.isEditing.addProperty("App::PropertyString", "Classification", "IFC")
self.isEditing.addProperty("App::PropertyString", "Classification", "IFC", locked=True)
self.isEditing.Classification = code
if hasattr(self.isEditing.ViewObject, "Proxy") and hasattr(
self.isEditing.ViewObject.Proxy, "setTaskValue"

View File

@@ -415,6 +415,7 @@ class BIM_IfcProperties:
QT_TRANSLATE_NOOP(
"App::Property", "IFC properties of this object"
),
locked=True,
)
if hasattr(obj, "IfcProperties"):
obj.IfcProperties = values[1]

View File

@@ -210,7 +210,7 @@ class BIM_IfcQuantities:
qname = val[i]
qtype = QTO_TYPES[val[i+1]]
if not qname in obj.PropertiesList:
obj.addProperty(qtype, qname, "Quantities", val[i+1])
obj.addProperty(qtype, qname, "Quantities", val[i+1], locked=True)
qval = 0
i = self.get_row(obj.Name)
if i > -1:

View File

@@ -171,7 +171,7 @@ class BIM_Layers:
obj = Draft.make_layer(self.model.item(row, 1).text())
# By default BIM layers should not swallow their children otherwise
# they will disappear from the tree root
obj.ViewObject.addProperty("App::PropertyBool", "HideChildren", "Layer")
obj.ViewObject.addProperty("App::PropertyBool", "HideChildren", "Layer", locked=True)
obj.ViewObject.HideChildren = True
else:
from nativeifc import ifc_tools