You can create a selection of objects using the CreateSelection() method. You can perform actions on the selection such as changing properties or format or moving them to another package.
Dim MyModel, obj, sym set MyModel = CreateModel(PdPDM.Cls_Model,"DBMS=SYASA12") MyModel.SetNameAndCode "MyPDM" , "MyPDM" 'Create tables For idx = 1 to 12 Set obj=MyModel.Tables.CreateNew() obj.SetNameAndCode "T" & idx, "T" & idx Set sym=ActiveDiagram.AttachObject (obj) Next ActiveDiagram.AutoLayoutWithOptions(2) 'Create package Dim MyPackage Set MyPackage=MyModel.Packages.CreateNew() MyPackage.SetNameAndCode "P1", "P1" ActiveDiagram.AttachObject (MyPackage) 'Create selection Dim MySelection Set MySelection = ActiveModel.CreateSelection For idx = 1 to 5 MySelection.Objects.Add(MyModel.FindChildByName("T" & (idx*2),cls_table)) Next 'Move selection to package MySelection.MoveToPackage(MyPackage)To add all the tables to the selection, use the AddObjects method:
MySelection.AddObjects MyModel,cls_tableTo remove an object from the selection, use the Remove method:
MySelection.Objects.Remove(MyModel.FindChildByName("T6",cls_table))