Arch: Fixed IFC export of object attributes
This commit is contained in:
@@ -356,13 +356,16 @@ class BuildingPart:
|
||||
self.oldPlacement = FreeCAD.Placement(obj.Placement)
|
||||
|
||||
def onChanged(self,obj,prop):
|
||||
|
||||
ArchIFC.onChanged(obj, prop)
|
||||
|
||||
if prop == "Height":
|
||||
for child in obj.Group:
|
||||
if Draft.getType(child) in ["Wall","Structure"]:
|
||||
if not child.Height.Value:
|
||||
#print("Executing ",child.Label)
|
||||
child.Proxy.execute(child)
|
||||
|
||||
elif prop == "Placement":
|
||||
if hasattr(self,"oldPlacement"):
|
||||
if self.oldPlacement:
|
||||
@@ -391,6 +394,9 @@ class BuildingPart:
|
||||
if deltap:
|
||||
child.Placement.move(deltap)
|
||||
|
||||
elif prop == "Group":
|
||||
obj.Area = self.getArea(obj)
|
||||
|
||||
def execute(self,obj):
|
||||
|
||||
# gather all the child shapes into a compound
|
||||
@@ -399,6 +405,19 @@ class BuildingPart:
|
||||
import Part
|
||||
obj.Shape = Part.makeCompound(shapes)
|
||||
|
||||
def getArea(self,obj):
|
||||
|
||||
"computes the area of this floor by adding its inner spaces"
|
||||
|
||||
area = 0
|
||||
if hasattr(obj,"Group"):
|
||||
for child in obj.Group:
|
||||
if hasattr(child,"Area") and hasattr(child,"IfcType"):
|
||||
# only add arch objects that have an Area property
|
||||
# TODO only spaces? ATM only spaces and windows have an Area property
|
||||
area += child.Area.Value
|
||||
return area
|
||||
|
||||
def getShapes(self,obj):
|
||||
|
||||
"recursively get the shapes of objects inside this BuildingPart"
|
||||
|
||||
@@ -326,11 +326,20 @@ class Component:
|
||||
# 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:
|
||||
return data
|
||||
# TODO above doesn't work if underlying shape is not at (0,0,0). But code below doesn't work well yet
|
||||
# add the displacement of the final object
|
||||
disp = obj.Shape.CenterOfMass.sub(obj.Base.Shape.CenterOfMass)
|
||||
if isinstance(data[2],(list,tuple)):
|
||||
return (data[0],data[1],[p.multiply(obj.Placement) for p in data[2]])
|
||||
ndata2 = []
|
||||
for p in data[2]:
|
||||
p.move(disp)
|
||||
ndata2.append(p)
|
||||
return (data[0],data[1],ndata2)
|
||||
else:
|
||||
return (data[0],data[1],data[2].multiply(obj.Placement))
|
||||
ndata2 = data[2]
|
||||
ndata2.move(disp)
|
||||
return (data[0],data[1],ndata2)
|
||||
# the base is a Part Extrusion
|
||||
elif obj.Base.isDerivedFrom("Part::Extrusion"):
|
||||
if obj.Base.Base:
|
||||
|
||||
Reference in New Issue
Block a user