Arch: Minor bugfixes in IFC export

This commit is contained in:
Yorik van Havre
2019-04-14 14:18:46 -03:00
parent 88f637d8fd
commit ab2338d9ac
3 changed files with 21 additions and 5 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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