Created
February 11, 2023 22:45
-
-
Save Rahix/989c471bba6d1e33759f0fcdb91f8970 to your computer and use it in GitHub Desktop.
FreeCAD macro to calculate the cumulative length of all selected edges
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# inspired by https://forum.freecad.org/viewtopic.php?t=44309 | |
from PySide import QtCore, QtGui | |
edges = FreeCADGui.Selection.getSelectionEx()[0].SubObjects | |
length = sum(e.Length for e in edges) | |
print(f"Length of selected edges is {length:.2f} mm.") | |
diag = QtGui.QMessageBox(QtGui.QMessageBox.Information, "Edge Length", f"Length of selected edges is {length:.2f} mm.") | |
diag.setWindowModality(QtCore.Qt.ApplicationModal) | |
diag.exec_() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment