Problem: IMsProblem;
The Problem property determines the modeling problem, which calculates the metamodel.
Value of the property must be set to work with modelling scenarios. See IMsMetaModelVisualController.UseScenarios, IMsMetaModelVisualController.CopyScenarioData.
Executing the example requires that the repository contains a modeling container with the MODEL_SPACE identifier containing a modeling problem with the WEB_PROBLEM identifier. The task must contain the internal metamodel.
Add links to the Metabase, Ms system assemblies.
Sub UseScenarios;
Var
mb: IMetabase;
msKey: Integer;
Problem: IMsProblem;
Meta: IMsMetaModel;
MetaVisual: IMsMetaModelVisualController;
Begin
mb := MetabaseClass.Active;
// Get modelling container key
msKey := mb.GetObjectKeyById("MODEL_SPACE");
// Get modeling problem
Problem := mb.ItemByIdNamespace("WEB_PROBLEM", msKey).Edit As IMsProblem;
// Get metamodel
Meta := Problem.MetaModel;
MetaVisual := Meta.VisualController;
// Set the modeling problem
MetaVisual.Problem := Problem;
// Enable scenario modelling
If Not MetaVisual.UseScenarios Then
MetaVisual.UseScenarios := True;
End If;
// Save changes
(Problem As IMetabaseObject).Save;
End Sub UseScenarios;
After executing the example for calculation of the metamodel the scenario modelling will be used.
See also: