Macro CenterOfMass

From FreeCAD Documentation
Jump to: navigation, search
Other languages:
English • ‎français • ‎hrvatski • ‎italiano

Macro CenterOfMass.png Macro CenterOfMass

Description
Gives the Center of mass multiple of multiple objects selected.
Author
schupin
Links
Macros recipes
How to install macros
How to customize toolbars
Version
0.3.2
Date last modification
2019-14-03
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_Installer.


##This code is copied instead of the original macro code

##to guide the user to the offline 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 extra wiki location

import PySide

from PySide import QtGui ,QtCore

diag = QtGui.QMessageBox(QtGui.QMessageBox.Information,u"Information",
    "This macro must by downloaded with this link" + "\n"
    " " + "\n"
    "https://raw.githubusercontent.com/chupins/FreeCAD-macros/SC_Branch/Information/CenterOfMass.FCMacro" + "\n"
    " " + "\n"
    "Quit this window for access in the download page" )

diag.setWindowFlags(PySide.QtCore.Qt.WindowStaysOnTopHint)

diag.setWindowModality(QtCore.Qt.ApplicationModal)

diag.exec_()

import webbrowser 

webbrowser.open("https://raw.githubusercontent.com/chupins/FreeCAD-macros/SC_Branch/Information/CenterOfMass.FCMacro")
<class="rawcodeurl"><a href="https://raw.githubusercontent.com/chupins/FreeCAD-macros/SC_Branch/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 a sub directory named CenterOfMass in the macro directory

toolBar icon

Macro CenterOfMass.png

Macro CenterOfMass save.png Macro CenterOfMass com.png Macro CenterOfMass compute.png Macro CenterOfMass import.png Macro CenterOfMass material.pngMacro CenterOfMass colorify.png


Macro CenterOfMass.FCMacro Download in Github


Macro CenterOfMass.FCMacro


Link

the forum discussion Macro to compute center of mass

Version

0.3.2 / 2019-03-14 : add a colorify push button to add color on shapes depending on their density

0.3.0 / 2019-03-03 : python 3 compatibility

0.2.3 / 2018-11-22 : new icon name

0.1.2 / 2018-11-10 : xx