CAM: Fix: Tool editor ignored shape attributes if they were not in the Shape group. Now it reads all except Base

This commit is contained in:
Samuel Abels
2025-06-30 20:27:54 +02:00
parent be16390773
commit 6464196d3a
2 changed files with 4 additions and 1 deletions

View File

@@ -69,6 +69,7 @@ def get_object_properties(
obj: "FreeCAD.DocumentObject",
props: Optional[List[str]] = None,
group: Optional[str] = None,
exclude_groups: Optional[List[str]] = None,
) -> Dict[str, Tuple[Any, str]]:
"""
Extract properties from a FreeCAD PropertyBag, including their types.
@@ -90,6 +91,8 @@ def get_object_properties(
for name in props or obj.PropertiesList:
if group and not obj.getGroupOfProperty(name) == group:
continue
if exclude_groups and obj.getGroupOfProperty(name) in exclude_groups:
continue
if hasattr(obj, name):
value = getattr(obj, name)
type_id = obj.getTypeIdOfProperty(name)

View File

@@ -357,7 +357,7 @@ class ToolBitShape(Asset):
raise ValueError("No 'Attributes' PropertyBag object found in document bytes")
# loaded_raw_params will now be Dict[str, Tuple[Any, str]]
loaded_raw_params = get_object_properties(props_obj, group="Shape")
loaded_raw_params = get_object_properties(props_obj, exclude_groups=["", "Base"])
# Separate values and types, and populate _param_types
loaded_params = {}