Hello friends welcome to FreeCAD tutorial in this tutorial we will learn how to Measure Area, Volume & Center of Mass with Python Script. In my previous blog post I have talk about FCinfo Macro to measure Mass Properties, Weight, Volume and Area etc. in FreeCAD. If you are good in Python then you have no need to depends on Macro or addon for small task.
First command which we run is
target_object = App.ActiveDocument.getObjectsByLabel("Body")[0]
In above code preplace “Body” with your label name you can easily find you body name easily all you have to click on body and go to data tab and see in Label section As shown in below image.
First Activate the Python console if it is not active As shown in below image.
I have Run command in Python Console successfully As you can see in Below image.
now we will run the script to measure Area volume and center of mass. find the area run the following script
target_object.Shape.Area
As you can see the result as shown in below image.
To find the Volume run the following script.
target_object.Shape.Volume
I have run the script As shown in below image.
To find the Center of Mass run the following script.
target_object.Shape.CenterOfMass
I have run the script As shown in below image.
“Thank you for reading! If you found this article insightful and valuable, consider sharing it with your friends and followers on social media. Your share can help others discover this content too. Let’s spread knowledge together. Your support is greatly appreciated!”