Freecad parametric modler 01

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.

Ko fi complete course 0925 r2

Also Read-:

How FreeCAD Becomes a Student’s Best Friend in Learning CAD
Automate FreeCAD with Python Scripting. Make Custom Tools and Workflows
Join the FreeCAD Community: A Guide to Connecting and Collaborating with Users

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.

Measure Area, Volume & Center Of Mass With Python Script 01

First Activate the Python console if it is not active As shown in below image.

Measure Area, Volume & Center Of Mass With Python Script 03

I have Run command in Python Console successfully As you can see in Below image.

Measure Area, Volume & Center Of Mass With Python Script 02

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.

Measure Area, Volume & Center Of Mass With Python Script 04

To find the Volume run the following script.

target_object.Shape.Volume

I have run the script As shown in below image.

Measure Area, Volume & Center Of Mass With Python Script 05

To find the Center of Mass run the following script.

target_object.Shape.CenterOfMass

I have run the script As shown in below image.

Measure Area, Volume & Center Of Mass With Python Script 06

“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!”

Mechnexus sharable profile) horizontal

Amar Patel

By Amar Patel

Hi, I am Amar Patel from India. Founder, Author and Administrator of mechnexus.com. Mechanical Design Engineer with more than 10+ Years of Experience. CAD Instructor, WordPress Developer, Graphic Designer & Content Creator on YouTube.

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock