Macro CenterOfMass: Difference between revisions

From FreeCAD Documentation
(Update for version 0.5)
mNo edit summary
Line 20: Line 20:


[[File:CenterOfMass_exemple.png]]
[[File:CenterOfMass_exemple.png]]
{{clear}}
<translate>
<translate>


Line 32: Line 31:


==Script== <!--T:11-->
==Script== <!--T:11-->



<!--T:12-->
<!--T:12-->
icon file download and paste in a sub directory named CenterOfMass in the macro directory
Icon file download and paste in a sub directory named CenterOfMass in the macro directory.


<!--T:18-->
<!--T:18-->
toolBar icon
toolBar icon
</translate>
</translate>

[[File:Macro_CenterOfMass.png]]
[[File:Macro_CenterOfMass.png]]

{{clear}}


'''Macro CenterOfMass.FCMacro'''
'''Macro CenterOfMass.FCMacro'''
Line 51: Line 46:


</translate>
</translate>

[https://github.com/FreeCAD/FreeCAD-macros/blob/master/Information/CenterOfMass.FCMacro Macro CenterOfMass.FCMacro]
[https://github.com/FreeCAD/FreeCAD-macros/blob/master/Information/CenterOfMass.FCMacro Macro CenterOfMass.FCMacro]

<translate>
<translate>


Line 65: Line 58:
<!--T:26-->
<!--T:26-->
0.5.0 / 2022-04-06 : complete rewrite by s-quirin (SyProLei project (Saarland University))
0.5.0 / 2022-04-06 : complete rewrite by s-quirin (SyProLei project (Saarland University))
* New: Code base, Requirement raised to Qt5.12+ and Python3 (FreeCAD 0.19).

* New: Show mass of each solid.
- New: Code base, Requirement raised to Qt5.12+ and Python3 (FreeCAD 0.19)
* New: Start window docked or floating (can be set in Parameter Editor).

* New: Selection matches up tree view or is sorted by name (can be set in Parameter Editor).
- New: Show mass of each solid
* New: Option to save densities in document.

* Improved: FreeCAD alike Gui look and feel.
- New: Start window docked or floating (can be set in Parameter Editor)
* Improved: Scaled color palette (from green to red) to colorify shapes.

* Improved: Visualising the displacement of centre of mass to the geometry.
- New: Selection matches up tree view or is sorted by name (can be set in Parameter Editor)
* Improved: Internal tracking of units.

* Fix: Handling of groups and group objects.
- New: Option to save densities in document
* Fix: Handling of App::Link.

* Fix: Replaced deprecated Qt class.
- Improved: FreeCAD alike Gui look and feel

- Improved: Scaled color palette (from green to red) to colorify shapes

- Improved: Visualising the displacement of centre of mass to the geometry

- Improved: Internal tracking of units

- Fix: Handling of groups and group objects

- Fix: Handling of App::Link

- Fix: Replaced deprecated Qt class


<!--T:28-->
<!--T:28-->
0.4.2 / 2019-06-09 : - check last version number on github and popup if not last version
0.4.2 / 2019-06-09 :
* Check last version number on github and popup if not last version.
- automatic update of show CdG (if it exists) when densities are changed
* Automatic update of show CdG (if it exists) when densities are changed.
- bug correction when changing radius
* Bug correction when changing radius.


<!--T:27-->
<!--T:27-->
0.4.1 / 2019-05-25 : add default density button, sphere cursor, change window behavior, correct a container part issue
0.4.1 / 2019-05-25 : Add default density button, sphere cursor, change window behavior, correct a container part issue.


<!--T:17-->
<!--T:17-->
0.3.6 / 2019-05-22 : Radius of pheres representing centers of mass of each solid depends on each masses
0.3.6 / 2019-05-22 : Radius of spheres representing centers of mass of solids depends on their masses.


<!--T:22-->
<!--T:22-->
0.3.5 / 2019-05-21 : Arrays and clone correction
0.3.5 / 2019-05-21 : Arrays and clone correction.


<!--T:23-->
<!--T:23-->
0.3.4 / 2019-03-18 : minor
0.3.4 / 2019-03-18 : Minor.


<!--T:24-->
<!--T:24-->
0.3.3 / 2019-03-17 : loading .csv corrections
0.3.3 / 2019-03-17 : Loading .csv corrections.


<!--T:25-->
<!--T:25-->
0.3.2 / 2019-03-14 : add a colorify push button to add color on shapes depending on their density
0.3.2 / 2019-03-14 : Add a colorify push button to add color to shapes depending on their density.


<!--T:21-->
<!--T:21-->
0.3.0 / 2019-03-03 : python 3 compatibility
0.3.0 / 2019-03-03 : Python 3 compatibility.


<!--T:19-->
<!--T:19-->
0.2.3 / 2018-11-22 : new icon name
0.2.3 / 2018-11-22 : New icon name.


<!--T:20-->
<!--T:20-->
0.1.2 / 2018-11-10 : xx
0.1.2 / 2018-11-10 :


</translate>
</translate>

Revision as of 09:51, 9 April 2022

Macro CenterOfMass

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

Macro version: 0.5.0
Last modified: 2022-04-06
Author: chupins, s-quirin
Author
chupins, s-quirin
Download
None
Links
Macro Version
0.5.0
Date last modified
2022-04-06
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. Link for optional manual installation: Macro


# 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")


Usage

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.FCMacro Download in Github

Macro CenterOfMass.FCMacro

Link

the forum discussion Macro to compute center of mass

Version

0.5.0 / 2022-04-06 : complete rewrite by s-quirin (SyProLei project (Saarland University))

  • New: Code base, Requirement raised to Qt5.12+ and Python3 (FreeCAD 0.19).
  • New: Show mass of each solid.
  • New: Start window docked or floating (can be set in Parameter Editor).
  • New: Selection matches up tree view or is sorted by name (can be set in Parameter Editor).
  • New: Option to save densities in document.
  • Improved: FreeCAD alike Gui look and feel.
  • Improved: Scaled color palette (from green to red) to colorify shapes.
  • Improved: Visualising the displacement of centre of mass to the geometry.
  • Improved: Internal tracking of units.
  • Fix: Handling of groups and group objects.
  • Fix: Handling of App::Link.
  • Fix: Replaced deprecated Qt class.

0.4.2 / 2019-06-09 :

  • Check last version number on github and popup if not last version.
  • Automatic update of show CdG (if it exists) when densities are changed.
  • Bug correction when changing radius.

0.4.1 / 2019-05-25 : Add default density button, sphere cursor, change window behavior, correct a container part issue.

0.3.6 / 2019-05-22 : Radius of spheres representing centers of mass of solids depends on their masses.

0.3.5 / 2019-05-21 : Arrays and clone correction.

0.3.4 / 2019-03-18 : Minor.

0.3.3 / 2019-03-17 : Loading .csv corrections.

0.3.2 / 2019-03-14 : Add a colorify push button to add color to 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 :