Arch: Fixed export of cloned windows to IFC

This commit is contained in:
Yorik van Havre 2016-06-16 17:42:27 -03:00
parent f6c7587857
commit dce4695674
3 changed files with 24 additions and 19 deletions

View File

@ -364,7 +364,7 @@ def getCutVolume(cutplane,shapes):
u = p.Vertexes[1].Point.sub(p.Vertexes[0].Point).normalize()
v = u.cross(ax)
if not bb.isCutPlane(ce,ax):
FreeCAD.Console.PrintMessage(translate("Arch","No objects are cut by the plane\n"))
#FreeCAD.Console.PrintMessage(translate("Arch","No objects are cut by the plane\n"))
return None,None,None
else:
corners = [FreeCAD.Vector(bb.XMin,bb.YMin,bb.ZMin),

View File

@ -1268,24 +1268,25 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess
tostore = False
# check for clones
for k,v in clones.items():
if (obj.Name == k ) or (obj.Name in v):
if k in sharedobjects:
# base shape already exists
repmap = sharedobjects[k]
pla = obj.Placement
axis1 = ifcfile.createIfcDirection(tuple(pla.Rotation.multVec(FreeCAD.Vector(1,0,0))))
axis2 = ifcfile.createIfcDirection(tuple(pla.Rotation.multVec(FreeCAD.Vector(0,1,0))))
axis3 = ifcfile.createIfcDirection(tuple(pla.Rotation.multVec(FreeCAD.Vector(0,0,1))))
origin = ifcfile.createIfcCartesianPoint(tuple(FreeCAD.Vector(pla.Base).multiply(0.001)))
transf = ifcfile.createIfcCartesianTransformationOperator3D(axis1,axis2,origin,1.0,axis3)
mapitem = ifcfile.createIfcMappedItem(repmap,transf)
shapes = [mapitem]
solidType = "MappedRepresentation"
shapetype = "clone"
else:
# base shape not yet created
tostore = k
if not subtraction:
for k,v in clones.items():
if (obj.Name == k ) or (obj.Name in v):
if k in sharedobjects:
# base shape already exists
repmap = sharedobjects[k]
pla = obj.Placement
axis1 = ifcfile.createIfcDirection(tuple(pla.Rotation.multVec(FreeCAD.Vector(1,0,0))))
axis2 = ifcfile.createIfcDirection(tuple(pla.Rotation.multVec(FreeCAD.Vector(0,1,0))))
axis3 = ifcfile.createIfcDirection(tuple(pla.Rotation.multVec(FreeCAD.Vector(0,0,1))))
origin = ifcfile.createIfcCartesianPoint(tuple(FreeCAD.Vector(pla.Base).multiply(0.001)))
transf = ifcfile.createIfcCartesianTransformationOperator3D(axis1,axis2,origin,1.0,axis3)
mapitem = ifcfile.createIfcMappedItem(repmap,transf)
shapes = [mapitem]
solidType = "MappedRepresentation"
shapetype = "clone"
else:
# base shape not yet created
tostore = k
if (not shapes) and (not forcebrep):
profile = None

View File

@ -2478,6 +2478,10 @@ def clone(obj,delta=None):
cl.Label = prefix + base.Label
cl.CloneOf = base
cl.Placement = obj[0].Placement
try:
cl.Role = base.Role
except:
pass
return cl
else:
cl = FreeCAD.ActiveDocument.addObject("Part::AttachableObjectPython","Clone")