From ab2338d9aced57cb0d7c6c23bbe00974aebc5034 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Sun, 14 Apr 2019 14:18:46 -0300 Subject: [PATCH] Arch: Minor bugfixes in IFC export --- src/Mod/Arch/ArchComponent.py | 15 ++++++++++++++- src/Mod/Arch/ArchIFC.py | 6 ++++++ src/Mod/Arch/ArchSpace.py | 5 +---- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index 6689bed7bd..f86c2b8704 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -319,7 +319,20 @@ class Component: if data: return data if obj.Base: - if obj.Base.isDerivedFrom("Part::Extrusion"): + # the base is another arch object which can provide extrusion data + if hasattr(obj.Base,"Proxy") and hasattr(obj.Base.Proxy,"getExtrusionData") and (not obj.Additions) and (not obj.Subtractions): + if obj.Base.Base: + if obj.Placement.Rotation.Angle < 0.0001: + # if the final obj is rotated, this will screw all our IFC orientation. Better leave it like that then... + data = obj.Base.Proxy.getExtrusionData(obj.Base) + if data: + # add the displacement of the final object + if isinstance(data[2],(list,tuple)): + return (data[0],data[1],[p.multiply(obj.Placement) for p in data[2]]) + else: + return (data[0],data[1],data[2].multiply(obj.Placement)) + # the base is a Part Extrusion + elif obj.Base.isDerivedFrom("Part::Extrusion"): if obj.Base.Base: base,placement = self.rebase(obj.Base.Base.Shape) extrusion = FreeCAD.Vector(obj.Base.Dir) diff --git a/src/Mod/Arch/ArchIFC.py b/src/Mod/Arch/ArchIFC.py index 58c3606a08..83ae2237f1 100644 --- a/src/Mod/Arch/ArchIFC.py +++ b/src/Mod/Arch/ArchIFC.py @@ -121,15 +121,21 @@ def addIfcAttributeValueExpressions(obj, attribute): obj.setExpression("BarLength", "Length.Value") elif attribute["name"] == "RefElevation": obj.setExpression("RefElevation", "Elevation.Value") + elif attribute["name"] == "LongName": + obj.LongName = obj.Label def setObjIfcAttributeValue(obj, attributeName, value): "Sets the value of a given attribute property" IfcData = obj.IfcData + if "attributes" not in IfcData: + IfcData["attributes"] = "{}" IfcAttributes = json.loads(IfcData["attributes"]) if isinstance(value, FreeCAD.Units.Quantity): value = float(value) + if not attributeName in IfcAttributes: + IfcAttributes[attributeName] = {} IfcAttributes[attributeName]["value"] = value IfcData["attributes"] = json.dumps(IfcAttributes) obj.IfcData = IfcData diff --git a/src/Mod/Arch/ArchSpace.py b/src/Mod/Arch/ArchSpace.py index d6e08c0ebf..57343dced8 100644 --- a/src/Mod/Arch/ArchSpace.py +++ b/src/Mod/Arch/ArchSpace.py @@ -474,6 +474,7 @@ class _ViewProviderSpace(ArchComponent.ViewProviderComponent): vobj.LineWidth = 1 vobj.LineColor = (1.0,0.0,0.0,1.0) vobj.DrawStyle = "Dotted" + vobj.DisplayMode = "Wireframe" def setProperties(self,vobj): @@ -512,10 +513,6 @@ class _ViewProviderSpace(ArchComponent.ViewProviderComponent): self.setProperties(vobj) - def getDefaultDisplayMode(self): - - return "Wireframe" - def getIcon(self): import Arch_rc