Merge pull request #5069 from chennes/lgtmArchMiscFixes
[Arch] Fix LGTM warnings
This commit is contained in:
@@ -531,8 +531,8 @@ class _ViewProviderAxis:
|
||||
pts = re.findall("point \[(.*?)\]",buf)[0]
|
||||
pts = pts.split(",")
|
||||
pc = []
|
||||
for p in pts:
|
||||
v = p.strip().split()
|
||||
for point in pts:
|
||||
v = point.strip().split()
|
||||
pc.append([float(v[0]),float(v[1]),float(v[2])])
|
||||
coords = coin.SoCoordinate3()
|
||||
coords.point.setValues(0,len(pc),pc)
|
||||
|
||||
@@ -416,7 +416,6 @@ def getCutVolume(cutplane,shapes,clip=False,depth=None):
|
||||
bb.add(sh.BoundBox)
|
||||
bb.enlarge(1)
|
||||
# building cutplane space
|
||||
placement = None
|
||||
um = vm = wm = 0
|
||||
try:
|
||||
if hasattr(cutplane,"Shape"):
|
||||
@@ -578,9 +577,8 @@ def meshToShape(obj,mark=True,fast=True,tol=0.001,flat=False,cut=True):
|
||||
|
||||
name = obj.Name
|
||||
if "Mesh" in obj.PropertiesList:
|
||||
faces = []
|
||||
mesh = obj.Mesh
|
||||
plac = obj.Placement
|
||||
#plac = obj.Placement
|
||||
solid = getShapeFromMesh(mesh,fast,tol,flat,cut)
|
||||
if solid:
|
||||
if solid.isClosed() and solid.isValid():
|
||||
@@ -635,7 +633,7 @@ def removeShape(objs,mark=True):
|
||||
v1 = dims[0].multVec(v1)
|
||||
v2 = dims[0].multVec(v2)
|
||||
line = Draft.makeLine(v1,v2)
|
||||
wal = ArchWall.makeWall(line,width=width,height=dims[3],name=name)
|
||||
ArchWall.makeWall(line,width=width,height=dims[3],name=name)
|
||||
else:
|
||||
if mark:
|
||||
obj.ViewObject.ShapeColor = (1.0,0.0,0.0,1.0)
|
||||
@@ -1336,14 +1334,14 @@ def printMessage( message ):
|
||||
if FreeCAD.GuiUp :
|
||||
if sys.version_info.major < 3:
|
||||
message = message.decode("utf8")
|
||||
reply = QtGui.QMessageBox.information( None , "" , message )
|
||||
QtGui.QMessageBox.information( None , "" , message )
|
||||
|
||||
def printWarning( message ):
|
||||
FreeCAD.Console.PrintMessage( message )
|
||||
if FreeCAD.GuiUp :
|
||||
if sys.version_info.major < 3:
|
||||
message = message.decode("utf8")
|
||||
reply = QtGui.QMessageBox.warning( None , "" , message )
|
||||
QtGui.QMessageBox.warning( None , "" , message )
|
||||
|
||||
|
||||
# command definitions ###############################################
|
||||
|
||||
@@ -1060,7 +1060,6 @@ class Component(ArchIFC.IfcProduct):
|
||||
if obj.IfcType.endswith("Standard Case"):
|
||||
return True
|
||||
# Try to guess
|
||||
import ArchIFC
|
||||
if obj.IfcType + " Standard Case" in ArchIFC.IfcTypes:
|
||||
# this type has a standard case
|
||||
if obj.Additions or obj.Subtractions:
|
||||
|
||||
@@ -602,7 +602,7 @@ class ViewProviderCurtainWall(ArchComponent.ViewProviderComponent):
|
||||
colors = []
|
||||
nmullions = obj.VerticalMullionNumber + obj.HorizontalMullionNumber + obj.DiagonalMullionNumber
|
||||
for i,solid in enumerate(obj.Shape.Solids):
|
||||
for f in solid.Faces:
|
||||
for _ in solid.Faces:
|
||||
if i < nmullions:
|
||||
colors.append(basecolor)
|
||||
else:
|
||||
|
||||
@@ -119,7 +119,7 @@ class _CutPlaneTaskPanel:
|
||||
self.linecut=linecut
|
||||
self.plan=None
|
||||
if linecut:
|
||||
self.plan=plan=getPlanWithLine(FreeCADGui.Selection.getSelectionEx()[1].SubObjects[0])
|
||||
self.plan = getPlanWithLine(FreeCADGui.Selection.getSelectionEx()[1].SubObjects[0])
|
||||
else :
|
||||
self.plan = FreeCADGui.Selection.getSelectionEx()[1].SubObjects[0]
|
||||
|
||||
|
||||
@@ -289,7 +289,6 @@ class IfcRoot:
|
||||
QT_TRANSLATE_NOOP("App::Property", "Description of IFC attributes are not yet implemented"))
|
||||
setattr(obj, attribute["name"], attribute["enum_values"])
|
||||
else:
|
||||
import ArchIFCSchema
|
||||
propertyType = "App::" + ArchIFCSchema.IfcTypes[attribute["type"]]["property"]
|
||||
obj.addProperty(propertyType,
|
||||
attribute["name"],
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
|
||||
import FreeCAD
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui, Arch_rc, os
|
||||
import FreeCADGui, os
|
||||
import Arch_rc # Needed for access to icons # lgtm [py/unused_import]
|
||||
from PySide import QtCore, QtGui
|
||||
from DraftTools import translate
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
@@ -537,7 +538,6 @@ class _ArchMaterialTaskPanel:
|
||||
except Exception:
|
||||
self.form.ButtonCode.hide()
|
||||
else:
|
||||
import os
|
||||
self.form.ButtonCode.setIcon(QtGui.QIcon(os.path.join(os.path.dirname(BimClassification.__file__),"icons","BIM_Classification.svg")))
|
||||
if self.obj:
|
||||
if hasattr(self.obj,"Material"):
|
||||
|
||||
@@ -291,7 +291,6 @@ class Nester:
|
||||
nofitpol = []
|
||||
for placed in sheet:
|
||||
pts = []
|
||||
pi = 0
|
||||
for placedvert in self.order(placed[1],right=True):
|
||||
fpts = []
|
||||
for i,rotvert in enumerate(rotverts):
|
||||
|
||||
@@ -183,14 +183,14 @@ class ArchReference:
|
||||
for edge in shape.Edges:
|
||||
found = False
|
||||
for solid in shape.Solids:
|
||||
if found:
|
||||
break
|
||||
for soledge in solid.Edges:
|
||||
if found:
|
||||
break
|
||||
if edge.hashCode() == soledge.hashCode():
|
||||
found = True
|
||||
break
|
||||
if found:
|
||||
break
|
||||
if found:
|
||||
break
|
||||
else:
|
||||
shapes.append(edge)
|
||||
print("solids:",len(shape.Solids),"mattable:",materials)
|
||||
|
||||
@@ -469,8 +469,8 @@ def getSVG(source,
|
||||
hshapes = source.Proxy.shapecache[1]
|
||||
sshapes = source.Proxy.shapecache[2]
|
||||
cutface = source.Proxy.shapecache[3]
|
||||
cutvolume = source.Proxy.shapecache[4]
|
||||
invcutvolume = source.Proxy.shapecache[5]
|
||||
# cutvolume = source.Proxy.shapecache[4] # Unused
|
||||
# invcutvolume = source.Proxy.shapecache[5] # Unused
|
||||
objectSshapes = source.Proxy.shapecache[6]
|
||||
else:
|
||||
if showFill:
|
||||
@@ -638,10 +638,6 @@ def getDXF(obj):
|
||||
return result
|
||||
if not allOn:
|
||||
objs = Draft.removeHidden(objs)
|
||||
# separate spaces and Draft objects
|
||||
spaces = []
|
||||
nonspaces = []
|
||||
drafts = []
|
||||
objs = [o for o in objs if ((not(Draft.getType(o) in ["Space","Dimension","Annotation"])) and (not (o.isDerivedFrom("Part::Part2DObject"))))]
|
||||
vshapes,hshapes,sshapes,cutface,cutvolume,invcutvolume = getCutShapes(objs,cutplane,onlySolids,clip,False,showHidden)
|
||||
if vshapes:
|
||||
|
||||
@@ -232,7 +232,7 @@ def makeSolarDiagram(longitude,latitude,scale=1,complete=False,tz=None):
|
||||
numsep = coin.SoSeparator()
|
||||
pathsep = coin.SoSeparator()
|
||||
hoursep = coin.SoSeparator()
|
||||
hournumsep = coin.SoSeparator()
|
||||
#hournumsep = coin.SoSeparator()
|
||||
mastersep.addChild(circlesep)
|
||||
mastersep.addChild(numsep)
|
||||
mastersep.addChild(pathsep)
|
||||
|
||||
@@ -60,7 +60,6 @@ def makeStairs(baseobj=None,length=None,width=None,height=None,steps=None,name="
|
||||
return
|
||||
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
|
||||
|
||||
bases = []
|
||||
stairs = []
|
||||
additions = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user