Arch: misc bugfixes in IFC export

This commit is contained in:
Yorik van Havre 2015-02-23 19:34:29 -03:00
parent 007f939731
commit 627e32aa2c
3 changed files with 84 additions and 74 deletions

View File

@ -483,7 +483,7 @@ def meshToShape(obj,mark=True,fast=True,tol=0.001,flat=False,cut=True):
FreeCAD.ActiveDocument.removeObject(name)
newobj = FreeCAD.ActiveDocument.addObject("Part::Feature",name)
newobj.Shape = solid
newobj.Placement = plac
#newobj.Placement = plac #the placement is already computed in the mesh
if (not solid.isClosed()) or (not solid.isValid()):
if mark:
newobj.ViewObject.ShapeColor = (1.0,0.0,0.0,1.0)

View File

@ -514,7 +514,13 @@ class _Roof(ArchComponent.Component):
self.baseface = None
base = None
if obj.Base and obj.Angles:
if obj.Base:
if not obj.Angles:
if obj.Base.isDerivedFrom("Part::Feature"):
if obj.Base.Shape.Solids:
base = obj.Base.Shape.copy()
print "base", base
else:
w = None
if obj.Base.isDerivedFrom("Part::Feature"):
if (obj.Base.Shape.Faces and obj.Face):

View File

@ -543,19 +543,23 @@ def export(exportList,filename):
props = []
for key in obj.IfcAttributes:
if not (key in ["IfcUID","FlagForceBrep"]):
tp,val = obj.IfcAttributes[key].strip(")").split("(")
r = obj.IfcAttributes[key].strip(")").split("(")
tp = r[0]
val = "(".join(r[1:])
val = val.strip("'")
val = val.strip('"')
if tp == "IfcLabel":
if DEBUG: print " property ",key," : ",str(val), " (", str(tp), ")"
if tp in ["IfcLabel","IfcText","IfcIdentifier"]:
val = str(val)
elif tp == "IfcBoolean":
if val == ".T.":
val = True
else:
val = False
elif tp == "IfcInteger":
val = int(val)
else:
val = float(val)
if DEBUG: print " property ",key," : ",str(val), " (", str(tp), ")"
props.append(ifcfile.createIfcPropertySingleValue(str(key),None,ifcfile.create_entity(str(tp),val),None))
if props:
pset = ifcfile.createIfcPropertySet(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'PropertySet',None,props)