Obtain area/volume of a part or group of parts
The following is an example of a Python script to obtain an area.
# -*- coding: utf-8 -*-
app = designer.GetApplication()
#Initialization of variable to store area
vol = 0
vol_part_group = 0
#Area acquisition of individual parts
vol = app.GetModel(0).GetPart("Magnet").Area()
#Acquisition of area for parts group
vol_part_group = app.GetModel(0).GetGroupList().GetGroup("Coil").Area()
#View Results
print(u"The area of individual components is ",vol,u"(mm2)")
print(u"The area of the parts group is ",vol_part_group,u"(mm2)")
The following is an example of a Python script to obtain a volume.
# -*- coding: utf-8 -*-
app = designer.GetApplication()
#Initialization of variable to store volume
vol = 0
vol_part_group = 0
#Volume acquisition of individual parts
vol = app.GetModel(2).GetPart("Magnet").Volume()
#Acquisition of volume for parts group
vol_part_group = app.GetModel(2).GetGroupList().GetGroup("Coil").Volume()
#View Results
print(u"The volume of individual components is ",vol,u"(mm3)")
print(u"The volume of the parts group is ",vol_part_group,u"(mm3)")
Note:
・Area is available for 2D models, and 0 for 3D models.
・The volume is valid for 3D models, and is 0 for 2D models.
・The unit of volume follows the unit of length applied to the model.


