Macro to compute center of mass

Show off your FreeCAD projects here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Macro to compute center of mass

Post by Kunda1 »

Should this stay as a macro or be made/integrated in to a workbench ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
schupin
Posts: 476
Joined: Sun Jan 21, 2018 1:43 pm

Re: Macro to compute center of mass

Post by schupin »

Kunda1 wrote: Sat Nov 10, 2018 4:57 pm Should this stay as a macro or be made/integrated in to a workbench ?
I can try to put it in a tiny workbench but I don't know how to do it at all :)
(I'll look at the other WB and find "inspiration")

I don't know if it could be integrated with an existing workbench ? Perhaps an assembly or material WB ?
schupin
Posts: 476
Joined: Sun Jan 21, 2018 1:43 pm

Re: Macro to compute center of mass

Post by schupin »

I just made a little update to correct a selection problem with features and bodies.
Now, no matter how you select your solid (from the treeview or the 3D view) and the kind of solid, It might work.

I have put the files on github : https://github.com/chupins/FCmacro_CenterOfMass
galou_breizh
Posts: 436
Joined: Wed Sep 15, 2010 9:38 am

Re: Macro to compute center of mass

Post by galou_breizh »

The location of the macro on the official repository is https://github.com/FreeCAD/FreeCAD-macr ... nformation. It should be installable with the Addon-Manager from v0.18 but the Addon-Manager of v0.17 doesn't support extra files, so that icons will be missing.

@schupin, please base your future modifications on this version and, at best, delete your repository to avoid confusion. Thanks a lot! Can you please add the appropriate attribution for the icons?

Gaël
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Macro to compute center of mass

Post by Kunda1 »

Nice :thumbsup:
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
schupin
Posts: 476
Joined: Sun Jan 21, 2018 1:43 pm

Re: Macro to compute center of mass

Post by schupin »

galou_breizh wrote: Sun Nov 11, 2018 11:03 pm The location of the macro on the official repository is https://github.com/FreeCAD/FreeCAD-macr ... nformation. It should be installable with the Addon-Manager from v0.18 but the Addon-Manager of v0.17 doesn't support extra files, so that icons will be missing.

@schupin, please base your future modifications on this version and, at best, delete your repository to avoid confusion. Thanks a lot! Can you please add the appropriate attribution for the icons?

Gaël
Thanks Gaël !

I've deleted my repository. How does it work if I have a new version to push ? Am I allowed to push into this repo ?

On my version, I don't see the macro on the addon manager. Or perhaps it's my eyes ?

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.5235 (Git shallow)
Build type: Release
Branch: (HEAD detached at 2a6655e)
Hash: 2a6655e1768d80e0098d410989ae02c622f2e698
Python version: 2.7.15
Qt version: 5.11.1
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: French/France (fr_FR)
galou_breizh
Posts: 436
Joined: Wed Sep 15, 2010 9:38 am

Re: Macro to compute center of mass

Post by galou_breizh »

To submit a newer version of the macro you have to fork the whole repository, make the changes in your fork and submit a pull request.

In order to download macros from git you need the `python-git` package or similarly named.

Gaël
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Macro to compute center of mass

Post by Kunda1 »

galou_breizh wrote: Mon Nov 12, 2018 7:26 am In order to download macros from git you need the `python-git` package or similarly named.
I thought that the addon-manager checks if python-git is present and uses it, but if not it will use https:// instead ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
schupin
Posts: 476
Joined: Sun Jan 21, 2018 1:43 pm

Re: Macro to compute center of mass

Post by schupin »

I don't know how to install the python-git package (or if it's already on my computer ?)

When I put "import git" on the python console I get an error message

Code: Select all

ImportError: No module named git
(but git is installed on my mac)

Any hint to solve it ?
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Macro to compute center of mass

Post by Kunda1 »

Is it as simple as this?
pip install python-git --upgrade
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply