From 8c3bad64e0560806c1dd5ef2b588e75664427eb2 Mon Sep 17 00:00:00 2001 From: Stefan Endres Date: Sun, 13 Dec 2020 20:52:32 +0100 Subject: [PATCH 01/16] Path: Fix #3914: Adding stock label prefix to name comparison in order to select correct existing solid in combo box --- src/Mod/Path/PathScripts/PathJobGui.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathJobGui.py b/src/Mod/Path/PathScripts/PathJobGui.py index a85c437fdf..04547ab85e 100644 --- a/src/Mod/Path/PathScripts/PathJobGui.py +++ b/src/Mod/Path/PathScripts/PathJobGui.py @@ -519,6 +519,7 @@ class StockCreateCylinderEdit(StockEdit): class StockFromExistingEdit(StockEdit): Index = 3 StockType = PathStock.StockType.Unknown + StockLabelPrefix = 'Stock' def editorFrame(self): return self.form.stockFromExisting @@ -527,7 +528,7 @@ class StockFromExistingEdit(StockEdit): stock = self.form.stockExisting.itemData(self.form.stockExisting.currentIndex()) if not (hasattr(obj.Stock, 'Objects') and len(obj.Stock.Objects) == 1 and obj.Stock.Objects[0] == stock): if stock: - stock = PathJob.createResourceClone(obj, stock, 'Stock', 'Stock') + stock = PathJob.createResourceClone(obj, stock, self.StockLabelPrefix , 'Stock') stock.ViewObject.Visibility = True PathStock.SetupStockObject(stock, PathStock.StockType.Unknown) stock.Proxy.execute(stock) @@ -553,7 +554,9 @@ class StockFromExistingEdit(StockEdit): index = -1 for i, solid in enumerate(self.candidates(obj)): self.form.stockExisting.addItem(solid.Label, solid) - if solid.Label == stockName: + label="%s-%s" % (self.StockLabelPrefix,solid.Label) + + if label == stockName: index = i self.form.stockExisting.setCurrentIndex(index if index != -1 else 0) From 3df9d07e6eab2cda599ce72934a1a388478b3167 Mon Sep 17 00:00:00 2001 From: gauna85 <61654541+gauna85@users.noreply.github.com> Date: Tue, 15 Dec 2020 19:35:29 +0100 Subject: [PATCH 02/16] Update src/Mod/Path/PathScripts/PathJobGui.py Co-authored-by: sliptonic --- src/Mod/Path/PathScripts/PathJobGui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Path/PathScripts/PathJobGui.py b/src/Mod/Path/PathScripts/PathJobGui.py index 04547ab85e..ade073016d 100644 --- a/src/Mod/Path/PathScripts/PathJobGui.py +++ b/src/Mod/Path/PathScripts/PathJobGui.py @@ -554,7 +554,7 @@ class StockFromExistingEdit(StockEdit): index = -1 for i, solid in enumerate(self.candidates(obj)): self.form.stockExisting.addItem(solid.Label, solid) - label="%s-%s" % (self.StockLabelPrefix,solid.Label) + label="{}-{}".format(self.StockLabelPrefix, solid.Label) if label == stockName: index = i From ab8a4a62a92b9cc3d112fb338abd6981caa7cf13 Mon Sep 17 00:00:00 2001 From: Keilin Bickar Date: Sun, 17 Jan 2021 22:04:26 -0500 Subject: [PATCH 03/16] Fix AttributeError on deleting corrupt dressup --- src/Mod/Path/PathScripts/PathDressupTagGui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Path/PathScripts/PathDressupTagGui.py b/src/Mod/Path/PathScripts/PathDressupTagGui.py index 0a6c01dc6b..0a95156c2d 100644 --- a/src/Mod/Path/PathScripts/PathDressupTagGui.py +++ b/src/Mod/Path/PathScripts/PathDressupTagGui.py @@ -418,7 +418,7 @@ class PathDressupTagViewProvider: '''this makes sure that the base operation is added back to the job and visible''' # pylint: disable=unused-argument PathLog.track() - if self.obj.Base.ViewObject: + if self.obj.Base and self.obj.Base.ViewObject: self.obj.Base.ViewObject.Visibility = True job = PathUtils.findParentJob(self.obj) if arg1.Object and arg1.Object.Base and job: From 6a07fb6237c57e96ab01927471ea98feb7e930b6 Mon Sep 17 00:00:00 2001 From: Tyler Colbert Date: Tue, 19 Jan 2021 13:25:00 -0700 Subject: [PATCH 04/16] [PATH] First pass at a post processor for Fanuc controllers --- src/Mod/Path/PathScripts/post/fanuc_post.py | 513 ++++++++++++++++++++ 1 file changed, 513 insertions(+) create mode 100644 src/Mod/Path/PathScripts/post/fanuc_post.py diff --git a/src/Mod/Path/PathScripts/post/fanuc_post.py b/src/Mod/Path/PathScripts/post/fanuc_post.py new file mode 100644 index 0000000000..d2bb6acb0e --- /dev/null +++ b/src/Mod/Path/PathScripts/post/fanuc_post.py @@ -0,0 +1,513 @@ +# *************************************************************************** +# * Copyright (c) 2014 sliptonic * +# * Copyright (c) 2021 shadowbane1000 * +# * * +# * This file is part of the FreeCAD CAx development system. * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * FreeCAD is distributed in the hope that it will be useful, * +# * but WITHOUT ANY WARRANTY; without even the implied warranty of * +# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +# * GNU Lesser General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with FreeCAD; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# ***************************************************************************/ +from __future__ import print_function +import FreeCAD +from FreeCAD import Units +import Path +import argparse +import datetime +import shlex +import os.path +from PathScripts import PostUtils +from PathScripts import PathUtils + +TOOLTIP = ''' +This is a postprocessor file for the Path workbench. It is used to +take a pseudo-gcode fragment outputted by a Path object, and output +real GCode suitable should be suitable for most Fanuc controllers. +It has only been tested on a 21i-MB controller on a 3 axis mill. +This postprocessor, once placed in the appropriate PathScripts folder, +can be used directly from inside FreeCAD, via the GUI importer or via +python scripts with: + +import fanuc_post +fanuc_post.export(object,"/path/to/file.ncc","") +''' + +now = datetime.datetime.now() + +parser = argparse.ArgumentParser(prog='fanuc', add_help=False) +parser.add_argument('--no-header', action='store_true', help='suppress header output') +parser.add_argument('--no-comments', action='store_true', help='suppress comment output') +parser.add_argument('--line-numbers', action='store_true', help='prefix with line numbers') +parser.add_argument('--no-show-editor', action='store_true', help='don\'t pop up editor before writing output') +parser.add_argument('--precision', default='3', help='number of digits of precision, default=3') +parser.add_argument('--preamble', help='set commands to be issued before the first command, default="G17\nG90"') +parser.add_argument('--postamble', help='set commands to be issued after the last command, default="M05\nG17 G90\nM2"') +parser.add_argument('--inches', action='store_true', help='Convert output for US imperial mode (G20)') +parser.add_argument('--no-modal', action='store_true', help='Don\'t output the Same G-command Name USE NonModal Mode') +parser.add_argument('--no-axis-modal', action='store_true', help='Don\'t output the Same Axis Value Mode') +parser.add_argument('--no-tlo', action='store_true', help='suppress tool length offset (G43) following tool changes') + +TOOLTIP_ARGS = parser.format_help() + +# These globals set common customization preferences +OUTPUT_COMMENTS = True +OUTPUT_HEADER = True +OUTPUT_LINE_NUMBERS = False +SHOW_EDITOR = True +MODAL = True # if true commands are suppressed if the same as previous line. +USE_TLO = True # if true G43 will be output following tool changes +OUTPUT_DOUBLES = False # if false duplicate axis values are suppressed if the same as previous line. +COMMAND_SPACE = " " +LINENR = 100 # line number starting value + +# These globals will be reflected in the Machine configuration of the project +UNITS = "G21" # G21 for metric, G20 for us standard +UNIT_SPEED_FORMAT = 'mm/min' +UNIT_FORMAT = 'mm' + +MACHINE_NAME = "fanuc" +CORNER_MIN = {'x': 0, 'y': 0, 'z': 0} +CORNER_MAX = {'x': 500, 'y': 300, 'z': 300} +PRECISION = 3 + +# this global is used to pass spindle speed from the tool command into the machining command for +# rigid tapping. +tapSpeed = 0 + +# Preamble text will appear at the beginning of the GCODE output file. +PREAMBLE = '''G17 G54 G40 G49 G80 G90 +''' + +# Postamble text will appear following the last operation. +POSTAMBLE = '''M05 +G17 G54 G90 G80 G40 +M6 T0 +M2 +''' + +# Pre operation text will be inserted before every operation +PRE_OPERATION = '''''' + +# Post operation text will be inserted after every operation +POST_OPERATION = '''''' + +# Tool Change commands will be inserted before a tool change +TOOL_CHANGE = '''''' + +# to distinguish python built-in open function from the one declared below +if open.__module__ in ['__builtin__','io']: + pythonopen = open + + +def processArguments(argstring): + # pylint: disable=global-statement + global OUTPUT_HEADER + global OUTPUT_COMMENTS + global OUTPUT_LINE_NUMBERS + global SHOW_EDITOR + global PRECISION + global PREAMBLE + global POSTAMBLE + global UNITS + global UNIT_SPEED_FORMAT + global UNIT_FORMAT + global MODAL + global USE_TLO + global OUTPUT_DOUBLES + + try: + args = parser.parse_args(shlex.split(argstring)) + if args.no_header: + OUTPUT_HEADER = False + if args.no_comments: + OUTPUT_COMMENTS = False + if args.line_numbers: + OUTPUT_LINE_NUMBERS = True + if args.no_show_editor: + SHOW_EDITOR = False + print("Show editor = %d" % SHOW_EDITOR) + PRECISION = args.precision + if args.preamble is not None: + PREAMBLE = args.preamble + if args.postamble is not None: + POSTAMBLE = args.postamble + if args.inches: + UNITS = 'G20' + UNIT_SPEED_FORMAT = 'in/min' + UNIT_FORMAT = 'in' + PRECISION = 4 + if args.no_modal: + MODAL = False + if args.no_tlo: + USE_TLO = False + if args.no_axis_modal: + OUTPUT_DOUBLES = true + + except Exception: # pylint: disable=broad-except + return False + + return True + + +def export(objectslist, filename, argstring): + # pylint: disable=global-statement + if not processArguments(argstring): + return None + global UNITS + global UNIT_FORMAT + global UNIT_SPEED_FORMAT + global HORIZRAPID + global VERTRAPID + + for obj in objectslist: + if not hasattr(obj, "Path"): + print("the object " + obj.Name + " is not a path. Please select only path and Compounds.") + return None + + print("postprocessing...") + gcode = "" + + # write header + if OUTPUT_HEADER: + gcode += "%\n" + gcode += ";\n" + gcode += os.path.split(filename)[-1]+" ("+"FREECAD-FILENAME-GOES-HERE" + ", " + "JOB-NAME-GOES-HERE"+")\n" + gcode += linenumber() + "("+filename.upper()+",EXPORTED BY FREECAD!)\n" + gcode += linenumber() + "(POST PROCESSOR: " + __name__.upper() + ")\n" + gcode += linenumber() + "(OUTPUT TIME:" + str(now).upper() + ")\n" + + # Write the preamble + if OUTPUT_COMMENTS: + gcode += linenumber() + "(BEGIN PREAMBLE)\n" + for line in PREAMBLE.splitlines(False): + gcode += linenumber() + line + "\n" + gcode += linenumber() + UNITS + "\n" + + for obj in objectslist: + + # Skip inactive operations + if hasattr(obj, 'Active'): + if not obj.Active: + continue + if hasattr(obj, 'Base') and hasattr(obj.Base, 'Active'): + if not obj.Base.Active: + continue + + # fetch machine details + job = PathUtils.findParentJob(obj) + + myMachine = 'not set' + + if hasattr(job, "MachineName"): + myMachine = job.MachineName + + if hasattr(job, "MachineUnits"): + if job.MachineUnits == "Metric": + UNITS = "G21" + UNIT_FORMAT = 'mm' + UNIT_SPEED_FORMAT = 'mm/min' + else: + UNITS = "G20" + UNIT_FORMAT = 'in' + UNIT_SPEED_FORMAT = 'in/min' + + if hasattr(job, "SetupSheet"): + if hasattr(job.SetupSheet, "HorizRapid"): + HORIZRAPID = Units.Quantity(job.SetupSheet.HorizRapid, FreeCAD.Units.Velocity) + if hasattr(job.SetupSheet, "VertRapid"): + VERTRAPID = Units.Quantity(job.SetupSheet.HorizRapid, FreeCAD.Units.Velocity) + + # do the pre_op + if OUTPUT_COMMENTS: + gcode += linenumber() + "(BEGIN OPERATION: %s)\n" % obj.Label.upper() + gcode += linenumber() + "(MACHINE: %s, %s)\n" % (myMachine.upper(), UNIT_SPEED_FORMAT.upper()) + for line in PRE_OPERATION.splitlines(True): + gcode += linenumber() + line + + # get coolant mode + coolantMode = 'None' + if hasattr(obj, "CoolantMode") or hasattr(obj, 'Base') and hasattr(obj.Base, "CoolantMode"): + if hasattr(obj, "CoolantMode"): + coolantMode = obj.CoolantMode + else: + coolantMode = obj.Base.CoolantMode + + # turn coolant on if required + if OUTPUT_COMMENTS: + if not coolantMode == 'None': + gcode += linenumber() + '(COOLANT ON:' + coolantMode.upper() + ')\n' + if coolantMode == 'Flood': + gcode += linenumber() + 'M8' + '\n' + if coolantMode == 'Mist': + gcode += linenumber() + 'M7' + '\n' + + # process the operation gcode + gcode += parse(obj) + + # do the post_op + if OUTPUT_COMMENTS: + gcode += linenumber() + "(FINISH OPERATION: %s)\n" % obj.Label.upper() + for line in POST_OPERATION.splitlines(True): + gcode += linenumber() + line + + # turn coolant off if required + if not coolantMode == 'None': + if OUTPUT_COMMENTS: + gcode += linenumber() + '(COOLANT OFF:' + coolantMode.upper() + ')\n' + gcode += linenumber() +'M9' + '\n' + + # do the post_amble + if OUTPUT_COMMENTS: + gcode += "(BEGIN POSTAMBLE)\n" + for line in POSTAMBLE.splitlines(True): + gcode += linenumber() + line + gcode += "%\n" + + if FreeCAD.GuiUp and SHOW_EDITOR: + dia = PostUtils.GCodeEditorDialog() + dia.editor.setText(gcode) + result = dia.exec_() + if result: + final = dia.editor.toPlainText() + else: + final = gcode + else: + final = gcode + + print("done postprocessing.") + + if not filename == '-': + gfile = pythonopen(filename, "w") + gfile.write(final) + gfile.close() + + return final + + +def linenumber(): + # pylint: disable=global-statement + global LINENR + if OUTPUT_LINE_NUMBERS is True: + LINENR += 10 + return "N" + str(LINENR) + " " + return "" + + +def parse(pathobj): + # pylint: disable=global-statement + global PRECISION + global MODAL + global OUTPUT_DOUBLES + global UNIT_FORMAT + global UNIT_SPEED_FORMAT + global tapSpeed + + out = "" + lastcommand = None + precision_string = '.' + str(PRECISION) + 'f' + currLocation = {} # keep track for no doubles + print("Startup!") + + # the order of parameters + # arcs need work. original code from mach3_4 doesn't want K properties on XY plane. Not sure + # what fanuc does here. + params = ['X', 'Y', 'Z', 'A', 'B', 'C', 'I', 'J', 'F', 'S', 'T', 'Q', 'R', 'L', 'H', 'D', 'P'] + firstmove = Path.Command("G0", {"X": -1, "Y": -1, "Z": -1, "F": 0.0}) + currLocation.update(firstmove.Parameters) # set First location Parameters + + if hasattr(pathobj, "Group"): # We have a compound or project. + # if OUTPUT_COMMENTS: + # out += linenumber() + "(compound: " + pathobj.Label + ")\n" + for p in pathobj.Group: + out += parse(p) + return out + else: # parsing simple path + + # groups might contain non-path things like stock. + if not hasattr(pathobj, "Path"): + return out + + # if OUTPUT_COMMENTS: + # out += linenumber() + "(" + pathobj.Label + ")\n" + + adaptiveOp = False + opHorizRapid = 0 + opVertRapid = 0 + + if 'Adaptive' in pathobj.Name: + adaptiveOp = True + if hasattr(pathobj, 'ToolController'): + if hasattr(pathobj.ToolController, 'HorizRapid') and pathobj.ToolController.HorizRapid > 0: + opHorizRapid = Units.Quantity(pathobj.ToolController.HorizRapid, FreeCAD.Units.Velocity) + else: + FreeCAD.Console.PrintWarning('Tool Controller Horizontal Rapid Values are unset'+ '\n') + + if hasattr(pathobj.ToolController, 'VertRapid') and pathobj.ToolController.VertRapid > 0: + opVertRapid = Units.Quantity(pathobj.ToolController.VertRapid, FreeCAD.Units.Velocity) + else: + FreeCAD.Console.PrintWarning('Tool Controller Vertical Rapid Values are unset'+ '\n') + + for index,c in enumerate(pathobj.Path.Commands): + + outstring = [] + command = c.Name + if index+1 == len(pathobj.Path.Commands): + nextcommand = "" + else: + nextcommand = pathobj.Path.Commands[index+1].Name + + if adaptiveOp and c.Name in ["G0", "G00"]: + if opHorizRapid and opVertRapid: + command = 'G1' + else: + outstring.append('(TOOL CONTROLLER RAPID VALUES ARE UNSET)' + '\n') + + # suppress moves in fixture selection + if pathobj.Label == "Fixture": + if command == "G0": + continue + + # if it's a tap, we rigid tap, so don't start the spindle yet... + if command == "M03" or command == "M3": + if pathobj.Tool.ToolType == "Tap": + tapSpeed = int(pathobj.SpindleSpeed) + continue + + # convert drill cycles to tap cycles if tool is a tap + if command == "G81" or command == "G83": + if hasattr(pathobj, 'ToolController') and pathobj.ToolController.Tool.ToolType == "Tap": + command = "G84" + out += linenumber() + "G95\n" + paramstring = "" + for param in [ "X", "Y" ]: + if param in c.Parameters: + if (not OUTPUT_DOUBLES) and (param in currLocation) and (currLocation[param] == c.Parameters[param]): + continue + else: + pos = Units.Quantity(c.Parameters[param], FreeCAD.Units.Length) + paramstring += " " + param + format(float(pos.getValueAs(UNIT_FORMAT)), precision_string) + if paramstring != "": + out += linenumber() + "G00"+paramstring+"\n" + + if "S" in c.Parameters: + tapSpeed = int(c.Parameters['S']) + out += "M29 S"+str(tapSpeed)+"\n" + + for param in [ "Z", "R" ]: + if param in c.Parameters: + if (not OUTPUT_DOUBLES) and (param in currLocation) and (currLocation[param] == c.Parameters[param]): + continue + else: + pos = Units.Quantity(c.Parameters[param], FreeCAD.Units.Length) + paramstring += " " + param + format(float(pos.getValueAs(UNIT_FORMAT)), precision_string) + # in this mode, F is the distance per revolution of the thread (pitch) + # P is the dwell time in seconds at the bottom of the thread + # Q is the peck depth of the threading operation + for param in [ "F", "P", "Q" ]: + if param in c.Parameters: + value = Units.Quantity(c.Parameters[param], FreeCAD.Units.Length) + paramstring += " " + param + format(float(value.getValueAs(UNIT_FORMAT)), precision_string) + + out += linenumber() + "G84" + paramstring + "\n" + out += linenumber() + "G80\n" + out += linenumber() + "G94\n" + continue + + + outstring.append(command) + + # if modal: suppress the command if it is the same as the last one + if MODAL is True: + if command == lastcommand: + outstring.pop(0) + + # suppress a G80 between two identical command + if command == "G80" and lastcommand == nextcommand: + continue + + if c.Name[0] == '(' and not OUTPUT_COMMENTS: # command is a comment + continue + + # Now add the remaining parameters in order + for param in params: + if param in c.Parameters: + if param == 'F' and (currLocation[param] != c.Parameters[param] or OUTPUT_DOUBLES): + if c.Name not in ["G0", "G00"]: # fanuc doesn't use rapid speeds + speed = Units.Quantity(c.Parameters['F'], FreeCAD.Units.Velocity) + if speed.getValueAs(UNIT_SPEED_FORMAT) > 0.0: + outstring.append(param + format(float(speed.getValueAs(UNIT_SPEED_FORMAT)), precision_string)) + else: + continue + elif param == 'T': + outstring.append(param + str(int(c.Parameters['T']))) + elif param == 'H': + outstring.append(param + str(int(c.Parameters['H']))) + elif param == 'D': + outstring.append(param + str(int(c.Parameters['D']))) + elif param == 'S': + outstring.append(param + str(int(c.Parameters['S']))) + currentSpeed = int(c.Parameters['S']) + else: + if (not OUTPUT_DOUBLES) and (param in currLocation) and (currLocation[param] == c.Parameters[param]): + continue + else: + pos = Units.Quantity(c.Parameters[param], FreeCAD.Units.Length) + outstring.append( + param + format(float(pos.getValueAs(UNIT_FORMAT)), precision_string)) + + if adaptiveOp and c.Name in ["G0", "G00"]: + if opHorizRapid and opVertRapid: + if 'Z' not in c.Parameters: + outstring.append('F' + format(float(opHorizRapid.getValueAs(UNIT_SPEED_FORMAT)), precision_string)) + else: + outstring.append('F' + format(float(opVertRapid.getValueAs(UNIT_SPEED_FORMAT)), precision_string)) + + # store the latest command + lastcommand = command + currLocation.update(c.Parameters) + + # Check for Tool Change: + if command == 'M6': + # stop the spindle + currentSpeed = 0 + out += linenumber() + "M5\n" + for line in TOOL_CHANGE.splitlines(True): + out += linenumber() + line + + # add height offset + if USE_TLO: + tool_height = '\nG43 H' + str(int(c.Parameters['T'])) + outstring.append(tool_height) + + if command == "message": + if OUTPUT_COMMENTS is False: + out = [] + else: + outstring.pop(0) # remove the command + + # prepend a line number and append a newline + if len(outstring) >= 1: + if OUTPUT_LINE_NUMBERS: + outstring.insert(0, (linenumber())) + + # append the line to the final output + for w in outstring: + out += w.upper() + COMMAND_SPACE + out = out.strip() + "\n" + + return out + +# print(__name__ + " gcode postprocessor loaded.") From 74d5c0a88a74c733d0a10d6ee1f389c7b90fa549 Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Mon, 25 Jan 2021 15:33:36 +0100 Subject: [PATCH 05/16] [Draft] Fix snap to center of faces of solids The code would only find a center snap on the face with index=0 of solids. In V0.19 Part.getShape was introduced (line 399). But not all consequences were not fully implemented. In the '# we are snapping to an edge' section (line 411) the code could be cleaned up. There is no need to check if the index of the edge is correct for the parent object since we are no longer dealing with a parent object. That portion was effectively dead code. The '# we are snapping to a face' section (line 429 in the revised code) has been modified accordingly, which fixes the bug. Forum discussion: https://forum.freecadweb.org/viewtopic.php?f=23&t=54747 --- src/Mod/Draft/draftguitools/gui_snapper.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Mod/Draft/draftguitools/gui_snapper.py b/src/Mod/Draft/draftguitools/gui_snapper.py index 71692219ac..bd880e6030 100644 --- a/src/Mod/Draft/draftguitools/gui_snapper.py +++ b/src/Mod/Draft/draftguitools/gui_snapper.py @@ -410,14 +410,8 @@ class Snapper: if (not self.maxEdges) or (len(shape.Edges) <= self.maxEdges): if "Edge" in comp: # we are snapping to an edge - edge = None if shape.ShapeType == "Edge": edge = shape - else: - en = int(comp[4:])-1 - if len(shape.Edges) > en: - edge = shape.Edges[en] - if edge: snaps.extend(self.snapToEndpoints(edge)) snaps.extend(self.snapToMidpoint(edge)) snaps.extend(self.snapToPerpendicular(edge, lastpoint)) @@ -433,9 +427,9 @@ class Snapper: # extra ellipse options snaps.extend(self.snapToCenter(edge)) elif "Face" in comp: - en = int(comp[4:])-1 - if len(shape.Faces) > en: - face = shape.Faces[en] + # we are snapping to a face + if shape.ShapeType == "Face": + face = shape snaps.extend(self.snapToFace(face)) elif "Vertex" in comp: # directly snapped to a vertex From 69547e280016a41805cbeccc310f3a8028b9d592 Mon Sep 17 00:00:00 2001 From: bitacovir Date: Mon, 25 Jan 2021 16:23:54 -0300 Subject: [PATCH 06/16] [UI] Replace SVG icons for Surface WB commands --- src/Mod/Surface/Gui/Command.cpp | 4 +- src/Mod/Surface/Gui/Resources/Surface.qrc | 3 +- .../icons/Surface_BSplineSurface.svg | 2257 +------ .../Resources/icons/Surface_BezierSurface.svg | 2453 +------ .../Resources/icons/Surface_CurveOnMesh.svg | 2242 +------ .../Gui/Resources/icons/Surface_Cut.svg | 3795 +---------- .../Gui/Resources/icons/Surface_Extend.svg | 5767 ----------------- .../Resources/icons/Surface_ExtendFace.svg | 211 + .../Gui/Resources/icons/Surface_Filling.svg | 2013 +----- .../icons/Surface_GeomFillSurface.svg | 171 + .../Gui/Resources/icons/Surface_Sections.svg | 2988 +-------- .../Gui/Resources/icons/Surface_Sewing.svg | 1953 +----- .../Gui/Resources/icons/Surface_Surface.svg | 1810 +----- .../Gui/Resources/icons/Surface_Workbench.svg | 1826 +----- 14 files changed, 1408 insertions(+), 26085 deletions(-) delete mode 100644 src/Mod/Surface/Gui/Resources/icons/Surface_Extend.svg create mode 100644 src/Mod/Surface/Gui/Resources/icons/Surface_ExtendFace.svg create mode 100644 src/Mod/Surface/Gui/Resources/icons/Surface_GeomFillSurface.svg diff --git a/src/Mod/Surface/Gui/Command.cpp b/src/Mod/Surface/Gui/Command.cpp index abc31b9b23..705a6a822f 100644 --- a/src/Mod/Surface/Gui/Command.cpp +++ b/src/Mod/Surface/Gui/Command.cpp @@ -171,7 +171,7 @@ CmdSurfaceGeomFillSurface::CmdSurfaceGeomFillSurface() sToolTipText = QT_TR_NOOP("Creates a surface from two, three or four boundary edges."); sWhatsThis = "Surface_GeomFillSurface"; sStatusTip = sToolTipText; - sPixmap = "Surface_BSplineSurface"; + sPixmap = "Surface_GeomFillSurface"; } bool CmdSurfaceGeomFillSurface::isActive(void) @@ -237,7 +237,7 @@ CmdSurfaceExtendFace::CmdSurfaceExtendFace() "with its local U and V parameters."); sWhatsThis = "Surface_ExtendFace"; sStatusTip = sToolTipText; - sPixmap = "Surface_Extend"; + sPixmap = "Surface_ExtendFace"; } void CmdSurfaceExtendFace::activated(int) diff --git a/src/Mod/Surface/Gui/Resources/Surface.qrc b/src/Mod/Surface/Gui/Resources/Surface.qrc index c09283aa91..7af306fa62 100644 --- a/src/Mod/Surface/Gui/Resources/Surface.qrc +++ b/src/Mod/Surface/Gui/Resources/Surface.qrc @@ -4,8 +4,9 @@ icons/Surface_BSplineSurface.svg icons/Surface_CurveOnMesh.svg icons/Surface_Cut.svg - icons/Surface_Extend.svg + icons/Surface_ExtendFace.svg icons/Surface_Filling.svg + icons/Surface_GeomFillSurface.svg icons/Surface_Sections.svg icons/Surface_Sewing.svg icons/Surface_Surface.svg diff --git a/src/Mod/Surface/Gui/Resources/icons/Surface_BSplineSurface.svg b/src/Mod/Surface/Gui/Resources/icons/Surface_BSplineSurface.svg index 3e9b34bee4..a2644e009c 100644 --- a/src/Mod/Surface/Gui/Resources/icons/Surface_BSplineSurface.svg +++ b/src/Mod/Surface/Gui/Resources/icons/Surface_BSplineSurface.svg @@ -7,2106 +7,111 @@ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" - id="svg3364" + id="svg2985" height="64px" width="64px"> Surface_BSplineSurface + id="title889">Surface_BSplineSurface + id="defs2987"> + id="linearGradient4387"> - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + r="19.467436" + fy="28.869568" + fx="45.883327" + cy="28.869568" + cx="45.883327" + id="radialGradient3692" + xlink:href="#linearGradient3377" /> + id="linearGradient3377"> + id="stop3379" /> + id="stop3381" /> + id="linearGradient3377-3"> + id="stop3379-8" /> + id="stop3381-3" /> + r="19.467436" + fy="28.869568" + fx="45.883327" + cy="28.869568" + cx="45.883327" + gradientTransform="matrix(0.67067175,0,0,0.64145918,-63.380792,0.83845403)" + gradientUnits="userSpaceOnUse" + id="radialGradient6412" + xlink:href="#linearGradient3377-3" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="linearGradient3036"> + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + id="metadata2990"> @@ -2114,127 +119,75 @@ Surface_BSplineSurface - 2017-04-17 - Nate Miller + [bitacovir] - - - CC-BY-SA 4.0 - - + Part_Shape_from_Mesh + 2020/10/03 + http://www.freecadweb.org/wiki/index.php?title=Artwork FreeCAD - FreeCAD/src/Mod/Surface/Gui/Resources/icons/Surface_BSplineSurface.svg - http://www.freecadweb.org/wiki/index.php?title=Artwork - A purple curved surface that has a thick, red, highlighted edge. This edge has three vertices indicated as circles as if it was a multipoint spline. It is based on the 'Surface' icon. + + + + FreeCAD LGPL2+ + + + https://www.gnu.org/copyleft/lesser.html - [vocx] + - surface - curve - spline - points + - - - - - - - - - + d="M 13.816245,52.162367 C 28.338105,17.330258 44.796216,62.805512 56.413699,28.940961" + style="fill:none;stroke:#fce94f;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - - - - - - - - - - - - + id="path3820-1-9-6" + d="M 5.4725393,24.503343 13.365603,45.716252 C 30.88904,17.984227 44.167745,56.981787 53.473496,28.274182 L 39.51487,7.9294358 C 31.707324,28.541126 16.157527,5.2639846 5.4725393,24.503343 Z" + style="display:inline;fill:none;fill-opacity:1;stroke:#729fcf;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + + + diff --git a/src/Mod/Surface/Gui/Resources/icons/Surface_BezierSurface.svg b/src/Mod/Surface/Gui/Resources/icons/Surface_BezierSurface.svg index d6abc7b517..d5179839bc 100644 --- a/src/Mod/Surface/Gui/Resources/icons/Surface_BezierSurface.svg +++ b/src/Mod/Surface/Gui/Resources/icons/Surface_BezierSurface.svg @@ -6,2307 +6,112 @@ xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" - width="64px" + version="1.1" + id="svg2985" height="64px" - id="svg3364" - version="1.1"> + width="64px"> Surface_BezierSurface + id="title889">Surface_BezierSurface + id="defs2987"> + id="linearGradient4387"> - - - - - - + + + + - + r="19.467436" + fy="28.869568" + fx="45.883327" + cy="28.869568" + cx="45.883327" + id="radialGradient3692" + xlink:href="#linearGradient3377" /> + id="linearGradient3377"> + id="stop3379" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="stop3381" /> + id="linearGradient3377-3"> + id="stop3379-8" /> + id="stop3381-3" /> + r="19.467436" + fy="28.869568" + fx="45.883327" + cy="28.869568" + cx="45.883327" + gradientTransform="matrix(0.67067175,0,0,0.64145918,-63.380792,0.83845403)" + gradientUnits="userSpaceOnUse" + id="radialGradient6412" + xlink:href="#linearGradient3377-3" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="linearGradient3036"> + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + id="metadata2990"> @@ -2314,109 +119,91 @@ Surface_BezierSurface - - 2017-04-17 - Nate Miller + [bitacovir] - - - CC-BY-SA 4.0 - - + Part_Shape_from_Mesh + 2020/10/03 + http://www.freecadweb.org/wiki/index.php?title=Artwork FreeCAD - FreeCAD/src/Mod/Surface/Gui/Resources/icons/Surface_BezierSurface.svg - http://www.freecadweb.org/wiki/index.php?title=Artwork - A purple curved surface, with one thick, red highlighted edge. The endpoints of this edge are marked with squares, which are tied to handles indicating control points for a bezier curve. It is based on the 'Surface' icon. + + + + FreeCAD LGPL2+ + + + https://www.gnu.org/copyleft/lesser.html - [vocx] + surface - curve - bezier - handles + - - - - - - - - - + style="display:inline;fill:url(#linearGradient2095);fill-opacity:1;stroke:#0b1521;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 3.1519208,24.413282 13.801284,52.472481 C 28.323144,17.640372 44.781255,63.115626 56.398738,29.251075 L 38.972508,3.1269928 C 30.809307,30.407148 17.749067,-0.16084869 3.1519208,24.413282 Z" + id="path3820-1-9" /> + style="fill:none;stroke:#172a04;stroke-width:8;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 13.801284,52.472481 C 28.323144,17.640372 44.781255,63.115626 56.398738,29.251075" + id="path3764" /> + id="path1219" + d="M 13.816245,52.162367 C 28.338105,17.330258 44.796216,62.805512 56.413699,28.940961" + style="fill:none;stroke:#fce94f;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + id="path3867" + d="M 48.620445,57.157022 55.854309,32.153751" + style="fill:#ce5c00;stroke:#ce5c00;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + id="path3820-1-9-6" + d="M 5.4725393,24.503343 13.365603,45.716252 C 31.320659,18.292526 44.167745,56.981787 53.473496,28.274182 L 39.51487,7.9294358 C 31.707324,28.541126 16.157527,5.2639846 5.4725393,24.503343 Z" + style="display:inline;fill:none;fill-opacity:1;stroke:#729fcf;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + + style="fill:#fcaf3e;fill-opacity:1;stroke:#ce5c00;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#8ae234;fill-opacity:1;fill-rule:nonzero;stroke:#172a04;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + style="fill:#8ae234;fill-opacity:1;fill-rule:nonzero;stroke:#172a04;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + style="fill:#fcaf3e;fill-opacity:1;stroke:#ce5c00;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/src/Mod/Surface/Gui/Resources/icons/Surface_CurveOnMesh.svg b/src/Mod/Surface/Gui/Resources/icons/Surface_CurveOnMesh.svg index c6bf9bf8ba..d2611f592f 100644 --- a/src/Mod/Surface/Gui/Resources/icons/Surface_CurveOnMesh.svg +++ b/src/Mod/Surface/Gui/Resources/icons/Surface_CurveOnMesh.svg @@ -7,2106 +7,111 @@ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" - id="svg3364" + id="svg2985" height="64px" width="64px"> Surface_CurveOnMesh + id="title866">Surface_CurveOnMesh + id="defs2987"> + id="linearGradient4387"> - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + r="19.467436" + fy="28.869568" + fx="45.883327" + cy="28.869568" + cx="45.883327" + id="radialGradient3692" + xlink:href="#linearGradient3377" /> + id="linearGradient3377"> + id="stop3379" /> + id="stop3381" /> + id="linearGradient3377-3"> + id="stop3379-8" /> + id="stop3381-3" /> + r="19.467436" + fy="28.869568" + fx="45.883327" + cy="28.869568" + cx="45.883327" + gradientTransform="matrix(0.67067175,0,0,0.64145918,-63.380792,0.83845403)" + gradientUnits="userSpaceOnUse" + id="radialGradient6412" + xlink:href="#linearGradient3377-3" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="linearGradient3036"> + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + id="metadata2990"> @@ -2114,95 +119,86 @@ Surface_CurveOnMesh - 2020-09-30 - [vocx] + [bitacovir] - - - CC-BY-SA 4.0 - - + Part_Shape_from_Mesh + 2020/10/03 + http://www.freecadweb.org/wiki/index.php?title=Artwork FreeCAD - FreeCAD/src/Mod/Surface/Gui/Resources/icons/Surface_CurveOnMesh.svg - http://www.freecadweb.org/wiki/index.php?title=Artwork - A purple curved surface that has a thick, red, highlighted curve on top of, it in the middle of the shape. The surface has mesh lines. It is based on the 'Surface' icon. + + + + FreeCAD LGPL2+ + + + https://www.gnu.org/copyleft/lesser.html - - mesh - curve - spline - middle + surface + - - - - - - - - - + d="M 3.1519208,24.413282 17.899691,60.320494 c 14.52186,-34.832109 31.154371,7.93994 42.771854,-25.924611 L 38.972508,3.1269928 C 30.809307,30.407148 17.749067,-0.16084869 3.1519208,24.413282 Z" + style="display:inline;fill:url(#linearGradient2095);fill-opacity:1;stroke:#172a04;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + id="path864" + d="M 13.603223,48.657681 Z" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + style="display:inline;fill:none;fill-opacity:1;stroke:#8ae234;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 5.3492197,24.626663 18.113409,55.643482 C 32.677175,26.678261 49.470489,63.641047 58.406281,34.501823 L 39.63819,7.4361573 C 30.967406,29.589343 16.774125,4.5857267 5.3492197,24.626663 Z" + id="path3820-1-9-6" /> + style="fill:none;stroke:#4e9a06;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="m 14.551524,40.360731 c 4.206197,-6.239691 10.886783,-4.698556 12.49142,-4.817808" + id="path891" /> + id="path859" + d="M 9.0688148,17.178428 24.67764,49.965681" + style="fill:#0b1521;stroke:#172a04;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - - - - + id="path861" + d="M 22.497637,14.213624 40.286466,47.088077" + style="fill:none;stroke:#172a04;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + + + + + + diff --git a/src/Mod/Surface/Gui/Resources/icons/Surface_Cut.svg b/src/Mod/Surface/Gui/Resources/icons/Surface_Cut.svg index cee2cf4fce..8a16b39b90 100644 --- a/src/Mod/Surface/Gui/Resources/icons/Surface_Cut.svg +++ b/src/Mod/Surface/Gui/Resources/icons/Surface_Cut.svg @@ -7,3683 +7,111 @@ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" - id="svg3364" + id="svg2985" height="64px" width="64px"> Surface_Cut + id="title889">Surface_Cut + id="defs2987"> + id="linearGradient4387"> - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + r="19.467436" + fy="28.869568" + fx="45.883327" + cy="28.869568" + cx="45.883327" + id="radialGradient3692" + xlink:href="#linearGradient3377" /> + id="linearGradient3377"> + id="stop3379" /> + id="stop3381" /> + id="linearGradient3377-3"> + id="stop3379-8" /> + id="stop3381-3" /> + id="radialGradient6412" + xlink:href="#linearGradient3377-3" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="linearGradient3036"> + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + x1="47" + y1="9" + x2="7" + y2="28" + gradientUnits="userSpaceOnUse" /> + + + + + id="metadata2990"> @@ -3691,86 +119,69 @@ Surface_Cut - - 2017-04-17 - Nate Miller + [bitacovir] - - - CC-BY-SA 4.0 - - + Part_Shape_from_Mesh + 2020/10/03 + http://www.freecadweb.org/wiki/index.php?title=Artwork FreeCAD - FreeCAD/src/Mod/Surface/Gui/Resources/icons/Surface_Cut.svg - http://www.freecadweb.org/wiki/index.php?title=Artwork - A purple curved surface. A semi-transparent plane cuts the curve in two. The position of the cut is marked with a red thick edge on the curve. It is based on the 'Surface' icon. + + + + FreeCAD LGPL2+ + + + https://www.gnu.org/copyleft/lesser.html - [vocx] + surface - plane - cut + - - - - - - - - + style="display:inline;fill:url(#linearGradient2095);fill-opacity:1;stroke:#0b1521;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 3.1519208,24.413282 17.899691,60.320494 c 14.52186,-34.832109 31.154371,7.93994 42.771854,-25.924611 L 38.972508,3.1269928 C 30.809307,30.407148 17.749067,-0.16084869 3.1519208,24.413282 Z" + id="path3820-1-9" /> + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 13.603223,48.657681 Z" + id="path864" /> + id="path3820-1-9-6" + d="M 5.3492197,24.626663 18.113409,55.643482 C 32.677175,26.678261 49.470489,63.641047 58.406281,34.501823 L 39.63819,7.4361573 C 30.967406,29.589343 16.774125,4.5857267 5.3492197,24.626663 Z" + style="display:inline;fill:none;fill-opacity:1;stroke:#729fcf;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="opacity:0.7175;fill:#ef2929;stroke:#280000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 57.281971,22.709091 57.096986,3.6995887 3.097977,11.384814 2.9746572,44.456724 9.7698774,41.423451 C 17.231743,18.328355 39.666029,41.309915 50.005085,20.047261 l 3.975198,3.989905 z" + id="path866" /> + id="path866-8" + d="M 57.281971,22.709091 57.096992,3.6995881 3.097977,11.384814 2.9746572,44.456724 9.7698772,41.423451 C 17.223185,18.328171 39.853014,41.194251 50.390456,19.754377 l 3.296943,4.452353 z" + style="opacity:1;fill:none;stroke:#280000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + id="path857-1" + d="M 50.227282,19.009631 C 40.095257,43.882552 19.635873,17.890993 9.5920156,41.158467" + style="fill:none;stroke:#0b1521;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#fce94f;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 50.140081,19.053231 C 40.008056,43.926152 19.548672,17.934593 9.5048155,41.202067" + id="path857" /> diff --git a/src/Mod/Surface/Gui/Resources/icons/Surface_Extend.svg b/src/Mod/Surface/Gui/Resources/icons/Surface_Extend.svg deleted file mode 100644 index fb03b99117..0000000000 --- a/src/Mod/Surface/Gui/Resources/icons/Surface_Extend.svg +++ /dev/null @@ -1,5767 +0,0 @@ - - - Surface_Extend - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Surface_Extend - 2020-09-30 - - - [vocx] - - - - - CC-BY-SA 4.0 - - - - - FreeCAD - - - http://www.freecadweb.org/wiki/index.php?title=Artwork - FreeCAD/src/Mod/Surface/Gui/Resources/icons/Surface_Extend.svg - A purple curved surface that contains a smaller surface. The smaller surface has Its four edges in thick, red highlighted. Gray lines extend from the smaller, inner surface to the exterior one. It is based on the 'Surface' icon. - - - - - - - - - surface - curve - extrapolation - highlights - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Mod/Surface/Gui/Resources/icons/Surface_ExtendFace.svg b/src/Mod/Surface/Gui/Resources/icons/Surface_ExtendFace.svg new file mode 100644 index 0000000000..d7af2c7f2d --- /dev/null +++ b/src/Mod/Surface/Gui/Resources/icons/Surface_ExtendFace.svg @@ -0,0 +1,211 @@ + + + Surface_ExtendFace + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Surface_ExtendFace + + + [bitacovir] + + + Part_Shape_from_Mesh + 2020/10/03 + http://www.freecadweb.org/wiki/index.php?title=Artwork + + + FreeCAD + + + + + + FreeCAD LGPL2+ + + + https://www.gnu.org/copyleft/lesser.html + + + + + + + + surface + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Mod/Surface/Gui/Resources/icons/Surface_Filling.svg b/src/Mod/Surface/Gui/Resources/icons/Surface_Filling.svg index 791cf3cff3..5daf7464f8 100644 --- a/src/Mod/Surface/Gui/Resources/icons/Surface_Filling.svg +++ b/src/Mod/Surface/Gui/Resources/icons/Surface_Filling.svg @@ -6,1795 +6,89 @@ xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" - version="1.1" - id="svg3364" + width="64px" height="64px" - width="64px"> + id="svg2985" + version="1.1"> Surface_Filling + id="title889">Surface_Filling + id="defs2987"> - - - - - - + id="linearGradient4387"> + id="stop4389" /> + id="stop4391" /> - - - - - - - - - - - - - - - - - + id="linearGradient6321"> + id="stop6323" /> - + id="stop6325" /> - - - - - - - - - + gradientTransform="translate(-0.23443224,0.23443198)" /> + id="linearGradient3377"> + style="stop-color:#faff2b;stop-opacity:1;" /> + style="stop-color:#ffaa00;stop-opacity:1;" /> + id="linearGradient3377-3"> + style="stop-color:#faff2b;stop-opacity:1;" /> + style="stop-color:#ffaa00;stop-opacity:1;" /> + gradientTransform="matrix(0.67067175,0,0,0.64145918,-63.380792,0.83845403)" + cx="45.883327" + cy="28.869568" + fx="45.883327" + fy="28.869568" + r="19.467436" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="linearGradient3036"> + + + - - - - - - - - - - + xlink:href="#linearGradient1189" + gradientTransform="matrix(0.96812402,0,0,0.96755864,-0.72057496,-2.6783592)" /> + + + + + id="metadata2990"> @@ -1913,100 +119,61 @@ Surface_Filling - 2017-04-17 - Nate Miller + [bitacovir] - - - CC-BY-SA 4.0 - - + Part_Shape_from_Mesh + 2020/10/03 + http://www.freecadweb.org/wiki/index.php?title=Artwork FreeCAD - http://www.freecadweb.org/wiki/index.php?title=Artwork - FreeCAD/src/Mod/Surface/Gui/Resources/icons/Surface_Filling.svg - A purple curved surface. Its four edges are thick and highlighted in red. It is based on the 'Surface' icon. + + + + FreeCAD LGPL2+ + + + https://www.gnu.org/copyleft/lesser.html - [vocx] + - surface - curve - edges - highlights + - - - - - - - - + id="path3820-1-9" + d="M 3.1519208,24.413282 17.899691,60.320494 c 14.52186,-34.832109 31.154371,7.93994 42.771854,-25.924611 L 38.972508,3.1269928 C 30.809307,30.407148 17.749067,-0.16084869 3.1519208,24.413282 Z" + style="display:inline;fill:url(#linearGradient2095);fill-opacity:1;stroke:#302b00;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="display:inline;fill:none;fill-opacity:1;stroke:#fce94f;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 6.0274776,24.811642 18.175069,54.286966 C 33.540412,25.445065 49.03887,62.222871 57.666363,34.995102 L 39.76151,8.7926732 C 30.227488,30.267601 17.452383,4.7707061 6.0274776,24.811642 Z" + id="path3820-1-9-6" /> + style="fill:none;stroke:#302b00;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 8.3549048,24.972224 18.621264,49.266191 C 31.716699,27.213603 50.17526,55.741537 55.247193,35.269413 L 40.202199,12.856071 C 30.336022,29.759966 16.753608,10.080699 8.3549048,24.972224 Z" + id="path857" /> + style="fill:none;stroke:#0b1521;stroke-width:6;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 50.052882,19.009632 C 39.920857,43.882553 19.461473,17.890994 9.4176161,41.158468" + id="path857-1" /> - - - - - + id="path857-3" + d="M 49.965681,19.053232 C 39.833656,43.926153 19.374272,17.934594 9.3304161,41.202068" + style="fill:none;stroke:#fce94f;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/src/Mod/Surface/Gui/Resources/icons/Surface_GeomFillSurface.svg b/src/Mod/Surface/Gui/Resources/icons/Surface_GeomFillSurface.svg new file mode 100644 index 0000000000..2c6e085a7b --- /dev/null +++ b/src/Mod/Surface/Gui/Resources/icons/Surface_GeomFillSurface.svg @@ -0,0 +1,171 @@ + + + Surface_GeomFillSurface + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Surface_GeomFillSurface + + + [bitacovir] + + + Part_Shape_from_Mesh + 2020/10/03 + http://www.freecadweb.org/wiki/index.php?title=Artwork + + + FreeCAD + + + + + + FreeCAD LGPL2+ + + + https://www.gnu.org/copyleft/lesser.html + + + + + + + + surface + + + + + + + + + + + + diff --git a/src/Mod/Surface/Gui/Resources/icons/Surface_Sections.svg b/src/Mod/Surface/Gui/Resources/icons/Surface_Sections.svg index 95c5529f4a..f84f5b73fe 100644 --- a/src/Mod/Surface/Gui/Resources/icons/Surface_Sections.svg +++ b/src/Mod/Surface/Gui/Resources/icons/Surface_Sections.svg @@ -6,2754 +6,150 @@ xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" - width="64px" + version="1.1" + id="svg2985" height="64px" - id="svg3364" - version="1.1"> + width="64px"> Surface_Sections + id="title889">Surface_Sections + id="defs2987"> + id="linearGradient873"> + id="stop869" /> - - + id="stop871" /> + id="linearGradient863"> + + + + + + + + - + r="19.467436" + fy="28.869568" + fx="45.883327" + cy="28.869568" + cx="45.883327" + id="radialGradient3692" + xlink:href="#linearGradient3377" /> + id="linearGradient3377"> + id="stop3379" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="stop3381" /> + id="linearGradient3377-3"> + id="stop3379-8" /> + id="stop3381-3" /> + r="19.467436" + fy="28.869568" + fx="45.883327" + cy="28.869568" + cx="45.883327" + gradientTransform="matrix(0.67067175,0,0,0.64145918,-63.380792,0.83845403)" + gradientUnits="userSpaceOnUse" + id="radialGradient6412" + xlink:href="#linearGradient3377-3" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="linearGradient3036"> + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + x1="47" + y1="9" + x2="7" + y2="28" + gradientUnits="userSpaceOnUse" /> + + + + + + + id="metadata2990"> @@ -2761,139 +157,73 @@ Surface_Sections - - 2020-09-29 - [vocx] + [bitacovir] - - - CC-BY-SA 4.0 - - + Part_Shape_from_Mesh + 2020/10/03 + http://www.freecadweb.org/wiki/index.php?title=Artwork FreeCAD - FreeCAD/src/Mod/Surface/Gui/Resources/icons/Surface_Sections.svg - http://www.freecadweb.org/wiki/index.php?title=Artwork + + + + FreeCAD LGPL2+ + + + https://www.gnu.org/copyleft/lesser.html + + + + + surface - curve - sections - edges - A purple surface made with several highlighted red edges which represent transversal sections of the surface. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + diff --git a/src/Mod/Surface/Gui/Resources/icons/Surface_Sewing.svg b/src/Mod/Surface/Gui/Resources/icons/Surface_Sewing.svg index cf8e3b2e59..7411c1dcc6 100644 --- a/src/Mod/Surface/Gui/Resources/icons/Surface_Sewing.svg +++ b/src/Mod/Surface/Gui/Resources/icons/Surface_Sewing.svg @@ -7,1806 +7,111 @@ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" - id="svg3364" + id="svg2985" height="64px" width="64px"> Surface_Sewing + id="title889">Surface_Sewing + id="defs2987"> + id="linearGradient4387"> - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + r="19.467436" + fy="28.869568" + fx="45.883327" + cy="28.869568" + cx="45.883327" + id="radialGradient3692" + xlink:href="#linearGradient3377" /> + id="linearGradient3377"> + id="stop3379" /> + id="stop3381" /> + id="linearGradient3377-3"> + id="stop3379-8" /> + id="stop3381-3" /> + id="radialGradient6412" + xlink:href="#linearGradient3377-3" /> + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="linearGradient1189"> + + + + id="metadata2990"> @@ -1814,99 +119,73 @@ Surface_Sewing - - 2017-04-17 - Nate Miller + [bitacovir] - - - CC-BY-SA 4.0 - - + Part_Shape_from_Mesh + 2020/10/03 + http://www.freecadweb.org/wiki/index.php?title=Artwork FreeCAD - FreeCAD/src/Mod/Surface/Gui/Resources/icons/Surface_Sewing.svg - http://www.freecadweb.org/wiki/index.php?title=Artwork - A purple curved surface, with black edges, and one edge passing through the middle, dividing the curve in two parts. Six straight lines cross the middle edge, indicating stitches. It is based on the 'Surface' icon. + + + + FreeCAD LGPL2+ + + + https://www.gnu.org/copyleft/lesser.html - [vocx] + surface - curve - edges + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + diff --git a/src/Mod/Surface/Gui/Resources/icons/Surface_Surface.svg b/src/Mod/Surface/Gui/Resources/icons/Surface_Surface.svg index a0f51cfc3f..b3217de204 100644 --- a/src/Mod/Surface/Gui/Resources/icons/Surface_Surface.svg +++ b/src/Mod/Surface/Gui/Resources/icons/Surface_Surface.svg @@ -7,1697 +7,111 @@ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" - id="svg3364" + id="svg2985" height="64px" width="64px"> Surface_Surface + id="title889">Surface_Surface + id="defs2987"> + id="linearGradient4387"> - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + id="linearGradient3377"> + id="stop3379" /> + id="stop3381" /> + id="linearGradient3377-3"> + id="stop3379-8" /> + id="stop3381-3" /> + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="linearGradient1189"> + + + + id="metadata2990"> @@ -1705,75 +119,53 @@ Surface_Surface - 2017-04-17 - Nate Miller + [bitacovir] - - - CC-BY-SA 4.0 - - + Part_Shape_from_Mesh + 2020/10/03 + http://www.freecadweb.org/wiki/index.php?title=Artwork FreeCAD - FreeCAD/src/Mod/Surface/Gui/Resources/icons/Surface_Surface.svg - http://www.freecadweb.org/wiki/index.php?title=Artwork - A purple curved surface, with a linear gradient, and some highlights in light and dark purple. - + + + + FreeCAD LGPL2+ + + + https://www.gnu.org/copyleft/lesser.html - [vocx] + surface - curve - wave + - - - - - - - - - - - - - + + + + + diff --git a/src/Mod/Surface/Gui/Resources/icons/Surface_Workbench.svg b/src/Mod/Surface/Gui/Resources/icons/Surface_Workbench.svg index 35053ff75c..44e6791ec6 100644 --- a/src/Mod/Surface/Gui/Resources/icons/Surface_Workbench.svg +++ b/src/Mod/Surface/Gui/Resources/icons/Surface_Workbench.svg @@ -6,1698 +6,112 @@ xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" - version="1.1" - id="svg3364" + width="64px" height="64px" - width="64px"> + id="svg2985" + version="1.1"> Surface_Workbench + id="title889">Surface_Workbench + id="defs2987"> - - - - - - + id="linearGradient4387"> + id="stop4389" /> + id="stop4391" /> - - - - - - - - - - - - - - - - - + id="linearGradient6321"> + id="stop6323" /> - - - - - - - - - + id="stop6325" /> + xlink:href="#linearGradient3377" + id="radialGradient3692" + cx="45.883327" + cy="28.869568" + fx="45.883327" + fy="28.869568" + r="19.467436" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(-0.23443224,0.23443198)" /> + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + x2="7" + y1="9" + x1="47" + id="linearGradient2095" + xlink:href="#linearGradient1189" + gradientTransform="matrix(0.96812402,0,0,0.96755864,-0.72057496,-2.6783592)" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="linearGradient1189"> + + + + id="metadata2990"> @@ -1705,75 +119,53 @@ Surface_Workbench - 2017-04-17 - Nate Miller + [bitacovir] - - - CC-BY-SA 4.0 - - + Part_Shape_from_Mesh + 2020/10/03 + http://www.freecadweb.org/wiki/index.php?title=Artwork FreeCAD - FreeCAD/src/Mod/Surface/Gui/Resources/icons/Surface_Workbench.svg - http://www.freecadweb.org/wiki/index.php?title=Artwork - A purple curved surface, with a linear gradient, and some highlights in light and dark purple. It is based on the 'Surface' icon. - + + + + FreeCAD LGPL2+ + + + https://www.gnu.org/copyleft/lesser.html - [vocx] + surface - curve - wave + - - - - - - - - - - - - - + + + + + From ba8e0aa8630e936e4c882cca50bbac9919cdd750 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Tue, 26 Jan 2021 20:38:51 -0600 Subject: [PATCH 07/16] Minor tweaks to Start recommended by LGTM Using the results of the vulnerability scan at lgtm.com, some minor changes were made. First, all Python exception handling now explicitly catches Exception, rather than BaseException (which would include SystemExit and KeyboardInterrupt). Second, unused imports were removed. Third, a couple of unnecessary or unused assignments were addressed. Finally, the JavaScript was modified to explicitly declare the local ddiv variable when needed. --- src/Mod/Start/StartPage/EnableDownload.py | 2 +- src/Mod/Start/StartPage/LoadMRU.py | 2 +- src/Mod/Start/StartPage/StartPage.js | 8 ++++---- src/Mod/Start/StartPage/StartPage.py | 15 +++++++-------- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/Mod/Start/StartPage/EnableDownload.py b/src/Mod/Start/StartPage/EnableDownload.py index 4baca89549..f7f117969e 100644 --- a/src/Mod/Start/StartPage/EnableDownload.py +++ b/src/Mod/Start/StartPage/EnableDownload.py @@ -20,6 +20,6 @@ #* * #*************************************************************************** -import FreeCAD,FreeCADGui +import FreeCAD rf=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Start") rf.SetBool("AllowDownload",True) diff --git a/src/Mod/Start/StartPage/LoadMRU.py b/src/Mod/Start/StartPage/LoadMRU.py index 4c7889daa3..7b7e14c7d6 100644 --- a/src/Mod/Start/StartPage/LoadMRU.py +++ b/src/Mod/Start/StartPage/LoadMRU.py @@ -20,7 +20,7 @@ #* * #*************************************************************************** -import FreeCADGui,sys +import FreeCADGui # MRU will be given before this script is run rf=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/RecentFiles") FreeCADGui.loadFile(rf.GetString("MRU"+str(MRU))) diff --git a/src/Mod/Start/StartPage/StartPage.js b/src/Mod/Start/StartPage/StartPage.js index ca70689613..ad906f89e9 100644 --- a/src/Mod/Start/StartPage/StartPage.js +++ b/src/Mod/Start/StartPage/StartPage.js @@ -31,7 +31,7 @@ function load() { if (allowDownloads == 1) { // load latest commits - ddiv = document.getElementById("commits"); + var ddiv = document.getElementById("commits"); ddiv.innerHTML = "Connecting..."; var tobj=new JSONscriptRequest('https://api.github.com/repos/FreeCAD/FreeCAD/commits?callback=printCommits'); tobj.buildScriptTag(); // Build the script tag @@ -61,7 +61,7 @@ function printCommits(data) { // json callback for git commits - ddiv = document.getElementById('commits'); + var ddiv = document.getElementById('commits'); ddiv.innerHTML = "Received"; var html = ['
    ']; for (var i = 0; i < 25; i++) { @@ -76,7 +76,7 @@ function printAddons(data) { // json callback for addons list - ddiv = document.getElementById('addons'); + var ddiv = document.getElementById('addons'); ddiv.innerHTML = "Received"; var html = ['
      ']; var blacklist = ['addons_installer.FCMacro','FreeCAD-Addon-Details.md','README.md']; @@ -98,7 +98,7 @@ function printForum(data) { // json callback for forum posts - ddiv = document.getElementById('forum'); + var ddiv = document.getElementById('forum'); ddiv.innerHTML = "Received"; var html = ['
        ']; for (var i = 0; i < 25; i++) { diff --git a/src/Mod/Start/StartPage/StartPage.py b/src/Mod/Start/StartPage/StartPage.py index 5fc176f778..a19c46949c 100644 --- a/src/Mod/Start/StartPage/StartPage.py +++ b/src/Mod/Start/StartPage/StartPage.py @@ -25,7 +25,7 @@ # the html code of the start page. It is built only once per FreeCAD session for now... import six -import sys,os,FreeCAD,FreeCADGui,tempfile,time,zipfile,urllib,re +import sys,os,FreeCAD,FreeCADGui,tempfile,time,zipfile,re from . import TranslationTexts from PySide import QtCore,QtGui @@ -107,7 +107,7 @@ def getInfo(filename): try: import gnome.ui import gnomevfs - except: + except Exception: # alternative method import hashlib fhash = hashlib.md5(("file://"+path).encode("utf8")).hexdigest() @@ -140,7 +140,7 @@ def getInfo(filename): if filename.lower().endswith(".fcstd"): try: zfile=zipfile.ZipFile(filename) - except: + except Exception: print("Cannot read file: ",filename) return None files=zfile.namelist() @@ -366,7 +366,6 @@ def handle(): # build SECTION_RECENTFILES - SECTION_RECENTFILES = encode("") rf = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/RecentFiles") rfcount = rf.GetInt("RecentFiles",0) SECTION_RECENTFILES = encode("

        "+TranslationTexts.T_RECENTFILES+"

        ") @@ -493,7 +492,7 @@ def handle(): img = os.path.join(resources_dir,"images/freecad.png") iconbank[wb] = img UL_WORKBENCHES += '
      • ' - UL_WORKBENCHES += ' ' + UL_WORKBENCHES += ' ' UL_WORKBENCHES += ''+wn.replace("ReverseEngineering","ReverseEng")+'' UL_WORKBENCHES += '
      • ' UL_WORKBENCHES += '
      ' @@ -503,19 +502,19 @@ def handle(): try: import dxfLibrary - except: + except Exception: pass else: wblist.append("dxf-library") try: import RebarTools - except: + except Exception: pass else: wblist.append("reinforcement") try: import CADExchangerIO - except: + except Exception: pass else: wblist.append("cadexchanger") From cbb0a8a11c7e91b027032fe9c33321ad401295d2 Mon Sep 17 00:00:00 2001 From: ci4ic4 Date: Wed, 27 Jan 2021 11:51:42 +0000 Subject: [PATCH 08/16] Update philips_post.py You can't compare dict with an integer. --- src/Mod/Path/PathScripts/post/philips_post.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Path/PathScripts/post/philips_post.py b/src/Mod/Path/PathScripts/post/philips_post.py index 41203ef075..f06d2d666d 100644 --- a/src/Mod/Path/PathScripts/post/philips_post.py +++ b/src/Mod/Path/PathScripts/post/philips_post.py @@ -384,7 +384,7 @@ def export(objectslist, filename, argstring): # #\better: append iff MODAL == False # if command == lastcommand: # outstring.pop(0) - if c.Parameters >= 1: + if len(c.Parameters) >= 1: for param in params: # test print("param: " + param + ", command: " + command) if param in c.Parameters: From fd2f2d83d05ece79b7883895cc03c31252f9c8ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20M=C3=A4chler?= Date: Mon, 25 Jan 2021 12:09:17 +0100 Subject: [PATCH 09/16] Path: Fix creating simple copy This commit fixes the issue discussed on the FreeCAD forum: https://forum.freecadweb.org/viewtopic.php?f=15&t=54769 --- src/Mod/Path/PathScripts/PathSimpleCopy.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathSimpleCopy.py b/src/Mod/Path/PathScripts/PathSimpleCopy.py index 2901166801..6c6cb5d5a6 100644 --- a/src/Mod/Path/PathScripts/PathSimpleCopy.py +++ b/src/Mod/Path/PathScripts/PathSimpleCopy.py @@ -67,8 +67,7 @@ class CommandPathSimpleCopy: FreeCADGui.addModule("PathScripts.PathUtils") FreeCADGui.addModule("PathScripts.PathCustom") - FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","' + selection[0].Name + '_SimpleCopy")') - FreeCADGui.doCommand('PathScripts.PathCustom.ObjectCustom(obj)') + FreeCADGui.doCommand('obj = PathScripts.PathCustom.Create("' + selection[0].Name + '_SimpleCopy")') FreeCADGui.doCommand('obj.ViewObject.Proxy = 0') FreeCADGui.doCommand('obj.Gcode = [c.toGCode() for c in srcpath.Commands]') FreeCADGui.doCommand('PathScripts.PathUtils.addToJob(obj)') From 6870b022105c2bd601da4eb417d4956a57a35359 Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Wed, 27 Jan 2021 23:15:37 +0100 Subject: [PATCH 10/16] [Gui] Make inventor markers symmetric These changes makes the round markers symmetric horizontally, vertically and on the diagonal. --- src/Gui/Inventor/MarkerBitmaps.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Gui/Inventor/MarkerBitmaps.cpp b/src/Gui/Inventor/MarkerBitmaps.cpp index 732cbe5f36..90ed4a6af2 100644 --- a/src/Gui/Inventor/MarkerBitmaps.cpp +++ b/src/Gui/Inventor/MarkerBitmaps.cpp @@ -345,12 +345,12 @@ const char circleLine11_marker[CIRCLE_LINE11_WIDTH * CIRCLE_LINE11_HEIGHT + 1] = " " " xxxxxx " " xxxxxxxx " -" xx xx " +" xxx xxx" " xx xx" " xx xx" " xx xx" " xx xx" -" xx xx " +" xxx xxx" " xxxxxxxx " " xxxxxx "}; @@ -381,7 +381,7 @@ const char circleLine15_marker[CIRCLE_LINE15_WIDTH * CIRCLE_LINE15_HEIGHT + 1] = " " " xxxxxx " " xxxxxxxxxx " -" xx xx " +" xxx xxx " " xx xx " " xx xx" " xx xx" @@ -390,7 +390,7 @@ const char circleLine15_marker[CIRCLE_LINE15_WIDTH * CIRCLE_LINE15_HEIGHT + 1] = " xx xx" " xx xx" " xx xx " -" xx xxxx" +" xxx xxx " " xxxxxxxxxx " " xxxxxx "}; @@ -401,12 +401,12 @@ const char circleFilled11_marker[CIRCLE_FILLED11_WIDTH * CIRCLE_FILLED11_HEIGHT " " " xxxxxx " " xxxxxxxx " -" xxxxxxxx " " xxxxxxxxxx" " xxxxxxxxxx" " xxxxxxxxxx" " xxxxxxxxxx" -" xxxxxxxx " +" xxxxxxxxxx" +" xxxxxxxxxx" " xxxxxxxx " " xxxxxx "}; @@ -446,7 +446,7 @@ const char circleFilled15_marker[CIRCLE_FILLED15_WIDTH * CIRCLE_FILLED15_HEIGHT " xxxxxxxxxxxxxx" " xxxxxxxxxxxxxx" " xxxxxxxxxxxx " -" xxxxxxxxxxxx" +" xxxxxxxxxxxx " " xxxxxxxxxx " " xxxxxx "}; From 92846ad0f134227d44bcf5bf1b22e4597f9d9861 Mon Sep 17 00:00:00 2001 From: Aapo Date: Thu, 28 Jan 2021 15:42:15 +0200 Subject: [PATCH 11/16] [TD] Avoid changing default open/save dir to templateDir when opening a Page template. --- src/Mod/TechDraw/Gui/Command.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Mod/TechDraw/Gui/Command.cpp b/src/Mod/TechDraw/Gui/Command.cpp index 687fd905ee..8fc52fbdd7 100644 --- a/src/Mod/TechDraw/Gui/Command.cpp +++ b/src/Mod/TechDraw/Gui/Command.cpp @@ -183,11 +183,13 @@ CmdTechDrawPageTemplate::CmdTechDrawPageTemplate() void CmdTechDrawPageTemplate::activated(int iMsg) { Q_UNUSED(iMsg); + QString work_dir = Gui::FileDialog::getWorkingDirectory(); QString templateDir = Preferences::defaultTemplateDir(); QString templateFileName = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QString::fromUtf8(QT_TR_NOOP("Select a Template File")), templateDir, QString::fromUtf8(QT_TR_NOOP("Template (*.svg *.dxf)"))); + Gui::FileDialog::setWorkingDirectory(work_dir); // Don't overwrite WD with templateDir if (templateFileName.isEmpty()) { return; From 4bd5c2669d006254cdfc93e20c2e265226dfec5d Mon Sep 17 00:00:00 2001 From: vosk Date: Tue, 26 Jan 2021 17:00:08 +0200 Subject: [PATCH 12/16] [Part] - Fix memory leaks --- src/Gui/ViewProviderLine.cpp | 2 -- src/Gui/ViewProviderPlane.cpp | 2 -- src/Mod/Part/App/PropertyGeometryList.cpp | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Gui/ViewProviderLine.cpp b/src/Gui/ViewProviderLine.cpp index 6294d73bf9..bdae7a5f8b 100644 --- a/src/Gui/ViewProviderLine.cpp +++ b/src/Gui/ViewProviderLine.cpp @@ -68,13 +68,11 @@ void ViewProviderLine::attach ( App::DocumentObject *obj ) { sep->addChild ( pCoords ); SoIndexedLineSet *pLines = new SoIndexedLineSet (); - pLines->ref(); pLines->coordIndex.setNum(3); pLines->coordIndex.setValues(0, 3, lines); sep->addChild ( pLines ); SoTranslation *textTranslation = new SoTranslation (); - textTranslation->ref (); textTranslation->translation.setValue ( SbVec3f ( -size * 49. / 50., size / 30., 0 ) ); sep->addChild ( textTranslation ); diff --git a/src/Gui/ViewProviderPlane.cpp b/src/Gui/ViewProviderPlane.cpp index c93e1b8fd9..02fa1b550e 100644 --- a/src/Gui/ViewProviderPlane.cpp +++ b/src/Gui/ViewProviderPlane.cpp @@ -70,13 +70,11 @@ void ViewProviderPlane::attach ( App::DocumentObject *obj ) { sep->addChild ( pCoords ); SoIndexedLineSet *pLines = new SoIndexedLineSet (); - pLines->ref(); pLines->coordIndex.setNum(6); pLines->coordIndex.setValues(0, 6, lines); sep->addChild ( pLines ); SoTranslation *textTranslation = new SoTranslation (); - textTranslation->ref (); textTranslation->translation.setValue ( SbVec3f ( -size * 49. / 50., size * 9./10., 0 ) ); sep->addChild ( textTranslation ); diff --git a/src/Mod/Part/App/PropertyGeometryList.cpp b/src/Mod/Part/App/PropertyGeometryList.cpp index 432d3610df..3061c3d60d 100644 --- a/src/Mod/Part/App/PropertyGeometryList.cpp +++ b/src/Mod/Part/App/PropertyGeometryList.cpp @@ -226,7 +226,7 @@ void PropertyGeometryList::Restore(Base::XMLReader &reader) reader.readEndElement("GeometryList"); // assignment - setValues(values); + setValues(std::move(values)); } App::Property *PropertyGeometryList::Copy(void) const From b49c523a541ce7ace520463e9e0b695ef6b20e5b Mon Sep 17 00:00:00 2001 From: vosk Date: Tue, 26 Jan 2021 22:18:30 +0200 Subject: [PATCH 13/16] [Part] - Fix View3DInventor.setCamera leaking SoCamera* --- src/Gui/View3DInventor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index 396da77057..ee55f39111 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -774,10 +774,13 @@ bool View3DInventor::setCamera(const char* pCamera) SoNode * Cam; SoDB::read(&in,Cam); - if (!Cam){ + if (!Cam || !Cam->isOfType(SoCamera::getClassTypeId())) { throw Base::RuntimeError("Camera settings failed to read"); } + // this is to make sure to reliably delete the node + CoinPtr camPtr(Cam, true); + // toggle between perspective and orthographic camera if (Cam->getTypeId() != CamViewer->getTypeId()) { From aa45875a2be8a6a43f150f18fd993aecde0785b0 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 28 Jan 2021 16:22:40 +0100 Subject: [PATCH 14/16] Gui: modernize C++ --- src/Gui/View3DInventor.cpp | 49 ++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index ee55f39111..43a923a66b 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -782,42 +782,45 @@ bool View3DInventor::setCamera(const char* pCamera) CoinPtr camPtr(Cam, true); // toggle between perspective and orthographic camera - if (Cam->getTypeId() != CamViewer->getTypeId()) - { + if (Cam->getTypeId() != CamViewer->getTypeId()) { _viewer->setCameraType(Cam->getTypeId()); CamViewer = _viewer->getSoRenderManager()->getCamera(); } - SoPerspectiveCamera * CamViewerP = 0; - SoOrthographicCamera * CamViewerO = 0; + SoPerspectiveCamera * CamViewerP = nullptr; + SoOrthographicCamera * CamViewerO = nullptr; if (CamViewer->getTypeId() == SoPerspectiveCamera::getClassTypeId()) { - CamViewerP = (SoPerspectiveCamera *)CamViewer; // safe downward cast, knows the type - } else if (CamViewer->getTypeId() == SoOrthographicCamera::getClassTypeId()) { - CamViewerO = (SoOrthographicCamera *)CamViewer; // safe downward cast, knows the type + CamViewerP = static_cast(CamViewer); // safe downward cast, knows the type + } + else if (CamViewer->getTypeId() == SoOrthographicCamera::getClassTypeId()) { + CamViewerO = static_cast(CamViewer); // safe downward cast, knows the type } if (Cam->getTypeId() == SoPerspectiveCamera::getClassTypeId()) { if (CamViewerP){ - CamViewerP->position = ((SoPerspectiveCamera *)Cam)->position; - CamViewerP->orientation = ((SoPerspectiveCamera *)Cam)->orientation; - CamViewerP->nearDistance = ((SoPerspectiveCamera *)Cam)->nearDistance; - CamViewerP->farDistance = ((SoPerspectiveCamera *)Cam)->farDistance; - CamViewerP->focalDistance = ((SoPerspectiveCamera *)Cam)->focalDistance; - } else { + CamViewerP->position = static_cast(Cam)->position; + CamViewerP->orientation = static_cast(Cam)->orientation; + CamViewerP->nearDistance = static_cast(Cam)->nearDistance; + CamViewerP->farDistance = static_cast(Cam)->farDistance; + CamViewerP->focalDistance = static_cast(Cam)->focalDistance; + } + else { throw Base::TypeError("Camera type mismatch"); } - } else if (Cam->getTypeId() == SoOrthographicCamera::getClassTypeId()) { + } + else if (Cam->getTypeId() == SoOrthographicCamera::getClassTypeId()) { if (CamViewerO){ - CamViewerO->viewportMapping = ((SoOrthographicCamera *)Cam)->viewportMapping; - CamViewerO->position = ((SoOrthographicCamera *)Cam)->position; - CamViewerO->orientation = ((SoOrthographicCamera *)Cam)->orientation; - CamViewerO->nearDistance = ((SoOrthographicCamera *)Cam)->nearDistance; - CamViewerO->farDistance = ((SoOrthographicCamera *)Cam)->farDistance; - CamViewerO->focalDistance = ((SoOrthographicCamera *)Cam)->focalDistance; - CamViewerO->aspectRatio = ((SoOrthographicCamera *)Cam)->aspectRatio ; - CamViewerO->height = ((SoOrthographicCamera *)Cam)->height; - } else { + CamViewerO->viewportMapping = static_cast(Cam)->viewportMapping; + CamViewerO->position = static_cast(Cam)->position; + CamViewerO->orientation = static_cast(Cam)->orientation; + CamViewerO->nearDistance = static_cast(Cam)->nearDistance; + CamViewerO->farDistance = static_cast(Cam)->farDistance; + CamViewerO->focalDistance = static_cast(Cam)->focalDistance; + CamViewerO->aspectRatio = static_cast(Cam)->aspectRatio ; + CamViewerO->height = static_cast(Cam)->height; + } + else { throw Base::TypeError("Camera type mismatch"); } } From 1dddcd0b181be028065c59594057c8f7ba2979c2 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Sat, 23 Jan 2021 21:19:12 +0800 Subject: [PATCH 15/16] Part: fix ViewProviderExt::updateVisual() on incomplete mesh --- src/Mod/Part/Gui/ViewProviderExt.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Mod/Part/Gui/ViewProviderExt.cpp b/src/Mod/Part/Gui/ViewProviderExt.cpp index 909049fdbf..5dcfd97135 100644 --- a/src/Mod/Part/Gui/ViewProviderExt.cpp +++ b/src/Mod/Part/Gui/ViewProviderExt.cpp @@ -1133,7 +1133,10 @@ void ViewProviderPartExt::updateVisual() const TopoDS_Face &actFace = TopoDS::Face(faceMap(i)); // get the mesh of the shape Handle (Poly_Triangulation) mesh = BRep_Tool::Triangulation(actFace,aLoc); - if (mesh.IsNull()) continue; + if (mesh.IsNull()) { + parts[ii] = 0; + continue; + } // getting the transformation of the shape/face gp_Trsf myTransf; From 569817d87a622e0625b25e64438f117fca9f47d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Thu, 28 Jan 2021 17:16:05 +0100 Subject: [PATCH 16/16] Fix ODR violation, correct Ui_TaskSketcherGeneral namespace The generated ui_TaskSketcherGeneral.h defines the class in the SketcherGui namespace. Fixes #4529 --- src/Mod/Sketcher/Gui/TaskSketcherGeneral.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Mod/Sketcher/Gui/TaskSketcherGeneral.h b/src/Mod/Sketcher/Gui/TaskSketcherGeneral.h index 1cdd92923a..335af9c434 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherGeneral.h +++ b/src/Mod/Sketcher/Gui/TaskSketcherGeneral.h @@ -28,8 +28,6 @@ #include #include -class Ui_TaskSketcherGeneral; - namespace App { class Property; } @@ -40,6 +38,7 @@ class ViewProvider; namespace SketcherGui { +class Ui_TaskSketcherGeneral; class ViewProviderSketch; class SketcherGeneralWidget : public QWidget