issue #1701
This commit is contained in:
parent
f0bf3cb6ab
commit
e820a32653
|
@ -324,7 +324,7 @@ def closeHole(shape):
|
|||
nface = Part.Face(Part.Wire(bound))
|
||||
shell = Part.makeShell(shape.Faces+[nface])
|
||||
solid = Part.Solid(shell)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
raise
|
||||
else:
|
||||
return solid
|
||||
|
@ -350,7 +350,7 @@ def getCutVolume(cutplane,shapes):
|
|||
p = cutplane.Shape.copy().Faces[0]
|
||||
else:
|
||||
p = cutplane.copy().Faces[0]
|
||||
except:
|
||||
except Part.OCCError:
|
||||
FreeCAD.Console.PrintMessage(translate("Arch","Invalid cutplane\n"))
|
||||
return None,None,None
|
||||
ce = p.CenterOfMass
|
||||
|
@ -430,17 +430,17 @@ def getShapeFromMesh(mesh,fast=True,tolerance=0.001,flat=False,cut=True):
|
|||
se = se.removeSplitter()
|
||||
if flat:
|
||||
return se
|
||||
except:
|
||||
except Part.OCCError:
|
||||
try:
|
||||
cp = Part.makeCompound(faces)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
return None
|
||||
else:
|
||||
return cp
|
||||
else:
|
||||
try:
|
||||
solid = Part.Solid(se)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
return se
|
||||
else:
|
||||
return solid
|
||||
|
|
|
@ -566,7 +566,7 @@ class Component:
|
|||
if base.Solids:
|
||||
try:
|
||||
base = base.fuse(s)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
print "Arch: unable to fuse object ",obj.Name, " with ", o.Name
|
||||
else:
|
||||
base = s
|
||||
|
@ -604,7 +604,7 @@ class Component:
|
|||
s.Placement = s.Placement.multiply(placement)
|
||||
try:
|
||||
base = base.cut(s)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
print "Arch: unable to cut object ",o.Name, " from ", obj.Name
|
||||
return base
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ def createMeshView(obj,direction=FreeCAD.Vector(0,0,-1),outeronly=False,largesto
|
|||
shape = shape.fuse(p)
|
||||
else:
|
||||
shape = p
|
||||
except:
|
||||
except Part.OCCError:
|
||||
pass
|
||||
shape = shape.removeSplitter()
|
||||
|
||||
|
@ -151,7 +151,7 @@ def createMeshView(obj,direction=FreeCAD.Vector(0,0,-1),outeronly=False,largesto
|
|||
if largest:
|
||||
try:
|
||||
f = Part.Face(w)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
print "Unable to produce a face from the outer wire."
|
||||
else:
|
||||
shape = f
|
||||
|
|
|
@ -203,7 +203,7 @@ class _Rebar(ArchComponent.Component):
|
|||
circle = Part.Wire(circle)
|
||||
try:
|
||||
bar = wire.makePipeShell([circle],True,False,2)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
print "Arch: error sweeping rebar profile along the base sketch"
|
||||
return
|
||||
# building final shape
|
||||
|
|
|
@ -357,7 +357,7 @@ class _ArchDrawingView:
|
|||
try:
|
||||
s = Part.Wire(s.Edges)
|
||||
s = Part.Face(s)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
pass
|
||||
nsh.extend(c.Solids)
|
||||
sshapes.append(s)
|
||||
|
|
|
@ -223,7 +223,7 @@ class _Space(ArchComponent.Component):
|
|||
w = Part.Wire(e)
|
||||
f = Part.Face(w)
|
||||
return f.Area
|
||||
except:
|
||||
except Part.OCCError:
|
||||
return 0
|
||||
|
||||
|
||||
|
@ -303,7 +303,7 @@ class _ViewProviderSpace(ArchComponent.ViewProviderComponent):
|
|||
pos = vobj.Object.Shape.CenterOfMass
|
||||
z = vobj.Object.Shape.BoundBox.ZMin
|
||||
pos = FreeCAD.Vector(pos.x,pos.y,z)
|
||||
except:
|
||||
except (AttributeError, RuntimeError):
|
||||
pos = FreeCAD.Vector()
|
||||
else:
|
||||
pos = vobj.TextPosition
|
||||
|
|
|
@ -583,7 +583,7 @@ class _Structure(ArchComponent.Component):
|
|||
if obj.Tool:
|
||||
try:
|
||||
base = obj.Tool.Shape.copy().makePipe(obj.Base.Shape.copy())
|
||||
except:
|
||||
except Part.OCCError:
|
||||
FreeCAD.Console.PrintError(translate("Arch","Error: The base shape couldn't be extruded along this tool object"))
|
||||
return
|
||||
if not base:
|
||||
|
|
|
@ -225,7 +225,7 @@ class Renderer:
|
|||
wires.append(Part.makePolygon(verts))
|
||||
try:
|
||||
sh = Part.Face(wires)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
if DEBUG: print "Error: Unable to flatten face"
|
||||
return None
|
||||
else:
|
||||
|
@ -408,6 +408,7 @@ class Renderer:
|
|||
|
||||
def join(self,otype):
|
||||
"joins the objects of same type"
|
||||
import Part
|
||||
walls = []
|
||||
structs = []
|
||||
objs = []
|
||||
|
@ -428,7 +429,7 @@ class Renderer:
|
|||
try:
|
||||
fs = s.fuse(o.Shape)
|
||||
fs = fs.removeSplitter()
|
||||
except:
|
||||
except Part.OCCError:
|
||||
print "shape fusion failed"
|
||||
objs.append([o.Shape,o.ViewObject.DiffuseColor[0]])
|
||||
else:
|
||||
|
|
|
@ -1072,7 +1072,7 @@ class _ArchWindowTaskPanel:
|
|||
try:
|
||||
q = FreeCAD.Units.Quantity(t)
|
||||
t = str(q.Value)
|
||||
except:
|
||||
except (ValueError,TypeError):
|
||||
ok = False
|
||||
ar.append(t)
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ def checkCollada():
|
|||
COLLADA = None
|
||||
try:
|
||||
import collada
|
||||
except:
|
||||
except ImportError:
|
||||
FreeCAD.Console.PrintError(translate("Arch","pycollada not found, collada support is disabled.\n"))
|
||||
return False
|
||||
else:
|
||||
|
@ -63,7 +63,7 @@ def insert(filename,docname):
|
|||
return
|
||||
try:
|
||||
doc = FreeCAD.getDocument(docname)
|
||||
except:
|
||||
except NameError:
|
||||
doc = FreeCAD.newDocument(docname)
|
||||
FreeCAD.ActiveDocument = doc
|
||||
read(filename)
|
||||
|
|
|
@ -73,7 +73,7 @@ def insert(filename,docname,skip=None):
|
|||
"called when freecad wants to import a file"
|
||||
try:
|
||||
doc = FreeCAD.getDocument(docname)
|
||||
except:
|
||||
except NameError:
|
||||
doc = FreeCAD.newDocument(docname)
|
||||
FreeCAD.ActiveDocument = doc
|
||||
getConfig()
|
||||
|
@ -108,10 +108,10 @@ def getIfcOpenShell():
|
|||
IFCOPENSHELL5 = False
|
||||
try:
|
||||
import IfcImport
|
||||
except:
|
||||
except ImportError:
|
||||
try:
|
||||
import ifc_wrapper as IfcImport
|
||||
except:
|
||||
except ImportError:
|
||||
FreeCAD.Console.PrintMessage(translate("Arch","Couldn't locate IfcOpenShell\n"))
|
||||
return False
|
||||
else:
|
||||
|
@ -937,10 +937,10 @@ def export(exportList,filename):
|
|||
ifcw = None
|
||||
try:
|
||||
import IfcImport as ifcw
|
||||
except:
|
||||
except ImportError:
|
||||
try:
|
||||
import ifc_wrapper as ifcw
|
||||
except:
|
||||
except ImportError:
|
||||
FreeCAD.Console.PrintError(translate("Arch","Error: IfcOpenShell is not installed\n"))
|
||||
print """importIFC: ifcOpenShell is not installed. IFC export is unavailable.
|
||||
Note: IFC export currently requires an experimental version of IfcOpenShell
|
||||
|
|
|
@ -35,7 +35,7 @@ import FreeCAD, FreeCADGui, os, Draft, sys
|
|||
|
||||
try:
|
||||
from PySide import QtCore,QtGui,QtSvg
|
||||
except:
|
||||
except ImportError:
|
||||
FreeCAD.Console.PrintMessage("Error: Python-pyside package must be installed on your system to use the Draft module.")
|
||||
|
||||
class todo:
|
||||
|
|
|
@ -304,12 +304,12 @@ class bsplineTracker(Tracker):
|
|||
# YVH: Added a try to bypass some hazardous situations
|
||||
try:
|
||||
c.interpolate(self.points[:-1], True)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
pass
|
||||
elif self.points:
|
||||
try:
|
||||
c.interpolate(self.points, False)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
pass
|
||||
c = c.toShape()
|
||||
buf=c.writeInventor(2,0.01)
|
||||
|
@ -373,13 +373,13 @@ class bezcurveTracker(Tracker):
|
|||
try:
|
||||
### c.interpolate(self.points[:-1], True) #!!!!!!!!!!!!
|
||||
c.setPoles(self.points[:-1])
|
||||
except:
|
||||
except Part.OCCError:
|
||||
pass
|
||||
elif self.points:
|
||||
try:
|
||||
### c.interpolate(self.points, False) #!!!!!!!
|
||||
c.setPoles(self.points)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
pass
|
||||
c = c.toShape() #???? c = Part.Edge(c)?, c = Part.Wire(c)??
|
||||
buf=c.writeInventor(2,0.01)
|
||||
|
|
|
@ -175,7 +175,7 @@ def insert(filename,docname):
|
|||
"called when freecad wants to import a file"
|
||||
try:
|
||||
doc = FreeCAD.getDocument(docname)
|
||||
except:
|
||||
except NameError:
|
||||
doc = FreeCAD.newDocument(docname)
|
||||
FreeCAD.ActiveDocument = doc
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class ImportWorkbench ( Workbench ):
|
|||
Log ('Loading ImportGui module')
|
||||
import Import
|
||||
import ImportGui
|
||||
except:
|
||||
except ImportError:
|
||||
Err('Cannot load ImportGui')
|
||||
raise
|
||||
def GetIcon(self):
|
||||
|
|
|
@ -68,13 +68,13 @@ class PartDesignWorkbench ( Workbench ):
|
|||
# load the module
|
||||
try:
|
||||
from WizardShaft import WizardShaft
|
||||
except:
|
||||
except ImportError:
|
||||
print "Wizard shaft module cannot be loaded"
|
||||
import PartDesignGui
|
||||
import PartDesign
|
||||
try:
|
||||
import InvoluteGearFeature
|
||||
except:
|
||||
except ImportError:
|
||||
print "Involute gear module cannot be loaded"
|
||||
def GetClassName(self):
|
||||
return "PartDesignGui::Workbench"
|
||||
|
|
|
@ -32,7 +32,7 @@ def compute():
|
|||
c = float(l5.text())*m #standard value 0,1*m - 0,3*m
|
||||
j = float(l6.text())*m #standard value 0,015 - 0,04*m
|
||||
width = float(l7.text()) #gear width
|
||||
except:
|
||||
except ValueError:
|
||||
FreeCAD.Console.PrintError("Wrong input! Only numbers allowed...\n")
|
||||
|
||||
|
||||
|
|
|
@ -78,14 +78,14 @@ def areas(ship, draft, roll=0.0, trim=0.0, yaw=0.0, n=30):
|
|||
p = Vector(-1.5 * L, -1.5 * B, bbox.ZMin)
|
||||
try:
|
||||
box = Part.makeBox(1.5 * L + x, 3.0 * B, -bbox.ZMin, p)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
areas.append([x, area])
|
||||
continue
|
||||
# Compute the common part with ship
|
||||
for s in shape.Solids:
|
||||
try:
|
||||
common = box.common(s)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
continue
|
||||
if common.Volume == 0.0:
|
||||
continue
|
||||
|
@ -93,7 +93,7 @@ def areas(ship, draft, roll=0.0, trim=0.0, yaw=0.0, n=30):
|
|||
# computed desired data we can remove it.
|
||||
try:
|
||||
Part.show(common)
|
||||
except:
|
||||
except App.Base.FreeCADError:
|
||||
continue
|
||||
# Divide the solid by faces and compute only the well placed ones
|
||||
faces = common.Faces
|
||||
|
@ -150,7 +150,7 @@ def displacement(ship, draft, roll=0.0, trim=0.0, yaw=0.0):
|
|||
p = Vector(-1.5*L, -1.5*B, bbox.ZMin - 1.0)
|
||||
try:
|
||||
box = Part.makeBox(3.0*L, 3.0*B, - bbox.ZMin + 1.0, p)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
return [0.0, Vector(), 0.0]
|
||||
|
||||
vol = 0.0
|
||||
|
@ -159,7 +159,7 @@ def displacement(ship, draft, roll=0.0, trim=0.0, yaw=0.0):
|
|||
# Compute the common part of the "sea" with the ship
|
||||
try:
|
||||
common = box.common(solid)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
continue
|
||||
# Get the data
|
||||
vol = vol + common.Volume / Units.Metre.Value**3
|
||||
|
@ -219,13 +219,13 @@ def wettedArea(shape, draft, trim):
|
|||
p = Vector(-1.5 * L, -1.5 * B, bbox.ZMin - 1.0)
|
||||
try:
|
||||
box = Part.makeBox(3.0 * L, 3.0 * B, - bbox.ZMin + 1.0, p)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
return 0.0
|
||||
|
||||
for f in shape.Faces:
|
||||
try:
|
||||
common = box.common(f)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
continue
|
||||
area = area + common.Area
|
||||
return area
|
||||
|
@ -280,7 +280,7 @@ def FloatingArea(ship, draft, trim):
|
|||
p = Vector(-1.5 * L, -1.5 * B, bbox.ZMin - 1.0)
|
||||
try:
|
||||
box = Part.makeBox(3.0 * L, 3.0 * B, - bbox.ZMin + 1.0, p)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
return [area, cf]
|
||||
|
||||
maxX = bbox.XMin / Units.Metre.Value
|
||||
|
@ -290,7 +290,7 @@ def FloatingArea(ship, draft, trim):
|
|||
for s in shape.Solids:
|
||||
try:
|
||||
common = box.common(s)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
continue
|
||||
if common.Volume == 0.0:
|
||||
continue
|
||||
|
@ -298,7 +298,7 @@ def FloatingArea(ship, draft, trim):
|
|||
# performing an internal tesellation doing that
|
||||
try:
|
||||
Part.show(common)
|
||||
except:
|
||||
except (TypeError,Part.OCCError):
|
||||
continue
|
||||
# Divide the solid by faces and filter the well placed ones
|
||||
faces = common.Faces
|
||||
|
@ -377,7 +377,7 @@ def mainFrameCoeff(ship, draft):
|
|||
p = Vector(-1.5 * L, -1.5 * B, bbox.ZMin - 1.0)
|
||||
try:
|
||||
box = Part.makeBox(1.5 * L, 3.0 * B, - bbox.ZMin + 1.0, p)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
return cm
|
||||
|
||||
maxY = bbox.YMin / Units.Metre.Value
|
||||
|
@ -385,7 +385,7 @@ def mainFrameCoeff(ship, draft):
|
|||
for s in shape.Solids:
|
||||
try:
|
||||
common = box.common(s)
|
||||
except:
|
||||
except Part.OCCError:
|
||||
continue
|
||||
if common.Volume == 0.0:
|
||||
continue
|
||||
|
@ -393,7 +393,7 @@ def mainFrameCoeff(ship, draft):
|
|||
# performing an internal tesellation doing that
|
||||
try:
|
||||
Part.show(common)
|
||||
except:
|
||||
except (TypeError,Part.OCCError):
|
||||
continue
|
||||
# Divide the solid by faces and filter the well placed ones
|
||||
faces = common.Faces
|
||||
|
|
|
@ -1047,7 +1047,7 @@ def insert(filename,docname):
|
|||
"called when freecad wants to import a csv file"
|
||||
try:
|
||||
doc = FreeCAD.getDocument(docname)
|
||||
except:
|
||||
except NameError:
|
||||
doc = FreeCAD.newDocument(docname)
|
||||
FreeCAD.ActiveDocument = doc
|
||||
read(filename)
|
||||
|
@ -1069,10 +1069,10 @@ def read(filename):
|
|||
#print "setting ",cl+str(rn)," ",c
|
||||
try:
|
||||
c = int(c)
|
||||
except:
|
||||
except ValueError:
|
||||
try:
|
||||
c = float(c)
|
||||
except:
|
||||
except ValueError:
|
||||
c = str(c)
|
||||
setattr(sp.Proxy,cl+str(rn),c)
|
||||
cn += 1
|
||||
|
|
Loading…
Reference in New Issue
Block a user