Creating a Modeling Container

Executing the example requires that the repository contains a database with the BD identifier.

Sub Main;

Var

MB: IMetabase;

CrInfo: IMetabaseObjectCreateInfo;

MObj: IMetabaseObject;

Kont: IMsModelSpace;

Begin

MB := MetabaseClass.Active;

CrInfo := MB.CreateCreateInfo;

CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_MODELSPACE;

CrInfo.Id := "Kont_Model";

CrInfo.Name := New modeling container;

CrInfo.Parent := MB.Root;

MObj := MB.CreateObject(CrInfo).Edit;

Kont := MObj As IMsModelSpace;

Kont.Database := MB.ItemById("BD").Bind As IDatabase;

Kont.StartDate := DateTime.ComposeDay(2000, 1, 1);

Kont.EndDate := DateTime.AddYears(Kont.StartDate, 10);

MObj.Save;

End Sub Main;

After executing the example a modeling container is created in the root directory of repository. Calendar period for the given container is set to 10 years.

See also:

Examples