[ARCH] Catch only Exception, not BaseException
This commit is contained in:
@@ -461,7 +461,7 @@ class _ViewProviderAxis:
|
||||
cin = coin.SoInput()
|
||||
cin.setBuffer(buf)
|
||||
cob = coin.SoDB.readAll(cin)
|
||||
except:
|
||||
except Exception:
|
||||
import re
|
||||
# workaround for pivy SoInput.setBuffer() bug
|
||||
buf = buf.replace("\n","")
|
||||
@@ -492,7 +492,7 @@ class _ViewProviderAxis:
|
||||
if vobj.FontName:
|
||||
try:
|
||||
fn = str(vobj.FontName)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
fo.name = fn
|
||||
fo.size = fs
|
||||
@@ -560,7 +560,7 @@ class _ViewProviderAxis:
|
||||
if vobj.FontName:
|
||||
try:
|
||||
fn = str(vobj.FontName)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
fo.name = fn
|
||||
fo.size = fs
|
||||
|
||||
@@ -711,7 +711,7 @@ class ViewProviderBuildingPart:
|
||||
u = q.getUserPreferred()[2]
|
||||
try:
|
||||
q = q.getValueAs(u)
|
||||
except:
|
||||
except Exception:
|
||||
q = q.getValueAs(q.getUserPreferred()[2])
|
||||
d = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Units").GetInt("Decimals",0)
|
||||
fmt = "{0:."+ str(d) + "f}"
|
||||
|
||||
@@ -484,7 +484,7 @@ def getShapeFromMesh(mesh,fast=True,tolerance=0.001,flat=False,cut=True):
|
||||
pts.append(FreeCAD.Vector(pp[0],pp[1],pp[2]))
|
||||
try:
|
||||
f = Part.Face(Part.makePolygon(pts))
|
||||
except:
|
||||
except Exception:
|
||||
print("getShapeFromMesh: error building face from polygon")
|
||||
#pass
|
||||
else:
|
||||
@@ -518,7 +518,7 @@ def getShapeFromMesh(mesh,fast=True,tolerance=0.001,flat=False,cut=True):
|
||||
wires = nwires
|
||||
try:
|
||||
faces.append(makeFace(wires,method=int(cut)+1))
|
||||
except:
|
||||
except Exception:
|
||||
return None
|
||||
try:
|
||||
se = Part.makeShell(faces)
|
||||
@@ -684,7 +684,7 @@ def download(url,force=False):
|
||||
f = open(filepath,'wb')
|
||||
f.write(s)
|
||||
f.close()
|
||||
except:
|
||||
except Exception:
|
||||
return None
|
||||
else:
|
||||
return filepath
|
||||
@@ -1235,7 +1235,7 @@ def rebuildArchShape(objects=None):
|
||||
if solid.isValid():
|
||||
base.Shape = solid
|
||||
success = True
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
if not success:
|
||||
print ("Failed to rebuild a valid solid for object ",obj.Name)
|
||||
|
||||
@@ -1722,7 +1722,7 @@ class ComponentTaskPanel:
|
||||
self.grid.addWidget(self.classButton, 5, 0, 1, 2)
|
||||
try:
|
||||
import BimClassification
|
||||
except:
|
||||
except Exception:
|
||||
self.classButton.hide()
|
||||
else:
|
||||
import os
|
||||
@@ -2330,22 +2330,22 @@ if FreeCAD.GuiUp:
|
||||
if "Integer" in editor.objectName():
|
||||
try:
|
||||
editor.setValue(int(index.data()))
|
||||
except:
|
||||
except Exception:
|
||||
editor.setValue(0)
|
||||
elif "Real" in editor.objectName():
|
||||
try:
|
||||
editor.setValue(float(index.data()))
|
||||
except:
|
||||
except Exception:
|
||||
editor.setValue(0)
|
||||
elif ("Boolean" in editor.objectName()) or ("Logical" in editor.objectName()):
|
||||
try:
|
||||
editor.setCurrentIndex(["true","false"].index(index.data().lower()))
|
||||
except:
|
||||
except Exception:
|
||||
editor.setCurrentIndex(1)
|
||||
elif "Measure" in editor.objectName():
|
||||
try:
|
||||
editor.setText(index.data())
|
||||
except:
|
||||
except Exception:
|
||||
editor.setValue(0)
|
||||
else:
|
||||
editor.setText(index.data())
|
||||
|
||||
@@ -534,7 +534,7 @@ class _ArchMaterialTaskPanel:
|
||||
self.fillExistingCombo()
|
||||
try:
|
||||
import BimClassification
|
||||
except:
|
||||
except Exception:
|
||||
self.form.ButtonCode.hide()
|
||||
else:
|
||||
import os
|
||||
@@ -917,7 +917,7 @@ class _ArchMultiMaterialTaskPanel:
|
||||
d = self.model.item(row,2).text()
|
||||
try:
|
||||
d = float(d)
|
||||
except:
|
||||
except Exception:
|
||||
thick = FreeCAD.Units.Quantity(d).Value
|
||||
else:
|
||||
thick = FreeCAD.Units.Quantity(d,FreeCAD.Units.Length).Value
|
||||
@@ -950,7 +950,7 @@ class _ArchMultiMaterialTaskPanel:
|
||||
d = self.model.item(row,2).text()
|
||||
try:
|
||||
d = float(d)
|
||||
except:
|
||||
except Exception:
|
||||
thick = FreeCAD.Units.Quantity(d).Value
|
||||
else:
|
||||
thick = FreeCAD.Units.Quantity(d,FreeCAD.Units.Length).Value
|
||||
|
||||
@@ -460,18 +460,18 @@ class Nester:
|
||||
edges = [e[0] for e in lut.values() if len(e) == 1]
|
||||
try:
|
||||
pol = Part.Face(Part.Wire(edges))
|
||||
except:
|
||||
except Exception:
|
||||
# above method can fail sometimes. Try a slower method
|
||||
w = DraftGeomUtils.findWires(edges)
|
||||
if len(w) == 1:
|
||||
if w[0].isClosed():
|
||||
try:
|
||||
pol = Part.Face(w[0])
|
||||
except:
|
||||
except Exception:
|
||||
print("Error merging polygons. Aborting")
|
||||
try:
|
||||
Part.show(Part.Wire(edges))
|
||||
except:
|
||||
except Exception:
|
||||
for e in edges:
|
||||
Part.show(e)
|
||||
return
|
||||
|
||||
@@ -534,7 +534,7 @@ class _Panel(ArchComponent.Component):
|
||||
try:
|
||||
baseprofile = Part.makeFace(base.Wires,"Part::FaceMaker"+str(obj.FaceMaker))
|
||||
fm = True
|
||||
except:
|
||||
except Exception:
|
||||
FreeCAD.Console.PrintError(translate("Arch","Facemaker returned an error")+"\n")
|
||||
return
|
||||
if not fm:
|
||||
|
||||
@@ -266,7 +266,7 @@ class _ArchPipe(ArchComponent.Component):
|
||||
for pw in p.Wires:
|
||||
sh = w.makePipeShell([pw],True,False,2)
|
||||
shapes.append(sh)
|
||||
except:
|
||||
except Exception:
|
||||
FreeCAD.Console.PrintError(translate("Arch","Unable to build the pipe")+"\n")
|
||||
else:
|
||||
if len(shapes) == 0:
|
||||
|
||||
@@ -859,7 +859,7 @@ class _Roof(ArchComponent.Component):
|
||||
if faceLst:
|
||||
try:
|
||||
shell = Part.Shell(faceLst)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
lut={}
|
||||
|
||||
@@ -289,7 +289,7 @@ class _ArchSchedule:
|
||||
d = getattr(d,v)
|
||||
if hasattr(d,"Value"):
|
||||
d = d.Value
|
||||
except:
|
||||
except Exception:
|
||||
FreeCAD.Console.PrintWarning(translate("Arch","Unable to retrieve value from object")+": "+o.Name+"."+".".join(vals)+"\n")
|
||||
else:
|
||||
if verbose:
|
||||
|
||||
@@ -116,16 +116,16 @@ def makeSolarDiagram(longitude,latitude,scale=1,complete=False,tz=None):
|
||||
import ladybug
|
||||
from ladybug import location
|
||||
from ladybug import sunpath
|
||||
except:
|
||||
except Exception:
|
||||
# TODO - remove pysolar dependency
|
||||
# FreeCAD.Console.PrintWarning("Ladybug module not found, using pysolar instead. Warning, this will be deprecated in the future\n")
|
||||
ladybug = False
|
||||
try:
|
||||
import pysolar
|
||||
except:
|
||||
except Exception:
|
||||
try:
|
||||
import Pysolar as pysolar
|
||||
except:
|
||||
except Exception:
|
||||
FreeCAD.Console.PrintError("The pysolar module was not found. Unable to generate solar diagrams\n")
|
||||
return None
|
||||
else:
|
||||
@@ -296,7 +296,7 @@ def makeWindRose(epwfile,scale=1,sectors=24):
|
||||
try:
|
||||
import ladybug
|
||||
from ladybug import epw
|
||||
except:
|
||||
except Exception:
|
||||
FreeCAD.Console.PrintError("The ladybug module was not found. Unable to generate solar diagrams\n")
|
||||
return None
|
||||
if not epwfile:
|
||||
@@ -1046,7 +1046,7 @@ class _ViewProviderSite:
|
||||
if hasattr(vobj.Object,"EPWFile") and vobj.Object.EPWFile:
|
||||
try:
|
||||
import ladybug
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
self.windrosenode = makeWindRose(vobj.Object.EPWFile,vobj.SolarDiagramScale)
|
||||
|
||||
@@ -349,7 +349,7 @@ class _Stairs(ArchComponent.Component):
|
||||
try:
|
||||
obj.RailingLeft = outlineWireLeftObject.InList[0].Name
|
||||
obj.removeProperty("OutlineWireLeft")
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
if not hasattr(obj,"RailingRight"):
|
||||
obj.addProperty("App::PropertyString","RailingRight","Segment and Parts","Name of Railing object (right) created")
|
||||
@@ -359,7 +359,7 @@ class _Stairs(ArchComponent.Component):
|
||||
try:
|
||||
obj.RailingRight = outlineWireRightObject.InList[0].Name
|
||||
obj.removeProperty("OutlineWireRight")
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if not hasattr(obj,"OutlineLeftAll"):
|
||||
@@ -683,7 +683,7 @@ class _Stairs(ArchComponent.Component):
|
||||
netWidthI = widthOtherSegments[i-1] - offsetHLeft.Value - offsetHRight.Value #2*offsetH
|
||||
else: # i.e. elif widthFirstSegmentDefault:
|
||||
netWidthI = widthFirstSegment.Value - offsetHLeft.Value - offsetHRight.Value #2*offsetH
|
||||
except:
|
||||
except Exception:
|
||||
if widthFirstSegmentDefault:
|
||||
netWidthI = widthFirstSegment.Value - offsetHLeft.Value - offsetHRight.Value #2*offsetH
|
||||
|
||||
@@ -847,7 +847,7 @@ class _Stairs(ArchComponent.Component):
|
||||
foundStart = edges[0].Vertexes[1].Point
|
||||
else: # if distFrom2ndParameter = / < distFrom1stParameter (i.e. if equal, Vertexes[0].Point is taken ?)
|
||||
foundStart = edges[0].Vertexes[0].Point
|
||||
except:
|
||||
except Exception:
|
||||
print('Intersection point Not on this edge')
|
||||
|
||||
''' Guessing the last End Point based on Intersection '''
|
||||
@@ -860,7 +860,7 @@ class _Stairs(ArchComponent.Component):
|
||||
foundEnd = edges[i].Vertexes[1].Point
|
||||
else:
|
||||
foundEnd = edges[i].Vertexes[0].Point
|
||||
except:
|
||||
except Exception:
|
||||
print('Intersection point Not on this edge')
|
||||
|
||||
outlineP1P2Ordered[0] = foundStart
|
||||
|
||||
@@ -285,7 +285,7 @@ class _CommandStructure:
|
||||
if self.Profile is not None:
|
||||
try: # try to update latest precast values - fails if dialog has been destroyed already
|
||||
self.precastvalues = self.precast.getValues()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
if ("Precast" in self.Profile) and self.precastvalues:
|
||||
# precast concrete
|
||||
@@ -475,7 +475,7 @@ class _CommandStructure:
|
||||
if FreeCADGui.Control.activeDialog():
|
||||
try: # try to update latest precast values - fails if dialog has been destroyed already
|
||||
self.precastvalues = self.precast.getValues()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
if self.Height >= self.Length:
|
||||
delta = Vector(0,0,self.Height/2)
|
||||
@@ -762,7 +762,7 @@ class _Structure(ArchComponent.Component):
|
||||
if obj.FaceMaker != "None":
|
||||
try:
|
||||
baseface = Part.makeFace(obj.Base.Shape.Wires,"Part::FaceMaker"+str(obj.FaceMaker))
|
||||
except:
|
||||
except Exception:
|
||||
FreeCAD.Console.PrintError(translate("Arch","Facemaker returned an error")+"\n")
|
||||
return None
|
||||
if len(baseface.Faces) > 1:
|
||||
|
||||
@@ -200,7 +200,7 @@ class Renderer:
|
||||
wires.append(Part.makePolygon(verts))
|
||||
try:
|
||||
sh = ArchCommands.makeFace(wires)
|
||||
except:
|
||||
except Exception:
|
||||
if DEBUG: print("Error: Unable to project face on the WP")
|
||||
return None
|
||||
else:
|
||||
|
||||
@@ -1023,7 +1023,7 @@ class _Wall(ArchComponent.Component):
|
||||
elif Draft.getType(obj.Base) == "Sketcher::SketchObject":
|
||||
try:
|
||||
obj.Base.movePoint(0,2,p2,0)
|
||||
except:
|
||||
except Exception:
|
||||
print("Debug: The base sketch of this wall could not be changed, because the sketch has not been edited yet in this session (this is a bug in FreeCAD). Try entering and exiting edit mode in this sketch first, and then changing the wall length should work.")
|
||||
else:
|
||||
FreeCAD.Console.PrintError(translate("Arch","Error: Unable to modify the base object of this wall")+"\n")
|
||||
@@ -1100,11 +1100,11 @@ class _Wall(ArchComponent.Component):
|
||||
# sort the width list in OverrrideWidth to correspond to indexes of sorted edges of Sketch
|
||||
try:
|
||||
import ArchSketchObject
|
||||
except:
|
||||
except Exception:
|
||||
print("ArchSketchObject add-on module is not installed yet")
|
||||
try:
|
||||
widths = ArchSketchObject.sortSketchWidth(obj.Base, obj.OverrideWidth)
|
||||
except:
|
||||
except Exception:
|
||||
widths = obj.OverrideWidth
|
||||
else:
|
||||
# If Base Object is not Sketch, but e.g. DWire, the width
|
||||
@@ -1145,11 +1145,11 @@ class _Wall(ArchComponent.Component):
|
||||
# sorted edges of Sketch
|
||||
try:
|
||||
import ArchSketchObject
|
||||
except:
|
||||
except Exception:
|
||||
print("ArchSketchObject add-on module is not installed yet")
|
||||
try:
|
||||
aligns = ArchSketchObject.sortSketchAlign(obj.Base, obj.OverrideAlign)
|
||||
except:
|
||||
except Exception:
|
||||
aligns = obj.OverrideAlign
|
||||
else:
|
||||
# If Base Object is not Sketch, but e.g. DWire, the align
|
||||
@@ -1314,7 +1314,7 @@ class _Wall(ArchComponent.Component):
|
||||
try:
|
||||
if aligns[n] not in ['Left', 'Right', 'Center']:
|
||||
aligns[n] = align
|
||||
except:
|
||||
except Exception:
|
||||
aligns.append(align)
|
||||
|
||||
# Fill the widths List with ArchWall's default
|
||||
@@ -1323,7 +1323,7 @@ class _Wall(ArchComponent.Component):
|
||||
try:
|
||||
if not widths[n]:
|
||||
widths[n] = width
|
||||
except:
|
||||
except Exception:
|
||||
widths.append(width)
|
||||
|
||||
# Get a direction vector orthogonal to both the
|
||||
|
||||
@@ -491,7 +491,7 @@ class _CommandWindow:
|
||||
if path.lower().endswith(".fcstd"):
|
||||
try:
|
||||
import zipfile,tempfile
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
zfile=zipfile.ZipFile(path)
|
||||
|
||||
@@ -199,10 +199,10 @@ def export(exportList, filename, colors=None, preferences=None):
|
||||
import json
|
||||
try:
|
||||
from ifcjson import ifc2json5a
|
||||
except:
|
||||
except Exception:
|
||||
try:
|
||||
import ifc2json5a
|
||||
except:
|
||||
except Exception:
|
||||
_err("Error: Unable to locate ifc2json5a module. Aborting.")
|
||||
return
|
||||
|
||||
@@ -1615,10 +1615,10 @@ def getPropertyData(key,value,preferences):
|
||||
else:
|
||||
try:
|
||||
pvalue = float(pvalue)
|
||||
except:
|
||||
except Exception:
|
||||
try:
|
||||
pvalue = FreeCAD.Units.Quantity(pvalue).Value
|
||||
except:
|
||||
except Exception:
|
||||
if six.PY2:
|
||||
pvalue = pvalue.encode("utf8")
|
||||
if preferences['DEBUG']:print(" warning: unable to export property as numeric value:",pname,pvalue)
|
||||
@@ -2415,10 +2415,10 @@ def writeJson(filename,ifcfile):
|
||||
import json
|
||||
try:
|
||||
from ifcjson import ifc2json5a
|
||||
except:
|
||||
except Exception:
|
||||
try:
|
||||
import ifc2json5a
|
||||
except:
|
||||
except Exception:
|
||||
print("Error: Unable to locate ifc2json5a module. Aborting.")
|
||||
return
|
||||
print("Converting IFC to JSON...")
|
||||
|
||||
@@ -125,7 +125,7 @@ class ContextCreator:
|
||||
self.project_data["map_zone"],
|
||||
SIUnit.SIUnit
|
||||
)
|
||||
except:
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def createMapConversion(self):
|
||||
@@ -139,7 +139,7 @@ class ContextCreator:
|
||||
self.calculateXAxisOrdinate(),
|
||||
float(self.project_data["scale"])
|
||||
)
|
||||
except:
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def createTrueNorth(self):
|
||||
@@ -187,7 +187,7 @@ class ContextCreator:
|
||||
def getProjectObject(self):
|
||||
try:
|
||||
return getObjectsOfIfcType(self.objects, "Project")[0]
|
||||
except:
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def getProjectObjectData(self):
|
||||
|
||||
@@ -485,7 +485,7 @@ def insert(srcfile, docname, skip=[], only=[], root=None, preferences=None):
|
||||
prepr = None
|
||||
try:
|
||||
prepr = product.Representation
|
||||
except:
|
||||
except Exception:
|
||||
if preferences['DEBUG']: print(" ERROR unable to get object representation",end="")
|
||||
if prepr and (preferences['MERGE_MODE_ARCH'] == 0) and archobj and preferences['CREATE_CLONES']:
|
||||
for r in prepr.Representations:
|
||||
@@ -507,7 +507,7 @@ def insert(srcfile, docname, skip=[], only=[], root=None, preferences=None):
|
||||
try:
|
||||
cr = geom.create_shape(settings, product)
|
||||
brep = cr.geometry.brep_data
|
||||
except:
|
||||
except Exception:
|
||||
pass # IfcOpenShell will yield an error if a given product has no shape, but we don't care, we're brave enough
|
||||
|
||||
# from now on we have a brep string
|
||||
@@ -530,7 +530,7 @@ def insert(srcfile, docname, skip=[], only=[], root=None, preferences=None):
|
||||
try:
|
||||
bb = shape.BoundBox
|
||||
# if preferences['DEBUG']: print(' ' + str(bb),end="")
|
||||
except:
|
||||
except Exception:
|
||||
bb = None
|
||||
if preferences['DEBUG']: print(' BB could not be computed',end="")
|
||||
if bb and bb.isValid():
|
||||
@@ -740,7 +740,7 @@ def insert(srcfile, docname, skip=[], only=[], root=None, preferences=None):
|
||||
try:
|
||||
if hasattr(obj,"IfcType"):
|
||||
obj.IfcType = ''.join(map(lambda x: x if x.islower() else " "+x, ptype[3:]))[1:]
|
||||
except:
|
||||
except Exception:
|
||||
print("Unable to give IFC type ",ptype," to object ",obj.Label)
|
||||
|
||||
# setting uid
|
||||
@@ -794,7 +794,7 @@ def insert(srcfile, docname, skip=[], only=[], root=None, preferences=None):
|
||||
try:
|
||||
if hasattr(obj,"IfcType"):
|
||||
obj.IfcType = ''.join(map(lambda x: x if x.islower() else " "+x, ptype[3:]))[1:]
|
||||
except:
|
||||
except Exception:
|
||||
print("Unable to give IFC type ",ptype," to object ",obj.Label)
|
||||
if hasattr(obj,"IfcData"):
|
||||
a = obj.IfcData
|
||||
|
||||
@@ -111,7 +111,7 @@ class ProjectImporter:
|
||||
# this method; otherwise a simple function (not tied to a class)
|
||||
# should be used.
|
||||
ArchIFC.IfcRoot.setObjIfcComplexAttributeValue(self, self.object, "RepresentationContexts", data)
|
||||
except:
|
||||
except Exception:
|
||||
# This scenario occurs validly in IFC2X3,
|
||||
# as the mapConversion does not exist
|
||||
return
|
||||
|
||||
@@ -489,7 +489,7 @@ def makeWall(entity,shape=None,name="Wall"):
|
||||
return wall
|
||||
if DEBUG: print(" error: skipping wall",entity.id)
|
||||
return None
|
||||
except:
|
||||
except Exception:
|
||||
if DEBUG: print(" error: skipping wall",entity)
|
||||
return None
|
||||
|
||||
@@ -524,7 +524,7 @@ def makeWindow(entity,shape=None,name="Window"):
|
||||
return window
|
||||
if DEBUG: print(" error: skipping window",entity.id)
|
||||
return None
|
||||
except:
|
||||
except Exception:
|
||||
if DEBUG: print(" error: skipping window",entity)
|
||||
return None
|
||||
|
||||
@@ -571,7 +571,7 @@ def makeStructure(entity,shape=None,ifctype=None,name="Structure"):
|
||||
return structure
|
||||
if DEBUG: print(" error: skipping structure",entity.id)
|
||||
return None
|
||||
except:
|
||||
except Exception:
|
||||
if DEBUG: print(" error: skipping structure",entity)
|
||||
return None
|
||||
|
||||
@@ -594,7 +594,7 @@ def makeSite(entity,shape=None,name="Site"):
|
||||
site.Terrain = body
|
||||
if DEBUG: print(" made site object ",entity,":",site)
|
||||
return site
|
||||
except:
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def makeSpace(entity,shape=None,name="Space"):
|
||||
@@ -611,7 +611,7 @@ def makeSpace(entity,shape=None,name="Space"):
|
||||
body.ViewObject.hide()
|
||||
if DEBUG: print(" made space object ",entity,":",space)
|
||||
return space
|
||||
except:
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
@@ -626,7 +626,7 @@ def makeRoof(entity,shape=None,name="Roof"):
|
||||
roof.Shape = shape
|
||||
if DEBUG: print(" made roof object ",entity,":",roof)
|
||||
return roof
|
||||
except:
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
# geometry helpers ###################################################################
|
||||
@@ -681,7 +681,7 @@ def getShape(obj,objid):
|
||||
brep_data = IfcImport.create_shape(obj,IfcImport.DISABLE_OBJECT_PLACEMENT | ss)
|
||||
else:
|
||||
brep_data = IfcImport.create_shape(obj, ss)
|
||||
except:
|
||||
except Exception:
|
||||
print("Unable to retrieve shape data")
|
||||
else:
|
||||
brep_data = obj.mesh.brep_data
|
||||
@@ -698,7 +698,7 @@ def getShape(obj,objid):
|
||||
os.remove(tf)
|
||||
else:
|
||||
sh.importBrepFromString(brep_data)
|
||||
except:
|
||||
except Exception:
|
||||
print(" error: malformed shape")
|
||||
return None
|
||||
else:
|
||||
@@ -716,7 +716,7 @@ def getShape(obj,objid):
|
||||
solid = Part.makeSolid(shell)
|
||||
if solid:
|
||||
sh = solid
|
||||
except:
|
||||
except Exception:
|
||||
if DEBUG: print(" failed to retrieve solid from object ",objid)
|
||||
else:
|
||||
if DEBUG: print(" object ", objid, " doesn't contain any geometry")
|
||||
@@ -908,7 +908,7 @@ def group(entity,ifc,mode=None):
|
||||
cell = Arch.makeBuilding(comps,name=name)
|
||||
if label and cell:
|
||||
cell.Label = label
|
||||
except:
|
||||
except Exception:
|
||||
if DEBUG: print("error: skipping group ",entity.id)
|
||||
|
||||
def getWire(entity,placement=None):
|
||||
@@ -1208,7 +1208,7 @@ def getTuples(data,scale=1,placement=None,normal=None,close=True):
|
||||
if DraftVecUtils.angle(v2,v1,normal) >= 0:
|
||||
# inverting verts order if the direction is couterclockwise
|
||||
verts.reverse()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
for v in verts:
|
||||
pt = v.Point
|
||||
@@ -1739,7 +1739,7 @@ class IfcDocument:
|
||||
val = self.getEnt(int(val))
|
||||
if not val:
|
||||
val = value
|
||||
except:
|
||||
except Exception:
|
||||
if DEBUG: print("error parsing attribute",value)
|
||||
val = value
|
||||
return val
|
||||
@@ -2041,7 +2041,7 @@ class IfcWriter(object):
|
||||
if APPLYFIX:
|
||||
print("IfcWriter: Applying fix...")
|
||||
self._fix(path)
|
||||
except:
|
||||
except Exception:
|
||||
print("IfcWriter: Error writing to "+path)
|
||||
else:
|
||||
print("IfcWriter: Successfully written to "+path)
|
||||
@@ -2175,7 +2175,7 @@ class IfcWriter(object):
|
||||
prd = create(self._fileobject,"IfcProductDefinitionShape",[None,None,representations])
|
||||
try:
|
||||
elt = create(self._fileobject,elttype,[uid(),self._owner,name,description,None,placement,prd,None]+extra)
|
||||
except:
|
||||
except Exception:
|
||||
print("unable to create an ",elttype, " with attributes: ",[uid(),self._owner,str(name),description,None,placement,prd,None]+extra)
|
||||
try:
|
||||
if hasattr(ifcw,"Entity"):
|
||||
@@ -2184,7 +2184,7 @@ class IfcWriter(object):
|
||||
o = ifcw.entity_instance(elttype)
|
||||
print("supported attributes are: ")
|
||||
print(getPropertyNames(o))
|
||||
except:
|
||||
except Exception:
|
||||
print("unable to create an element of type '"+elttype+"'")
|
||||
print("WARNING: skipping object '"+name+"' of type "+elttype)
|
||||
return None
|
||||
|
||||
@@ -194,7 +194,7 @@ def setAttributes(obj,ifcproduct):
|
||||
if value:
|
||||
try:
|
||||
setattr(obj,attr,value)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ def getIndices(obj,shape,offsetv,offsetvn):
|
||||
mesh = MeshPart.meshFromShape(Shape=myshape, LinearDeflection=0.1, AngularDeflection=0.7, Relative=True)
|
||||
FreeCAD.Console.PrintWarning(translate("Arch","Found a shape containing curves, triangulating")+"\n")
|
||||
break
|
||||
except: # unimplemented curve type
|
||||
except Exception: # unimplemented curve type
|
||||
if obj.isDerivedFrom("App::Link"):
|
||||
if obj.Shape:
|
||||
myshape = obj.Shape.copy(False)
|
||||
|
||||
@@ -128,7 +128,7 @@ def checkShapeFileLibrary():
|
||||
|
||||
try:
|
||||
import shapefile
|
||||
except:
|
||||
except Exception:
|
||||
url = "https://raw.githubusercontent.com/GeospatialPython/pyshp/master/shapefile.py"
|
||||
if FreeCAD.GuiUp:
|
||||
import addonmanager_utilities
|
||||
@@ -153,7 +153,7 @@ def checkShapeFileLibrary():
|
||||
f.close()
|
||||
try:
|
||||
import shapefile
|
||||
except:
|
||||
except Exception:
|
||||
FreeCAD.Console.PrintError(translate("Arch","Could not download shapefile module. Aborting.")+"\n")
|
||||
return False
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user