From 293930bdf870526532521b3b442041a8ae8fb025 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Sat, 17 May 2014 11:56:09 -0300 Subject: [PATCH] Arch: Using 2D coordinates for polylines in IFC export --- src/Mod/Arch/ArchCommands.py | 8 ++++---- src/Mod/Arch/ifcWriter.py | 2 +- src/Mod/Arch/importIFC.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Mod/Arch/ArchCommands.py b/src/Mod/Arch/ArchCommands.py index 6d27cf721d73..51fd7e2d510f 100644 --- a/src/Mod/Arch/ArchCommands.py +++ b/src/Mod/Arch/ArchCommands.py @@ -631,8 +631,8 @@ def getTuples(data,scale=1,placement=None,normal=None,close=True): print "Arch.getTuples(): Wrong profile data" return t -def getExtrusionData(obj,scale=1): - """getExtrusionData(obj,[scale]): returns a closed path (a list of tuples), a tuple expressing an extrusion +def getIfcExtrusionData(obj,scale=1): + """getIfcExtrusionData(obj,[scale]): returns a closed path (a list of tuples), a tuple expressing an extrusion vector, and a list of 3 tuples for base position, x axis and z axis. Or returns None, if a base loop and an extrusion direction cannot be extracted. Scale can indicate a scale factor.""" if hasattr(obj,"Additions"): @@ -664,8 +664,8 @@ def getExtrusionData(obj,scale=1): return "polyline", getTuples(p,scale), getTuples(v,scale), d return None -def getBrepFacesData(obj,scale=1): - """getBrepFacesData(obj,[scale]): returns a list(0) of lists(1) of lists(2) of lists(3), +def getIfcBrepFacesData(obj,scale=1): + """getIfcBrepFacesData(obj,[scale]): returns a list(0) of lists(1) of lists(2) of lists(3), list(3) being a list of vertices defining a loop, list(2) describing a face from one or more loops, list(1) being the whole solid made of several faces, list(0) being the list of solids inside the object. Scale can indicate a scaling factor""" diff --git a/src/Mod/Arch/ifcWriter.py b/src/Mod/Arch/ifcWriter.py index a11f7281ba07..e6aa3e490bc5 100644 --- a/src/Mod/Arch/ifcWriter.py +++ b/src/Mod/Arch/ifcWriter.py @@ -508,7 +508,7 @@ def addColor(self,rgb,rep): def addPolyline(self,points): """addPolyline(points): creates a polyline from the given points""" - pts = [create(self._fileobject,"IfcCartesianPoint",getTuple(p)) for p in points] + pts = [create(self._fileobject,"IfcCartesianPoint",getTuple(p)[:2]) for p in points] pol = create(self._fileobject,"IfcPolyline",[pts]) area = create(self._fileobject,"IfcArbitraryClosedProfileDef",["AREA",None,pol]) return area diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py index 3920c9555924..57ba58b53e71 100644 --- a/src/Mod/Arch/importIFC.py +++ b/src/Mod/Arch/importIFC.py @@ -1025,10 +1025,10 @@ def export(exportList,filename): # get representation if not forcebrep: - gdata = Arch.getExtrusionData(obj,scaling) + gdata = Arch.getIfcExtrusionData(obj,scaling) #if DEBUG: print " extrusion data for ",obj.Label," : ",gdata if not gdata: - fdata = Arch.getBrepFacesData(obj,scaling) + fdata = Arch.getIfcBrepFacesData(obj,scaling) #if DEBUG: print " brep data for ",obj.Label," : ",fdata if not fdata: if obj.isDerivedFrom("Part::Feature"):