How to find surface area or volume in mechanical scriting
Happy Kumar
Member Posts: 15
**
in Structures
I want to find the surface area of surface and volume of different body which is in name selection by looping how I can do this ?
0
Answers
-
Hello, you can use the GeoData
Faces Example
Volume Example
Code:
geoData=ExtAPI.DataModel.GeoData #-----Calculate Face Areas-----# myfacesNS = ExtAPI.DataModel.GetObjectsByName("MYFACES")[0] TotalArea = 0 for faceId in myfacesNS.Location: face = geoData.GeoEntityById(faceId) TotalArea += face.Area print("Total Area = " + str(TotalArea)) #-----Calculate Bodies Volumes-----# myBodiesNS = ExtAPI.DataModel.GetObjectsByName("MYVOLUMES")[0] TotalVolume = 0 for bodyId in myBodiesNS.Location: body = geoData.GeoEntityById(bodyId) TotalVolume += body.Volume print("Total Volume = " + str(TotalVolume))
Solution
Total Area = 0.00119999996969
Total Volume = 1.6e-051