From 7bebdad937ed95b45f805599ebfad960a6d3da9b Mon Sep 17 00:00:00 2001 From: hlg Date: Fri, 6 Dec 2019 14:03:53 +0100 Subject: [PATCH] [Arch] IFC export: some points and vectors should be 2D, not 3D * true north direction * profile orientation * grid axis polylines --- src/Mod/Arch/exportIFC.py | 10 +++++----- src/Mod/Arch/exportIFCHelper.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Mod/Arch/exportIFC.py b/src/Mod/Arch/exportIFC.py index a29096ba8f..7dcdf48df7 100644 --- a/src/Mod/Arch/exportIFC.py +++ b/src/Mod/Arch/exportIFC.py @@ -214,7 +214,7 @@ def export(exportList,filename,colors=None,preferences=None): if Draft.getObjectsOfType(objectslist, "Site"): # we assume one site and one representation context only trueNorthX = math.tan(-Draft.getObjectsOfType(objectslist, "Site")[0].Declination.getValueAs(FreeCAD.Units.Radian)) - contextCreator.model_context.TrueNorth.DirectionRatios = (trueNorthX, 1., 1.) + contextCreator.model_context.TrueNorth.DirectionRatios = (trueNorthX, 1.) products = {} # { Name: IfcEntity, ... } subproducts = {} # { Name: IfcEntity, ... } for storing additions/subtractions and other types of subcomponents of a product @@ -307,8 +307,8 @@ def export(exportList,filename,colors=None,preferences=None): for axg in axgroups: ifcaxg = [] for ax in axg: - p1 = ifcbin.createIfcCartesianPoint(tuple(FreeCAD.Vector(ax[0]).multiply(0.001))) - p2 = ifcbin.createIfcCartesianPoint(tuple(FreeCAD.Vector(ax[1]).multiply(0.001))) + p1 = ifcbin.createIfcCartesianPoint(tuple(FreeCAD.Vector(ax[0]).multiply(0.001)[:2])) + p2 = ifcbin.createIfcCartesianPoint(tuple(FreeCAD.Vector(ax[1]).multiply(0.001)[:2])) pol = ifcbin.createIfcPolyline([p1,p2]) ifcpols.append(pol) axis = ifcfile.createIfcGridAxis(ax[2],pol,True) @@ -1656,8 +1656,8 @@ def getProfile(ifcfile,p): # arbitrarily use the first edge as the rectangle orientation d = vec(p.Edges[0]) d.normalize() - pxvc = ifcbin.createIfcDirection(tuple(d)) - povc = ifcbin.createIfcCartesianPoint(tuple(p.CenterOfMass)) + pxvc = ifcbin.createIfcDirection(tuple(d)[:2]) + povc = ifcbin.createIfcCartesianPoint(tuple(p.CenterOfMass[:2])) pt = ifcbin.createIfcAxis2Placement2D(povc,pxvc) #semiPerimeter = p.Length/2 #diff = math.sqrt(semiPerimeter**2 - 4*p.Area) diff --git a/src/Mod/Arch/exportIFCHelper.py b/src/Mod/Arch/exportIFCHelper.py index 459dbdcca0..b2b4109dd2 100644 --- a/src/Mod/Arch/exportIFCHelper.py +++ b/src/Mod/Arch/exportIFCHelper.py @@ -125,7 +125,7 @@ class ContextCreator: def createTrueNorth(self): return self.file.createIfcDirection( - (self.calculateXAxisAbscissa(), self.calculateXAxisOrdinate(), 0.)) + (self.calculateXAxisAbscissa(), self.calculateXAxisOrdinate())) def calculateXAxisAbscissa(self): if "true_north" in self.project_data: