diff --git a/backends/checker.py b/backends/checker.py index 3629c2c0..d773b3fc 100644 --- a/backends/checker.py +++ b/backends/checker.py @@ -433,7 +433,7 @@ def __init__(self): def populate(self,repo,dbs): for std,cl,coll in repo.iterstandards(["standard","class","collection"]): - args = dict([ (p,"") for p in cl.parameters.parameters]) + args = dict([(p,"") for p in cl.parameters.parameters]) try: std.labeling.get_nice(args) except: @@ -445,7 +445,7 @@ def populate(self,repo,dbs): self.rows.append(row) for name,cl,coll in repo.iternames(["name","class","collection"]): - args = dict([ (p,"") for p in cl.parameters.parameters]) + args = dict([(p,"") for p in cl.parameters.parameters]) try: name.labeling.get_nice(args) except: diff --git a/backends/freecad/init.py b/backends/freecad/init.py index a808ca7b..322b5564 100644 --- a/backends/freecad/init.py +++ b/backends/freecad/init.py @@ -15,6 +15,7 @@ #License along with this library; if not, write to the Free Software #Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + import FreeCAD, FreeCADGui, Part from os.path import join, exists, dirname from os import listdir @@ -23,6 +24,7 @@ USE_PYSIDE=True + try: from PySide import QtCore from FreeCADGui import getMainWindow @@ -48,6 +50,7 @@ def getMainWindow(): widget = None + def show_widget(): global widget if widget is None: @@ -58,6 +61,7 @@ def show_widget(): else: widget.show() + def make_drawing(scale,obj): doc = FreeCAD.ActiveDocument page = doc.addObject("Drawing::FeaturePage","Page") @@ -78,6 +82,7 @@ def make_drawing(scale,obj): view.Scale = scale page.addObject(view) + def list_names(doc): print("Label Name") print("------------") @@ -85,6 +90,7 @@ def list_names(doc): if isinstance(part,Part.Feature): print("%s %s" % (part.Label, part.Name)) + def add_name(id,in_params=None): name = repo.names[id] cl = repo.class_names.get_src(name) @@ -99,6 +105,7 @@ def add_name(id,in_params=None): coll = repo.collection_classes.get_src(cl) boltsgui.add_part(coll,base,params,FreeCAD.ActiveDocument) + def add_standard(id,in_params=None): standard = repo.standards[id] cl = repo.class_standards.get_src(standard) @@ -113,6 +120,7 @@ def add_standard(id,in_params=None): coll = repo.collection_classes.get_src(cl) boltsgui.add_part(coll,base,params,FreeCAD.ActiveDocument) + def get_free_in_params(cl): base = freecad_db.base_classes.get_src(cl) params = cl.parameters.union(base.parameters) @@ -120,7 +128,7 @@ def get_free_in_params(cl): in_params = {} for p in free_params: - p_type = params.types[p] + # p_type = params.types[p] # not used default_value = params.defaults[p] in_params[p] = default_value return in_params diff --git a/backends/openscad.py b/backends/openscad.py index 52a4347b..d72b2a35 100644 --- a/backends/openscad.py +++ b/backends/openscad.py @@ -323,9 +323,11 @@ def write_classfile(self,fid,cl,module): if std.status == "withdrawn": fid.write('\tBOLTS_warning("The standard %s is withdrawn.' % std.get_id()) if std.replacedby is not None: - fid.write('Although withdrawn standards are often still in use.' + + fid.write( + 'Although withdrawn standards are often still in use.' 'it might be better to use its successor %s instead"' % - (std.standard.get_nice(),std.replacedby)) + (std.standard.get_nice(),std.replacedby) + ) fid.write('");\n') for pname in params.free: fid.write('\tBOLTS_check_parameter_type("%s","%s",%s,"%s");\n' % diff --git a/backends/website/__init__.py b/backends/website/__init__.py index 8dd7885d..f00d9851 100644 --- a/backends/website/__init__.py +++ b/backends/website/__init__.py @@ -32,7 +32,7 @@ app.jinja_env.filters['markdown_docs'] = cms.markdown_docs app.jinja_env.filters['markdown_blog'] = cms.markdown_blog app.jinja_env.globals['gettext_parts'] = translation.gettext_parts -app.jinja_env.globals['gettext_docs'] = translation.gettext_docs +app.jinja_env.globals['gettext_docs'] = translation.gettext_docs @babel.localeselector def get_locale(): @@ -63,7 +63,7 @@ def error_500(e): @app.route("/") @app.route("/index.html") def index(): - page = {"title" : gettext("Home")} + # page = {"title" : gettext("Home")} # not used return render_template("redirect.html", url = url_for("main.index", lang_code=get_locale())) if __name__ == "__main__": diff --git a/backends/website/parts/__init__.py b/backends/website/parts/__init__.py index 142e8cf3..a7c41010 100644 --- a/backends/website/parts/__init__.py +++ b/backends/website/parts/__init__.py @@ -51,7 +51,7 @@ def format_author_prop(author_list): @parts.route('/index.html') def index(): collections = [{'id' : coll.id, 'name' : coll.name} for coll, in repo.itercollections()] - bodies = [ body.body for body, in repo.iterbodies()] + bodies = [body.body for body, in repo.iterbodies()] page = {"title" : "Part list"} return render_template("parts/index.html",page=page,collections=collections,bodies=bodies) diff --git a/backends/website/utils.py b/backends/website/utils.py index aa141baf..215a7757 100644 --- a/backends/website/utils.py +++ b/backends/website/utils.py @@ -66,7 +66,7 @@ def __init__(self,path): self.audiences.add(header["audience"]) - doc["content"] = [ p.replace("%","%%") for p in content.split('\n\n')] + doc["content"] = [p.replace("%","%%") for p in content.split('\n\n')] self.documents.append(doc) self.categories = list(self.categories) diff --git a/bolttools/common.py b/bolttools/common.py index 5bce1962..c707ea19 100644 --- a/bolttools/common.py +++ b/bolttools/common.py @@ -618,7 +618,7 @@ def _normalize_and_check_types(self,types): for char in key: if char in '\\/?*:|"\'<>\t\n\r': raise MalformedTableIndexError(key) - res_type = types[self.result] + # res_type = types[self.result] # not used for key in self.data: #check key for char in key: diff --git a/bolttools/drawings.py b/bolttools/drawings.py index bcb396f1..ef02e8f6 100644 --- a/bolttools/drawings.py +++ b/bolttools/drawings.py @@ -164,7 +164,7 @@ def iterdimdrawings(self,items=["dimdrawing"],**kwargs): for draw in self.dimdrawings: its = {"dimdrawing" : draw} - its["collection"] = self.collection_dimdrawings.get_src(draw); + its["collection"] = self.collection_dimdrawings.get_src(draw) its["classes"] = self.dimdrawing_classes.get_dsts(draw) if filter_iterator_items(its,kwargs): diff --git a/bolttools/openscad.py b/bolttools/openscad.py index 8c8b66e8..34a30690 100644 --- a/bolttools/openscad.py +++ b/bolttools/openscad.py @@ -85,7 +85,7 @@ def __init__(self,repo): #skip directory that is no collection continue try: - base = list(yaml.load_all( open(basefilename,"r","utf8"), Loader=yaml.SafeLoader)) + base = list(yaml.load_all(open(basefilename,"r","utf8"), Loader=yaml.SafeLoader)) # SafeLoader is not implemented in pyyaml < 5.1 except AttributeError: # this is deprecated for newer pyyaml versions diff --git a/freecad/extrusions/profiles.py b/freecad/extrusions/profiles.py index 768e71cd..24e5b7df 100644 --- a/freecad/extrusions/profiles.py +++ b/freecad/extrusions/profiles.py @@ -17,10 +17,11 @@ import math + +import Part +import Arch from FreeCAD import Vector from Part import makeCircle, makeLine -import Part -import Arch from DraftGeomUtils import fillet as draft_fillet @@ -39,10 +40,10 @@ def vslot20x20( (0,0,True, True ,False,False), (0,0,False,True ,True ,False), (0,0,True, False,True ,False), - (0,0,False,False,True ,True ), - (0,0,True, True ,True ,True ), - (0,0,False,True ,False,True ), - (0,0,True, False,False,True ), + (0,0,False,False,True ,True), + (0,0,True, True ,True ,True), + (0,0,False,True ,False,True), + (0,0,True, False,False,True), ] vertices = 8*[vslot_outline] @@ -79,12 +80,12 @@ def vslot20x40( (-w,0,True, True ,False,False), (-w,0,False,True ,True ,False), (-w,0,True, False,True ,False), - (-w,0,False, False,True ,True ), - (-w,0,True, True ,True ,True ), - (-w,0,False, True ,False,True ), - (0,0,True, True ,True ,True ), - (0,0,False, True ,False,True ), - (0,0,True, False,False,True ), + (-w,0,False, False,True ,True), + (-w,0,True, True ,True ,True), + (-w,0,False, True ,False,True), + (0,0,True, True ,True ,True), + (0,0,False, True ,False,True), + (0,0,True, False,False,True), ] vertices = 12*[vslot_outline] @@ -124,14 +125,14 @@ def vslot20x60( (-2*w,0,True, True ,False,False), (-2*w,0,False, True ,True ,False), (-2*w,0,True, False,True ,False), - (-2*w,0,False, False,True ,True ), - (-2*w,0,True, True ,True ,True ), - (-2*w,0,False, True ,False,True ), - (-w,0,True, True ,True ,True ), - (-w,0,False, True ,False,True ), - (0,0,True, True ,True ,True ), - (0,0,False, True ,False,True ), - (0,0,True, False,False,True ), + (-2*w,0,False, False,True ,True), + (-2*w,0,True, True ,True ,True), + (-2*w,0,False, True ,False,True), + (-w,0,True, True ,True ,True), + (-w,0,False, True ,False,True), + (0,0,True, True ,True ,True), + (0,0,False, True ,False,True), + (0,0,True, False,False,True), ] vertices = 16*[vslot_outline] @@ -174,16 +175,16 @@ def vslot20x80( (-3*w,0,True, True ,False,False), (-3*w,0,False, True ,True ,False), (-3*w,0,True, False,True ,False), - (-3*w,0,False, False,True ,True ), - (-3*w,0,True, True ,True ,True ), - (-3*w,0,False, True ,False,True ), - (-2*w,0,True, True ,True ,True ), - (-2*w,0,False, True ,False,True ), - (-w,0,True, True ,True ,True ), - (-w,0,False, True ,False,True ), - (0,0,True, True ,True ,True ), - (0,0,False, True ,False,True ), - (0,0,True, False,False,True ), + (-3*w,0,False, False,True ,True), + (-3*w,0,True, True ,True ,True), + (-3*w,0,False, True ,False,True), + (-2*w,0,True, True ,True ,True), + (-2*w,0,False, True ,False,True), + (-w,0,True, True ,True ,True), + (-w,0,False, True ,False,True), + (0,0,True, True ,True ,True), + (0,0,False, True ,False,True), + (0,0,True, False,False,True), ] vertices = 20*[vslot_outline] @@ -220,10 +221,10 @@ def tslot20x20( (0,0,True, True ,False,False), (0,0,False,True ,True ,False), (0,0,True, False,True ,False), - (0,0,False,False,True ,True ), - (0,0,True, True ,True ,True ), - (0,0,False,True ,False,True ), - (0,0,True, False,False,True ), + (0,0,False,False,True ,True), + (0,0,True, True ,True ,True), + (0,0,False,True ,False,True), + (0,0,True, False,False,True), ] vertices = 8*[tslot_outline] @@ -254,10 +255,10 @@ def tslot20x20_three_slot( (0,0,True, True ,False,False), (0,0,False,True ,True ,False), (0,0,True, False,True ,False), - (0,0,False,False,True ,True ), - (0,0,True, True ,True ,True ), - (0,0,False,True ,False,True ), - (0,0,True, False,False,True ), + (0,0,False,False,True ,True), + (0,0,True, True ,True ,True), + (0,0,False,True ,False,True), + (0,0,True, False,False,True), ] vertices = [tslot_outline] + 2*[tslot_closed] + 5*[tslot_outline] @@ -294,10 +295,10 @@ def tslot20x20_two_slot( (0,0,True, True ,False,False), (0,0,False,True ,True ,False), (0,0,True, False,True ,False), - (0,0,False,False,True ,True ), - (0,0,True, True ,True ,True ), - (0,0,False,True ,False,True ), - (0,0,True, False,False,True ), + (0,0,False,False,True ,True), + (0,0,True, True ,True ,True), + (0,0,False,True ,False,True), + (0,0,True, False,False,True), ] vertices = [tslot_outline] + 4*[tslot_closed] + 3*[tslot_outline] @@ -335,10 +336,10 @@ def tslot20x20_two_slot_opp( (0,0,True, True ,False,False), (0,0,False,True ,True ,False), (0,0,True, False,True ,False), - (0,0,False,False,True ,True ), - (0,0,True, True ,True ,True ), - (0,0,False,True ,False,True ), - (0,0,True, False,False,True ), + (0,0,False,False,True ,True), + (0,0,True, True ,True ,True), + (0,0,False,True ,False,True), + (0,0,True, False,False,True), ] vertices = [tslot_outline] + 2*[tslot_closed] + 2*[tslot_outline]+ 2*[tslot_closed] + [tslot_outline] @@ -376,10 +377,10 @@ def tslot20x20_one_slot( (0,0,True, True ,False,False), (0,0,False,True ,True ,False), (0,0,True, False,True ,False), - (0,0,False,False,True ,True ), - (0,0,True, True ,True ,True ), - (0,0,False,True ,False,True ), - (0,0,True, False,False,True ), + (0,0,False,False,True ,True), + (0,0,True, True ,True ,True), + (0,0,False,True ,False,True), + (0,0,True, False,False,True), ] vertices = [tslot_outline] + 6*[tslot_closed] + [tslot_outline] diff --git a/freecad/extrusions/wheels.py b/freecad/extrusions/wheels.py index c1d44685..a8fcc755 100644 --- a/freecad/extrusions/wheels.py +++ b/freecad/extrusions/wheels.py @@ -67,7 +67,7 @@ def dualvwheel(params,document): part = document.addObject("Part::Feature","BOLTS_part") part.Label = name - part.Shape = Part.Face(Part.Wire(lines)).revolve(Vector(0,0,0),Vector(1,0,0),360).removeSplitter() + part.Shape = Part.Face(Part.Wire(lines)).revolve(Vector(0,0,0),Vector(1,0,0),360).removeSplitter() def solidvwheel(params,document): @@ -113,7 +113,7 @@ def solidvwheel(params,document): part = document.addObject("Part::Feature","BOLTS_part") part.Label = name - part.Shape = Part.Face(Part.Wire(lines)).revolve(Vector(0,0,0),Vector(1,0,0),360).removeSplitter() + part.Shape = Part.Face(Part.Wire(lines)).revolve(Vector(0,0,0),Vector(1,0,0),360).removeSplitter() def minivwheel(params,document): @@ -159,4 +159,4 @@ def minivwheel(params,document): part = document.addObject("Part::Feature","BOLTS_part") part.Label = name - part.Shape = Part.Face(Part.Wire(lines)).revolve(Vector(0,0,0),Vector(1,0,0),360).removeSplitter() + part.Shape = Part.Face(Part.Wire(lines)).revolve(Vector(0,0,0),Vector(1,0,0),360).removeSplitter() diff --git a/freecad/hex/hex.py b/freecad/hex/hex.py index e29fce0e..af758c64 100644 --- a/freecad/hex/hex.py +++ b/freecad/hex/hex.py @@ -39,7 +39,7 @@ def color_face(part,n): def hex1(params,document): - key = params['key'] + # key = params['key'] # not used d1 = params['d1'] k = params['k'] s = params['s'] @@ -75,7 +75,7 @@ def hex1(params,document): def hex2(params,document): - key = params['key'] + # key = params['key'] # not used d1 = params['d1'] k = params['k'] s = params['s'] @@ -83,7 +83,7 @@ def hex2(params,document): b2 = params['b2'] b3 = params['b3'] l = params['l'] - b = b3; + b = b3 if l < 125: b = b1 elif l < 200: diff --git a/freecad/nut/nut.py b/freecad/nut/nut.py index fe7f044a..4818f9b2 100644 --- a/freecad/nut/nut.py +++ b/freecad/nut/nut.py @@ -35,13 +35,13 @@ def color_face(part,n): def nut1(params,document): - key = params['key'] + # key = params['key'] # not used d1 = params['d1'] s = params['s'] m_max = params['m_max'] name = params['name'] - r_fillet = 0.03*s + # r_fillet = 0.03*s # not used ATM part = document.addObject("Part::Feature","BOLTS_part") part.Label = name diff --git a/freecad/profile_c/profile_c.py b/freecad/profile_c/profile_c.py index f987ed99..d44fc3e6 100644 --- a/freecad/profile_c/profile_c.py +++ b/freecad/profile_c/profile_c.py @@ -21,7 +21,7 @@ import Part, Arch def cbeam_parallel_flange(params,document): - key = params['type'] + # key = params['type'] # not used h = params['h'] b = params['b'] tf = params['tf'] diff --git a/freecad/profile_i/profile_i.py b/freecad/profile_i/profile_i.py index e9038bb1..23815eda 100644 --- a/freecad/profile_i/profile_i.py +++ b/freecad/profile_i/profile_i.py @@ -25,7 +25,7 @@ def ibeam_parallel_flange(params,document): - key = params['type'] + # key = params['type'] # not used h = params['h'] b = params['b'] tf = params['tf'] @@ -106,9 +106,9 @@ def ibeam_parallel_flange(params,document): def ibeam_angled_flange(params,document): h = params['h'] b = params['b'] - tf = params['tf'] + # tf = params['tf'] # not used tw = params['tw'] - hw = params ['hw'] + # hw = params ['hw'] # not use f = params ['f'] g = params ['g'] r1 = params ['r1'] diff --git a/freecad/washer/washer.py b/freecad/washer/washer.py index 2db7353c..21ca7710 100644 --- a/freecad/washer/washer.py +++ b/freecad/washer/washer.py @@ -18,7 +18,7 @@ import Part def washer1(params,document): - key = params['key'] + # key = params['key'] # not used d1 = params['d1'] d2 = params['d2'] s = params['s'] @@ -32,7 +32,7 @@ def washer1(params,document): part.Shape = outer.cut(inner).removeSplitter() def washer2(params,document): - key = params['key'] + # key = params['key'] # not used d1 = params['d1'] d2 = params['d2'] s = params['s'] diff --git a/misc/constraints_inp.py b/misc/constraints_inp.py index 390acc00..ec4aa884 100644 --- a/misc/constraints_inp.py +++ b/misc/constraints_inp.py @@ -42,27 +42,27 @@ def constraints(c1,c2,r1,r2,t1,t2,m1,d): dims = { # name b h s t r1 r2 d - "IPN80" : [ 42, 80, 3.9, 5.9, 3.9, 2.3, 59.0 ], - "IPN100" : [ 50, 100, 4.5, 6.8, 4.5, 2.7, 75.7 ], - "IPN120" : [ 58, 120, 5.1, 7.7, 5.1, 3.1, 92.4 ], - "IPN140" : [ 66, 140, 5.7, 8.6, 5.7, 3.4, 109.1], - "IPN160" : [ 74, 160, 6.3, 9.5, 6.3, 3.8, 125.8], - "IPN180" : [ 82, 180, 6.9, 10.4, 6.9, 4.1, 142.4], - "IPN200" : [ 90, 200, 7.5, 11.3, 7.5, 4.5, 159.1], - "IPN220" : [ 98, 220, 8.1, 12.2, 8.1, 4.9, 175.8], - "IPN240" : [ 106, 240, 8.7, 13.1, 8.7, 5.2, 192.5], - "IPN260" : [ 113, 260, 9.4, 14.1, 9.4, 5.6, 208.9], - "IPN280" : [ 119, 280, 10.1, 15.2, 10.1, 6.1, 225.1], - "IPN300" : [ 125, 300, 10.8, 16.2, 10.8, 6.5, 241.6], - "IPN320" : [ 131, 320, 11.5, 17.3, 11.5, 6.9, 257.9], - "IPN340" : [ 137, 340, 12.2, 18.3, 12.2, 7.3, 274.3], - "IPN360" : [ 143, 360, 13.0, 19.5, 13.0, 7.8, 290.0], - "IPN380" : [ 149, 380, 13.7, 20.5, 13.7, 8.2, 306.7], - "IPN400" : [ 155, 400, 14.4, 21.6, 14.4, 8.6, 322.9], - "IPN450" : [ 170, 450, 16.2, 24.3, 16.2, 9.7, 363.6], - "IPN500" : [ 185, 500, 18.0, 27.0, 18.0, 10., 404.38], - "IPN550" : [ 200, 550, 19.0, 30.0, 19.0, 11., 445.69], - "IPN600" : [ 215, 600, 21.6, 32.4, 21.6, 13., 485.80] + "IPN80" : [42, 80, 3.9, 5.9, 3.9, 2.3, 59.0], + "IPN100" : [50, 100, 4.5, 6.8, 4.5, 2.7, 75.7], + "IPN120" : [58, 120, 5.1, 7.7, 5.1, 3.1, 92.4], + "IPN140" : [66, 140, 5.7, 8.6, 5.7, 3.4, 109.1], + "IPN160" : [74, 160, 6.3, 9.5, 6.3, 3.8, 125.8], + "IPN180" : [82, 180, 6.9, 10.4, 6.9, 4.1, 142.4], + "IPN200" : [90, 200, 7.5, 11.3, 7.5, 4.5, 159.1], + "IPN220" : [98, 220, 8.1, 12.2, 8.1, 4.9, 175.8], + "IPN240" : [106, 240, 8.7, 13.1, 8.7, 5.2, 192.5], + "IPN260" : [113, 260, 9.4, 14.1, 9.4, 5.6, 208.9], + "IPN280" : [119, 280, 10.1, 15.2, 10.1, 6.1, 225.1], + "IPN300" : [125, 300, 10.8, 16.2, 10.8, 6.5, 241.6], + "IPN320" : [131, 320, 11.5, 17.3, 11.5, 6.9, 257.9], + "IPN340" : [137, 340, 12.2, 18.3, 12.2, 7.3, 274.3], + "IPN360" : [143, 360, 13.0, 19.5, 13.0, 7.8, 290.0], + "IPN380" : [149, 380, 13.7, 20.5, 13.7, 8.2, 306.7], + "IPN400" : [155, 400, 14.4, 21.6, 14.4, 8.6, 322.9], + "IPN450" : [170, 450, 16.2, 24.3, 16.2, 9.7, 363.6], + "IPN500" : [185, 500, 18.0, 27.0, 18.0, 10., 404.38], + "IPN550" : [200, 550, 19.0, 30.0, 19.0, 11., 445.69], + "IPN600" : [215, 600, 21.6, 32.4, 21.6, 13., 485.80] }