Hello, I'm attempting to write a macro that will determine the volume of each solid body within a part. I have the code for how to sequentially step through each body, but I do not how how to find the volume for only a single solid body. The following is the portion of code that I can use to find the volume of a part:
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2 Dim dSize As Double
Dim swMass As SldWorks.MassProperty
Set swApp = CreateObject("SldWorks.Application")
Set swModel = swApp.ActiveDoc
Set swMass = swModel.Extension.CreateMassProperty
dVolume = swMass.Volume
Currently this code selects all solid bodies in the part whether they are hidden or not. If you could help me change/replace the code above so that it determines only the volume of a single solid body, I would appreciate it.