diff --git a/src/Mod/Arch/ArchCommands.py b/src/Mod/Arch/ArchCommands.py index d96560e82..aec8caf25 100644 --- a/src/Mod/Arch/ArchCommands.py +++ b/src/Mod/Arch/ArchCommands.py @@ -454,7 +454,7 @@ def getShapeFromMesh(mesh,fast=True,tolerance=0.001,flat=False,cut=True): try: f = Part.Face(Part.makePolygon(pts)) except: - print "getShapeFromMesh: error building face from polygon" + print("getShapeFromMesh: error building face from polygon") #pass else: faces.append(f) @@ -462,12 +462,12 @@ def getShapeFromMesh(mesh,fast=True,tolerance=0.001,flat=False,cut=True): try: solid = Part.Solid(shell) except Part.OCCError: - print "getShapeFromMesh: error creating solid" + print("getShapeFromMesh: error creating solid") else: try: solid = solid.removeSplitter() except Part.OCCError: - print "getShapeFromMesh: error removing splitter" + print("getShapeFromMesh: error removing splitter") #pass return solid @@ -495,11 +495,11 @@ def getShapeFromMesh(mesh,fast=True,tolerance=0.001,flat=False,cut=True): if flat: return se except Part.OCCError: - print "getShapeFromMesh: error removing splitter" + print("getShapeFromMesh: error removing splitter") try: cp = Part.makeCompound(faces) except Part.OCCError: - print "getShapeFromMesh: error creating compound" + print("getShapeFromMesh: error creating compound") return None else: return cp @@ -507,7 +507,7 @@ def getShapeFromMesh(mesh,fast=True,tolerance=0.001,flat=False,cut=True): try: solid = Part.Solid(se) except Part.OCCError: - print "getShapeFromMesh: error creating solid" + print("getShapeFromMesh: error creating solid") return se else: return solid diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index deff5411c..c2f4990bc 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -351,7 +351,7 @@ class Component: if obj.BaseMaterial: if Draft.getType(obj.BaseMaterial) != "Material": obj.BaseMaterial = None - print "Removing bad BaseMaterial link in ",obj.Name + print("Removing bad BaseMaterial link in ",obj.Name) def clone(self,obj): "if this object is a clone, sets the shape. Returns True if this is the case" @@ -616,7 +616,7 @@ class Component: try: ang = f.normalAt(0,0).getAngle(FreeCAD.Vector(0,0,1)) except Part.OCCError: - print "Debug: Error computing areas for ",obj.Label,": normalAt() Face ",i + print("Debug: Error computing areas for ",obj.Label,": normalAt() Face ",i) return else: if (ang > 1.57) and (ang < 1.571): diff --git a/src/Mod/Arch/ArchProfile.py b/src/Mod/Arch/ArchProfile.py index 87bd3445e..18ee3dfa8 100644 --- a/src/Mod/Arch/ArchProfile.py +++ b/src/Mod/Arch/ArchProfile.py @@ -59,7 +59,7 @@ def readPresets(): for profilefile in profilefiles: if os.path.exists(profilefile): try: - with open(profilefile, 'rb') as csvfile: + with open(profilefile, "rb") as csvfile: beamreader = csv.reader(csvfile) bid=1 #Unique index for row in beamreader: diff --git a/src/Mod/Arch/ArchSchedule.py b/src/Mod/Arch/ArchSchedule.py index ba4c16598..815c79119 100644 --- a/src/Mod/Arch/ArchSchedule.py +++ b/src/Mod/Arch/ArchSchedule.py @@ -348,7 +348,7 @@ class _ArchScheduleTaskPanel: for j in ["A","B","C"]: r.append(self.obj.Result.getContents(j+str(i+1))) csvfile.writerow(r) - print "successfully exported ",filename[0] + print("successfully exported ",filename[0]) def select(self): if self.form.list.currentRow() >= 0: diff --git a/src/Mod/Arch/ArchSite.py b/src/Mod/Arch/ArchSite.py index e05e4fb1e..0f7215355 100644 --- a/src/Mod/Arch/ArchSite.py +++ b/src/Mod/Arch/ArchSite.py @@ -408,7 +408,7 @@ class _Site(ArchFloor._Floor): except Part.OCCError: # error in computing the area. Better set it to zero than show a wrong value if obj.ProjectedArea.Value != 0: - print "Error computing areas for ",obj.Label + print("Error computing areas for ",obj.Label) obj.ProjectedArea = 0 else: pset.append(pf) diff --git a/src/Mod/Arch/ArchStructure.py b/src/Mod/Arch/ArchStructure.py index 3e31b9c6a..5b21ff921 100644 --- a/src/Mod/Arch/ArchStructure.py +++ b/src/Mod/Arch/ArchStructure.py @@ -862,7 +862,7 @@ class StructSelectionObserver: self.callback = callback def addSelection(self, docName, objName, sub, pos): - print "got ",objName + print("got ",objName) obj = FreeCAD.getDocument(docName).getObject(objName) self.callback(obj) diff --git a/src/Mod/Arch/import3DS.py b/src/Mod/Arch/import3DS.py index e7c508065..1fe8fb0f8 100644 --- a/src/Mod/Arch/import3DS.py +++ b/src/Mod/Arch/import3DS.py @@ -20,6 +20,7 @@ #* * #*************************************************************************** +from __future__ import print_function import os,FreeCAD,Mesh __title__="FreeCAD 3DS importer" @@ -106,5 +107,5 @@ def read(filename): obj.Mesh = mesh obj.Placement = placement else: - print "Skipping object without vertices array: ",d_nobj.obj + print("Skipping object without vertices array: ",d_nobj.obj) diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py index ae90d4f92..e36882d22 100644 --- a/src/Mod/Arch/importIFC.py +++ b/src/Mod/Arch/importIFC.py @@ -623,7 +623,7 @@ def insert(filename,docname,skip=[],only=[],root=None): obj.Placement.Rotation = r obj.Placement.move(v) else: - print ("failed to compute placement ",) + print("failed to compute placement ",) else: obj = getattr(Arch,"make"+freecadtype)(baseobj=baseobj,name=name) if store: @@ -793,7 +793,7 @@ def insert(filename,docname,skip=[],only=[],root=None): Arch.addComponents(cobs,objects[host]) if DEBUG: FreeCAD.ActiveDocument.recompute() - if DEBUG: print ("done") + if DEBUG: print("done") if MERGE_MODE_ARCH > 2: # if ArchObj is compound or ArchObj not imported FreeCAD.ActiveDocument.recompute() @@ -810,7 +810,7 @@ def insert(filename,docname,skip=[],only=[],root=None): if ifcfile[host].Name: grp_name = ifcfile[host].Name else: - if DEBUG: print ("no group name specified for entity: #", ifcfile[host].id(), ", entity type is used!") + if DEBUG: print("no group name specified for entity: #", ifcfile[host].id(), ", entity type is used!") grp_name = ifcfile[host].is_a() + "_" + str(ifcfile[host].id()) grp = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroup",grp_name.encode("utf8")) objects[host] = grp @@ -846,7 +846,7 @@ def insert(filename,docname,skip=[],only=[],root=None): obj = FreeCAD.ActiveDocument.addObject("Part::Feature","UnclaimedArch") obj.Shape = Part.makeCompound(shapes.values()) - if DEBUG: print ("done") + if DEBUG: print("done") else: @@ -952,7 +952,7 @@ def insert(filename,docname,skip=[],only=[],root=None): if hasattr(objects[o],"BaseMaterial"): objects[o].BaseMaterial = mat - if DEBUG and materials: print ("done") + if DEBUG and materials: print("done") FreeCAD.ActiveDocument.recompute() @@ -1288,11 +1288,11 @@ def export(exportList,filename): if not defaulthost: defaulthost = products[site.Name] if not sites: - if DEBUG: print ("No site found. Adding default site") + if DEBUG: print("No site found. Adding default site") sites = [ifcfile.createIfcSite(ifcopenshell.guid.compress(uuid.uuid1().hex),history,"Default Site",'',None,None,None,None,"ELEMENT",None,None,None,None,None)] ifcfile.createIfcRelAggregates(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'ProjectLink','',project,sites) if not buildings: - if DEBUG: print ("No building found. Adding default building") + if DEBUG: print("No building found. Adding default building") buildings = [ifcfile.createIfcBuilding(ifcopenshell.guid.compress(uuid.uuid1().hex),history,"Default Building",'',None,None,None,None,"ELEMENT",None,None,None)] ifcfile.createIfcRelAggregates(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'SiteLink','',sites[0],buildings) untreated = [] @@ -1371,7 +1371,7 @@ def export(exportList,filename): if EXPORT_2D: annos = [] curvestyles = {} - if annotations and DEBUG: print ("exporting 2D objects...") + if annotations and DEBUG: print("exporting 2D objects...") for anno in annotations: xvc = ifcfile.createIfcDirection((1.0,0.0,0.0)) zvc = ifcfile.createIfcDirection((0.0,0.0,1.0)) diff --git a/src/Mod/Arch/importSH3D.py b/src/Mod/Arch/importSH3D.py index e34ec8bcb..c14d293cc 100644 --- a/src/Mod/Arch/importSH3D.py +++ b/src/Mod/Arch/importSH3D.py @@ -20,6 +20,7 @@ #* * #*************************************************************************** +from __future__ import print_function __title__ = "FreeCAD SweetHome3D importer" __author__ = "Yorik van Havre" __url__ = "http://www.freecadweb.org" @@ -120,7 +121,7 @@ class SH3DHandler(xml.sax.ContentHandler): p2 = FreeCAD.Vector(float(attributes["xEnd"])*10,float(attributes["yEnd"])*10,0) height = float(attributes["height"])*10 thickness = float(attributes["thickness"])*10 - if DEBUG: print "Creating wall: ",name + if DEBUG: print("Creating wall: ",name) line = Draft.makeLine(p1,p2) if self.makeIndividualWalls: wall = Arch.makeWall(baseobj=line,width=thickness,height=height,name=name) @@ -144,7 +145,7 @@ class SH3DHandler(xml.sax.ContentHandler): mat.scale(1000*fx,1000*fy,1000*fz) mat.rotateX(math.pi/2) mat.rotateZ(math.pi) - if DEBUG: print "Creating furniture: ",name + if DEBUG: print("Creating furniture: ",name) if "angle" in attributes.keys(): mat.rotateZ(float(attributes["angle"])) m.transform(mat) @@ -188,7 +189,7 @@ class SH3DHandler(xml.sax.ContentHandler): shape.makeShapeFromMesh(m.Topology,0.100000) shape = shape.removeSplitter() if shape: - if DEBUG: print "Creating window: ",name + if DEBUG: print("Creating window: ",name) if "angle" in attributes.keys(): shape.rotate(shape.BoundBox.Center,FreeCAD.Vector(0,0,1),math.degrees(float(attributes["angle"]))) sub.rotate(shape.BoundBox.Center,FreeCAD.Vector(0,0,1),math.degrees(float(attributes["angle"])))