From 3eacde0ba2e3db1506c8d1941ac04bbddd35592d Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Thu, 19 Jun 2025 13:45:02 +0200 Subject: [PATCH] Update ArchMaterial.py --- src/Mod/BIM/ArchMaterial.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Mod/BIM/ArchMaterial.py b/src/Mod/BIM/ArchMaterial.py index f6eaf4c053..6f589c7e2d 100644 --- a/src/Mod/BIM/ArchMaterial.py +++ b/src/Mod/BIM/ArchMaterial.py @@ -279,12 +279,18 @@ class _ArchMaterial: def execute(self,obj): if obj.Material: if FreeCAD.GuiUp: + c = None + t = None if "DiffuseColor" in obj.Material: - c = tuple([float(f) for f in obj.Material['DiffuseColor'].strip("()").strip("[]").split(",")]) - for p in obj.InList: - if hasattr(p,"Material") and ( (not hasattr(p.ViewObject,"UseMaterialColor")) or p.ViewObject.UseMaterialColor): - if p.Material.Name == obj.Name: - p.ViewObject.ShapeColor = c + c = tuple([float(f) for f in obj.Material["DiffuseColor"].strip("()").strip("[]").split(",")]) + if "Transparency" in obj.Material: + t = int(obj.Material["Transparency"]) + for p in obj.InList: + if hasattr(p,"Material") \ + and p.Material.Name == obj.Name \ + and getattr(obj.ViewObject,"UseMaterialColor",True): + if c: p.ViewObject.ShapeColor = c + if t: p.ViewObject.Transparency = t return def dumps(self):