From 7c64c1c5d21d14028477f6a747de09b39fe660c2 Mon Sep 17 00:00:00 2001 From: Massimo Capodiferro <77293250+maxcapodi78@users.noreply.github.com> Date: Thu, 27 Jan 2022 13:06:33 +0100 Subject: [PATCH] Added check on MatAppearanceData before assigning it. (#786) * Added check on MatAppearanceData before assigning it. * Added check on MatAppearanceData before assigning it. --- pyaedt/modules/Material.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyaedt/modules/Material.py b/pyaedt/modules/Material.py index 7bab0d54a14..5ab85ab8333 100644 --- a/pyaedt/modules/Material.py +++ b/pyaedt/modules/Material.py @@ -762,7 +762,7 @@ def __init__(self, materials, name, props=None): self.name = name self.coordinate_system = "" if props: - self._props = props + self._props = props.copy() else: self._props = OrderedDict() if "CoordinateSystemType" in self._props: @@ -891,7 +891,7 @@ def __init__(self, materiallib, name, props=None): else: self.physics_type = ["Electromagnetic", "Thermal", "Structural"] self._props["PhysicsTypes"] = OrderedDict({"set": ["Electromagnetic", "Thermal", "Structural"]}) - if "AttachedData" in self._props: + if "AttachedData" in self._props and "MatAppearanceData" in self._props["AttachedData"]: self._material_appearance = [] self._material_appearance.append(self._props["AttachedData"]["MatAppearanceData"]["Red"]) self._material_appearance.append(self._props["AttachedData"]["MatAppearanceData"]["Green"])