That is a sample code that asks you to select the Solid body for it, you can also use any other ways to specify it like if you know the index of the Solid as base solid you can just use below to specify it:
Set oBody1 = oDoc.ComponentDefinition.SurfaceBodies (1)
Or if you know the name(for example "Solid1") of a Solid to be used as base solid you can use below code to find it:
Dim oTempBody As SurfaceBody
For Each oTempBody In oDoc.ComponentDefinition.SurfaceBodies
If oTempBody.Name = "Solid1" Then
Set oSolid1 = oTempBody
Exit For
End If
Next
Or if you have ever set an attribute(for example "BaseSolid" as its value) to a Solid to indicate it is a base Solid, you can use below code to find it again:
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oSolid1 As SurfaceBody
Dim oAttributeMgr As AttributeManager
Set oAttributeMgr = oDoc.AttributeManager
Dim oCol As ObjectCollection
Set oCol = oAttributeMgr.FindObjects(, , "BaseSolid")
Set oSolid1 = oCol.Item(1)
The same way to get the Tool bodies if you know their indices/names/attribute value. Hope this helps.
If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.
Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.