I am developing a macro in CATIAVBA to automatically detect standard components, we are looping through the bodies since they have been imported from a previous version of CATIA, and we have found that standard components follow a rule related to the volume but we are not able to find a way to retrieve the volume from the body directly. Is there a way to do this?
We tried exploring the properties available in bodies and solids but were unable to find anything so far. Any help will be appreciated.
NOTE: We found out it is possible to retrieve it from the product, but this is no use to us in our specific application.
Sub CATMain()
For Each doc In CATIA.Documents
If TypeOf doc Is PartDocument Then
Set part = doc.part
Set body = part.MainBody
Dim spaWorkbench As Workbench
Set spaWorkbench = doc.GetWorkbench("SPAWorkbench")
Dim reference As reference
Set reference = part.CreateReferenceFromObject(body)
Dim measure As Measurable
Set measure = spaWorkbench.GetMeasurable(reference)
MsgBox measure.Volume
End If
Next
End Sub