I'm working with VBA aiming to create a macro which changes the material and thickness in simulation study (something like that, but with suface bodies in the active study: Create Nonlinear Study and Apply Materials Example). The surface bodies, material and thickness will be given by user. Surface bodies can be selected using Property manager selection box.
Dim pm_Selection As PropertyManagerPageSelectionbox
Set pm_Selection = pm_Group.AddControl(SelectionID, controlType, caption, alignment, options, tip)
How to connect the chosen surface bodies to the shells of CosmosWorksLib.CWShell (Dim Shell As CosmosWorksLib.CWShell)? Is there any other (=better) way than looking for them by using names, that can be achieved by pm_Selection.ItemText?
The problem seems to be when trying to get selections:
For i = 1 To swSelectionMgr.GetSelectedObjectCount2(mark) ' This works OK
ReDim Preserve selectedBodies(1 To i)
selectedBodies(i) = pm_Selection.ItemText(i - 1) ' This works OK
MsgBox swSelectionMgr.GetSelectedObjectType3(i, mark) ' This works OK
selObject = swSelectionMgr.GetSelectedObject6(i, mark) ' This is not working, selObject is of type Object