Macro to compute center of mass

Show off your FreeCAD projects here!
User avatar
Kunda1
Posts: 5947
Joined: Thu Jan 05, 2017 9:03 pm

Re: Macro to compute center of mass

Postby Kunda1 » Sat Nov 10, 2018 4:57 pm

Should this stay as a macro or be made/integrated in to a workbench ?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
schupin
Posts: 304
Joined: Sun Jan 21, 2018 1:43 pm

Re: Macro to compute center of mass

Postby schupin » Sat Nov 10, 2018 10:53 pm

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: 304
Joined: Sun Jan 21, 2018 1:43 pm

Re: Macro to compute center of mass

Postby schupin » Sun Nov 11, 2018 4:52 pm

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: 259
Joined: Wed Sep 15, 2010 9:38 am

Re: Macro to compute center of mass

Postby galou_breizh » 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
User avatar
Kunda1
Posts: 5947
Joined: Thu Jan 05, 2017 9:03 pm

Re: Macro to compute center of mass

Postby Kunda1 » Mon Nov 12, 2018 12:35 am

Nice :thumbsup:
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
schupin
Posts: 304
Joined: Sun Jan 21, 2018 1:43 pm

Re: Macro to compute center of mass

Postby schupin » Mon Nov 12, 2018 7:09 am

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: 259
Joined: Wed Sep 15, 2010 9:38 am

Re: Macro to compute center of mass

Postby galou_breizh » Mon Nov 12, 2018 7:26 am

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
Posts: 5947
Joined: Thu Jan 05, 2017 9:03 pm

Re: Macro to compute center of mass

Postby Kunda1 » Mon Nov 12, 2018 11:47 am

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 ?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
schupin
Posts: 304
Joined: Sun Jan 21, 2018 1:43 pm

Re: Macro to compute center of mass

Postby schupin » Mon Nov 12, 2018 12:50 pm

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
Posts: 5947
Joined: Thu Jan 05, 2017 9:03 pm

Re: Macro to compute center of mass

Postby Kunda1 » Mon Nov 12, 2018 3:28 pm

Is it as simple as this?
pip install python-git --upgrade
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features