CheckGeometry tool now with advanced shape content

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

CheckGeometry tool now with advanced shape content

Post by TheMarkster »

CheckGeometry tool in Part workbench now includes advanced information in the Shape Content panel. This includes information such as volume, mass, length, area, center of mass, among other things, depending on the type of shape object being checked. This screenshot is from checking a default Part workbench Cube object:
Snip macro screenshot-857f7f.png
Snip macro screenshot-857f7f.png (27.79 KiB) Viewed 3491 times
I don't know what some of that stuff means, but I'm sure someone does.

Advanced shape content can be disabled in the settings:
Snip macro screenshot-2ae005.png
Snip macro screenshot-2ae005.png (27.08 KiB) Viewed 3491 times
This is when checking a sketch containing a single arc of circle, end points constrained to the horizontal axis 180 degrees apart, centered at the origin with radius 5mm:
Snip macro screenshot-920c07.png
Snip macro screenshot-920c07.png (28.56 KiB) Viewed 3491 times
And this the same sketch, but now it's a full circle instead of the semi-circle:
Snip macro screenshot-8a8ad3.png
Snip macro screenshot-8a8ad3.png (27.77 KiB) Viewed 3491 times
Notice how the isClosed property is true for one and false for the other. And also the center of mass is different for the arc since all of the mass of the object is above the x axis.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: CheckGeometry tool now with advanced shape content

Post by sgrogan »

TheMarkster wrote: Fri Sep 11, 2020 9:48 pmmass,
Where is density pulled from? Looks like 1 by default.
"fight the good fight"
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: CheckGeometry tool now with advanced shape content

Post by TheMarkster »

It's done with python and produces whichever value gets returned from:

Code: Select all

obj.Shape.Mass
where obj is the object being checked.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: CheckGeometry tool now with advanced shape content

Post by sgrogan »

TheMarkster wrote: Fri Sep 11, 2020 10:11 pm It's done with python and produces whichever value gets returned from:
Thanks, but I still don't understand.
For example a default Part Cube.
Do I need to use an Arch or FEM object that supports material, or add a property with dd Workbench to the cube?
I think I'm missing something very fundamental.
"fight the good fight"
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: CheckGeometry tool now with advanced shape content

Post by vocx »

sgrogan wrote: Fri Sep 11, 2020 10:07 pm Where is density pulled from? Looks like 1 by default.
I think it just uses the default units.

For example, a cube of 1 mm x 1 mm x 1 mm (unit length in each direction), that is, 1 mm^3, corresponds to one 1 unit volume, and has a mass of 1 unit mass, which is 1 kg. So the basic density would be 1 kg/mm^3.

Code: Select all

>>> App.Units.Mass
Unit: kg (0,1,0,0,0,0,0,0) [Mass]
>>> App.Units.Volume
Unit: mm^3 (3,0,0,0,0,0,0,0) [Volume]
>>> App.Units.Density
Unit: kg/mm^3 (-3,1,0,0,0,0,0,0) [Density]
You could define another parameter to hold a custom density and calculate the mass in that way.
Last edited by vocx on Sun Sep 13, 2020 4:21 pm, edited 2 times in total.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: CheckGeometry tool now with advanced shape content

Post by TheMarkster »

At this time CheckGeometry does not calculate any of that information. It only reports what's already there, which can be found by examining the object in the python console. For example, the mass is reported as what can be found by entering obj.Shape.Mass in the python console. The same is true for the other properties reported, such as Area, Volume, Length, etc. if somebody knows a way in python to check for the material associated with an object to get its density I can add some code to CheckGeometry to find a calculated mass and report that.
User avatar
Vincent B
Veteran
Posts: 4711
Joined: Sun Apr 05, 2015 9:02 am
Location: La Rochelle, France

Re: CheckGeometry tool now with advanced shape content

Post by Vincent B »

nice improvement. easy to use. ;)
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: CheckGeometry tool now with advanced shape content

Post by Kunda1 »

Nice this needs to be added to the 0.19 release notes
Along with Macro Recent history list
Great work TheMarkster!
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
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: CheckGeometry tool now with advanced shape content

Post by jmaustpc »

TheMarkster wrote: Fri Sep 11, 2020 9:48 pm This is when checking a sketch containing a single arc of circle, end points constrained to the horizontal axis 180
Seems strange that 2d objects have a mass. On my phone just now, so no idea if that is being wrongly reported in checkgeometry or if it's there in the object itself.
polymer
Posts: 278
Joined: Fri Sep 12, 2014 8:49 am

Re: CheckGeometry tool now with advanced shape content

Post by polymer »

What about projected surface area in X, Y and Z direction?
Post Reply