Copy;
The Copy method copies modeling container.
For correct copying execution, set the values of the properties IMsModelSpaceCopier.DestinationModelSpace and IMsModelSpaceCopier.SourceModelSpace.
Executing the example requires a modeling container with the MS_SOURCE identifier. It is also necessary to add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
CreateInfo: IMetabaseObjectCreateInfo;
Copier: IMsModelSpaceCopier;
MsDest, MsSource: IMetabaseObjectDescriptor;
Begin
mb := MetabaseClass.Active;
// Create an output modeling container
CreateInfo := mb.CreateCreateInfo;
CreateInfo.ClassId := MetabaseObjectClass.KE_CLASS_MODELSPACE;
MsDest := mb.CreateObject(CreateInfo);
// Get source modeling container
MsSource := mb.ItemById("MS_SOURCE");
// Create an object that will copy containers
Copier := New MsModelSpaceCopier.Create;
// Set source and output containers
Copier.DestinationModelSpace := MsDest;
Copier.SourceModelSpace := MsSource;
// Set copying parameters
Copier.WithObjects := True;
Copier.WithObjectsData := False;
// Execute copying
Copier.Copy;
Debug.WriteLine("Container '" + MsSource.Name +
"' copied to container '" + MsDest.Name + "' with objects, but without data");
End Sub UserProc;
After executing the example the MS_SOURCE modeling container is copied with objects but without data. Information about it is displayed in the console window.
See also: