CAM: Fix: shape parameters coming from the attributes section in the fctb file were not normalized
This commit is contained in:
@@ -154,8 +154,12 @@ class ToolBit(Asset, ABC):
|
||||
for param_name, param_value in params.items():
|
||||
tool_bit_shape.set_parameter(param_name, param_value)
|
||||
|
||||
# Update attributes; these are stored in the document model object.
|
||||
# Update attributes; the separation between parameters and attributes
|
||||
# is currently not well defined, so for now we add them to the
|
||||
# ToolBitShape and the DocumentObject.
|
||||
# Discussion: https://github.com/FreeCAD/FreeCAD/issues/21722
|
||||
for attr_name, attr_value in attr.items():
|
||||
tool_bit_shape.set_parameter(attr_name, attr_value)
|
||||
if hasattr(toolbit.obj, attr_name):
|
||||
PathUtil.setProperty(toolbit.obj, attr_name, attr_value)
|
||||
else:
|
||||
|
||||
@@ -47,7 +47,7 @@ class FCTBSerializer(AssetSerializer):
|
||||
@classmethod
|
||||
def extract_dependencies(cls, data: bytes) -> List[AssetUri]:
|
||||
"""Extracts URIs of dependencies from serialized data."""
|
||||
Path.Log.info(f"FCTBSerializer.extract_dependencies: raw data = {data!r}")
|
||||
Path.Log.debug(f"FCTBSerializer.extract_dependencies: raw data = {data!r}")
|
||||
data_dict = json.loads(data.decode("utf-8"))
|
||||
shape = data_dict["shape"]
|
||||
return [ToolBitShape.resolve_name(shape)]
|
||||
@@ -102,7 +102,8 @@ class FCTBSerializer(AssetSerializer):
|
||||
|
||||
# Find the correct ToolBit subclass for the shape
|
||||
Path.Log.debug(
|
||||
f"FCTBSerializer.deserialize: shape = {shape!r}, id = {id!r}, params = {shape.get_parameters()}"
|
||||
f"FCTBSerializer.deserialize: shape = {shape!r}, id = {id!r},"
|
||||
f" params = {shape.get_parameters()}, attrs = {attrs!r}"
|
||||
)
|
||||
return ToolBit.from_shape(shape, attrs, id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user