Skip to content

Commit

Permalink
Make material preservation system a bit more robust. Issue #331
Browse files Browse the repository at this point in the history
  • Loading branch information
shaise committed Apr 7, 2024
1 parent d42ccd1 commit e6fe91e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Starting from FreeCAD 0.17 it can be installed via the [Addon Manager](https://g
* FreeCAD Forum announcement/discussion [thread](https://forum.freecadweb.org/viewtopic.php?f=3&t=60818)

#### Release notes:
* V0.4.11 07 Apr 2024: Make material preservation system a bit more robust.
* V0.4.10 31 Mar 2024: Some code refactoring and cleanup by [@sliptonic][sliptonic].
- Add Flat shape to base shapes.
* V0.4.09 28 Mar 2024: Enhance bend function to work on refined faces as well.
Expand Down
32 changes: 17 additions & 15 deletions SheetMetalBaseCmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@

def smWarnDialog(msg):
diag = QtGui.QMessageBox(
QtGui.QMessageBox.Warning,
FreeCAD.Qt.translate("QMessageBox", "Error in macro MessageBox"),
msg,
QtGui.QMessageBox.Warning,
FreeCAD.Qt.translate("QMessageBox", "Error in macro MessageBox"),
msg,
)
diag.setWindowModality(QtCore.Qt.ApplicationModal)
diag.exec_()
Expand All @@ -63,19 +63,20 @@ def smIsSketchObject(obj):
def smIsOperationLegal(body, selobj):
# FreeCAD.Console.PrintLog(str(selobj) + " " + str(body) + " " + str(smBelongToBody(selobj, body)) + "\n")
if smIsSketchObject(selobj) and not smBelongToBody(selobj, body):
smWarnDialog(
FreeCAD.Qt.translate(
"QMessageBox",
"The selected geometry does not belong to the active Body.\n"
"Please make the container of this item active by\n"
"double clicking on it.",
)
)
smWarnDialog(
FreeCAD.Qt.translate(
"QMessageBox",
"The selected geometry does not belong to the active Body.\n"
"Please make the container of this item active by\n"
"double clicking on it.",
)
)
return False
return True


def GetViewConfig(obj):
return obj.ViewObject.dumpContent()
viewconf = {}
viewconf["objShapeCol"] = obj.ViewObject.ShapeColor
viewconf["objShapeTsp"] = obj.ViewObject.Transparency
Expand All @@ -86,9 +87,10 @@ def GetViewConfig(obj):


def SetViewConfig(obj, viewconf):
obj.ViewObject.ShapeColor = viewconf["objShapeCol"]
obj.ViewObject.Transparency = viewconf["objShapeTsp"]
obj.ViewObject.DiffuseColor = viewconf["objDiffuseCol"]
obj.ViewObject.restoreContent(viewconf)
#obj.ViewObject.ShapeColor = viewconf["objShapeCol"]
#obj.ViewObject.Transparency = viewconf["objShapeTsp"]
#obj.ViewObject.DiffuseColor = viewconf["objDiffuseCol"]


def getOriginalBendObject(obj):
Expand Down Expand Up @@ -363,4 +365,4 @@ def IsActive(self):
return True


Gui.addCommand("SheetMetal_AddBase", AddBaseCommandClass())
Gui.addCommand("SheetMetal_AddBase", AddBaseCommandClass())
4 changes: 2 additions & 2 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<package format="1" xmlns="https://wiki.freecad.org/Package_Metadata">
<name>SheetMetal Workbench</name>
<description>A simple sheet metal tools workbench for FreeCAD.</description>
<version>0.4.10</version>
<date>2024-03-31</date>
<version>0.4.11</version>
<date>2024-04-07</date>
<maintainer email="[email protected]">Shai Seger</maintainer>
<license file="LICENSE">LGPL-2.1-or-later</license>
<url type="repository" branch="master">https://github.com/shaise/FreeCAD_SheetMetal</url>
Expand Down

0 comments on commit e6fe91e

Please sign in to comment.