diff --git a/src/Mod/Arch/ArchCommands.py b/src/Mod/Arch/ArchCommands.py index 87a6987b6..3b12d2ff7 100644 --- a/src/Mod/Arch/ArchCommands.py +++ b/src/Mod/Arch/ArchCommands.py @@ -669,25 +669,40 @@ def getIfcExtrusionData(obj,scale=1): return "polyline", getTuples(p,scale), getTuples(v,scale), d return None -def getIfcBrepFacesData(obj,scale=1): - """getIfcBrepFacesData(obj,[scale]): returns a list(0) of lists(1) of lists(2) of lists(3), +def getIfcBrepFacesData(obj,scale=1,tessellation=1): + """getIfcBrepFacesData(obj,[scale,tesselation]): 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""" + of solids inside the object. Scale can indicate a scaling factor. Tesselation is the tesselation + factor to apply on curved faces.""" if hasattr(obj,"Shape"): + import Part if obj.Shape: if not obj.Shape.isNull(): if obj.Shape.isValid(): sols = [] for sol in obj.Shape.Solids: s = [] + curves = False for face in sol.Faces: - f = [] - f.append(getTuples(face.OuterWire,scale,normal=face.normalAt(0,0),close=False)) - for wire in face.Wires: - if wire.hashCode() != face.OuterWire.hashCode(): - f.append(getTuples(wire,scale,normal=DraftVecUtils.neg(face.normalAt(0,0)),close=False)) - s.append(f) + for e in face.Edges: + if not isinstance(e.Curve,Part.Line): + curves = True + if curves: + tris = sol.tessellate(tessellation) + for tri in tris[1]: + f = [] + for i in tri: + f.append(getTuples(tris[0][i],scale)) + s.append([f]) + else: + for face in sol.Faces: + f = [] + f.append(getTuples(face.OuterWire,scale,normal=face.normalAt(0,0),close=False)) + for wire in face.Wires: + if wire.hashCode() != face.OuterWire.hashCode(): + f.append(getTuples(wire,scale,normal=DraftVecUtils.neg(face.normalAt(0,0)),close=False)) + s.append(f) sols.append(s) return sols return None diff --git a/src/Mod/Arch/ifcWriter.py b/src/Mod/Arch/ifcWriter.py index a7a3ee766..fe45b6d83 100644 --- a/src/Mod/Arch/ifcWriter.py +++ b/src/Mod/Arch/ifcWriter.py @@ -320,12 +320,11 @@ class IfcDocument(object): def __setattr__(self,key,value): if value: if key == "Owner": - print value - self._person.set_argument(2,value) + self._person.set_argument(2,str(value)) elif key == "Organization": - self._org.set_argument(1,value) + self._org.set_argument(1,str(value)) elif key == "Name": - self.Project.set_argument(2,value) + self.Project.set_argument(2,str(value)) self.__dict__.__setitem__(key,value) def findByName(self,ifctype,name):