Macro CenterOfMass

From FreeCAD Documentation
Revision as of 17:55, 14 November 2018 by Mario52 (talk | contribs) (Marked this version for translation)
Jump to navigation Jump to search
Other languages:
English • ‎français • ‎hrvatski • ‎italiano

32px Macro CenterOfMass

Description
Gives the Center of mass multiple of multiple objects selected.

Macro version: 0.1.2
Last modified: 2018-11-10
Author: schupin
Author
schupin
Download
None
Links
Macro Version
0.1.2
Date last modified
2018-11-10
FreeCAD Version(s)
None
Default shortcut
None
See also
None

Description

Gives the total mass and the location of the center of mass resulting of multiple objects selected. Different densities could be chosen for each object.

Temporary code for external macro link. Do not use this code. This code is used exclusively by Addon Manager.


# This code is copied instead of the original macro code
# to guide the user to the online download page.
# Use it if the code of the macro is larger than 64 KB and cannot be included in the wiki
# or if the RAW code URL is somewhere else in the wiki.

from PySide import QtGui, QtCore

diag = QtGui.QMessageBox(QtGui.QMessageBox.Information,
    "Information",
    "This macro must be downloaded from this link\n"
    "\n"
    "https://raw.githubusercontent.com/FreeCAD/FreeCAD-macros/master/Information/CenterOfMass.FCMacro" + "\n"
    "\n"
    "Quit this window to access the download page")

diag.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
diag.setWindowModality(QtCore.Qt.ApplicationModal)
diag.exec_()

import webbrowser 
webbrowser.open("https://raw.githubusercontent.com/FreeCAD/FreeCAD-macros/master/Information/CenterOfMass.FCMacro")
<class="rawcodeurl"><a href="https://raw.githubusercontent.com/FreeCAD/FreeCAD-macros/master/Information/CenterOfMass.FCMacro">raw code</a>


Macro CenterOfMass 01.png


The values (mass and center of mass) results can be saved in a spreadsheet

Macro CenterOfMass 02.png


How to use

Select the object(s)

Run the macro

Script

icon file download and paste in the same directory of the macro

toolBar icon

File:Centomass.png


File:SaveIcon.png File:CdgIcon.png File:ComputeIcon.png File:ImportIcon.png File:MaterialIcon.png


Macro CenterOfMass.FCMacro Download in Github


Macro CenterOfMass.FCMacro

Link

the forum discussion Macro to compute center of mass

Version

0.1.2 / 2018-11-10 : xx