Navigation Menu

Skip to content

Commit

Permalink
[Arch] IFC export: some points and vectors should be 2D, not 3D
Browse files Browse the repository at this point in the history
* true north direction
* profile orientation
* grid axis polylines
  • Loading branch information
hlg authored and yorikvanhavre committed Dec 17, 2019
1 parent e7be69e commit 8db24f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/Mod/Arch/exportIFC.py
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Arch/exportIFCHelper.py
Expand Up @@ -125,7 +125,7 @@ def createMapConversion(self):

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:
Expand Down

0 comments on commit 8db24f9

Please sign in to comment.