diff --git a/src/Mod/Arch/ArchMaterial.py b/src/Mod/Arch/ArchMaterial.py index 0096da62a0..8ff691bd17 100644 --- a/src/Mod/Arch/ArchMaterial.py +++ b/src/Mod/Arch/ArchMaterial.py @@ -259,6 +259,14 @@ class _ArchMaterial: obj.addProperty("App::PropertyPercent","Transparency","Arch",QT_TRANSLATE_NOOP("App::Property","The transparency value of this material")) obj.addProperty("App::PropertyColor","Color","Arch",QT_TRANSLATE_NOOP("App::Property","The color of this material")) + def isSameColor(self,c1,c2): + + if round(c1[0],6) == round(c2[0],6): + if round(c1[1],6) == round(c2[1],6): + if round(c1[2],6) == round(c2[2],6): + return True + return False + def onChanged(self,obj,prop): d = obj.Material @@ -266,7 +274,7 @@ class _ArchMaterial: if "DiffuseColor" in obj.Material: c = tuple([float(f) for f in obj.Material['DiffuseColor'].strip("()").split(",")]) if hasattr(obj,"Color"): - if obj.Color != c: + if not self.isSameColor(obj.Color,c): obj.Color = c if "Transparency" in obj.Material: t = int(obj.Material['Transparency']) @@ -296,11 +304,10 @@ class _ArchMaterial: d["Name"] = obj.Label elif prop == "Color": if hasattr(obj,"Color"): - val = str(obj.Color[:3]) if "DiffuseColor" in d: - if d["DiffuseColor"] == val: + if self.isSameColor(tuple([float(f) for f in d['DiffuseColor'].strip("()").split(",")]),obj.Color[:3]): return - d["DiffuseColor"] = val + d["DiffuseColor"] = str(obj.Color[:3]) elif prop == "Transparency": if hasattr(obj,"Transparency"): val = str(obj.Transparency) @@ -331,10 +338,10 @@ class _ArchMaterial: d["Description"] = val if d and (d != obj.Material): obj.Material = d - if FreeCAD.GuiUp: - import FreeCADGui + #if FreeCAD.GuiUp: + #import FreeCADGui # not sure why this is needed, but it is... - FreeCADGui.ActiveDocument.resetEdit() + #FreeCADGui.ActiveDocument.resetEdit() def execute(self,obj): if obj.Material: diff --git a/src/Mod/Arch/ArchSite.py b/src/Mod/Arch/ArchSite.py index f1148c758f..f295e6c51c 100644 --- a/src/Mod/Arch/ArchSite.py +++ b/src/Mod/Arch/ArchSite.py @@ -370,6 +370,8 @@ class _Site(ArchFloor._Floor): obj.addProperty("App::PropertyBool","RemoveSplitter","Site",QT_TRANSLATE_NOOP("App::Property","Remove splitters from the resulting shape")) if not "OriginOffset" in pl: obj.addProperty("App::PropertyVector","OriginOffset","Site",QT_TRANSLATE_NOOP("App::Property","An optional offset between the model (0,0,0) origin and the point indicated by the geocoordinates")) + if not "IfcProperties" in pl: + obj.addProperty("App::PropertyMap","IfcProperties","Site",QT_TRANSLATE_NOOP("App::Property","Stores IFC properties")) if not hasattr(obj,"Group"): obj.addExtension("App::GroupExtensionPython", self) self.Type = "Site"