Macro to compute center of mass

Show off your FreeCAD projects here!
User avatar
PrzemoF
Posts: 2481
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Macro to compute center of mass

Postby PrzemoF » Thu Mar 07, 2019 10:23 pm

I changed version of FreeCAD & updated your macro - now works. It was not finding any materials - only custom & default were available, but no calcs were performed. Thanks!
schupin
Posts: 238
Joined: Sun Jan 21, 2018 1:43 pm

Re: Macro to compute center of mass

Postby schupin » Thu Mar 14, 2019 9:50 pm

I just add a new button to automatically change the color of shapes depending on the density indicated :

colorify_1.png
colorify_1.png (161.6 KiB) Viewed 231 times

It might help on big model to identify materials.
(maybe it already exists on the BIM workbench, I didn't look at it...)
Syres
Posts: 180
Joined: Thu Aug 09, 2018 11:14 am

Re: Macro to compute center of mass

Postby Syres » Fri Mar 15, 2019 10:10 am

Thanks for the update and the colours should prove helpful. Just for info I had to change line 27 to:

Code: Select all

__Icon__ = 'https://www.freecadweb.org/wiki/images/4/41/Macro_CenterOfMass.png'
in order to stop this error :

Code: Select all

<unknown exception traceback><class 'SyntaxError'>: ("(unicode error) 'utf-8' codec can't decode byte 0xb3 in position 27: invalid start byte", ('E:/Data/FreeCAD/Macro/CenterOfMass.FCMacro', 126, 4, None))
I'm guessing there's a non-English character in there causing the error.

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16079 (Git)
Build type: Release
Branch: master
Hash: 6363c90a20b296ab69d7b52230009928199d90df
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedKingdom (en_GB)
schupin
Posts: 238
Joined: Sun Jan 21, 2018 1:43 pm

Re: Macro to compute center of mass

Postby schupin » Fri Mar 15, 2019 8:46 pm

Thanks for the feedback, I'm always struggling with unicode issues...

I've to check some other things, it seems that it doesn't download icon files while using the addon manager.