Below is the example of using the OpenMs operation to open a modeling container. The request contains the container moniker and a pattern for getting data. The response contains the opened modeling container instance moniker and data about the container scenarios.
{ "OpenMs" : { "tOb" : { "id" : "DHBHAJPMANJBFOAEDNFOJNMAGMDOKOGEAIHDMOJANENOLHHL!M!1581" }, "tArg" : { "args" : "", "metaGet" : { "obInst" : "false", "all" : "false", "scenarios" : "Get", "period" : "false" } } } }
{ "OpenMsResult" : { "id" : { "id" : "DHBHAJPMANJBFOAEDNFOJNMAGMDOKOGEAIHDMOJANENOLHHL!M!S!CBDMOGKANANJBFOAEKPBOKHMPKEPCPPFEAIEDKBCJMDFEGEIK" }, "meta" : { "scenarios" : { "nodes" : { "it" : [ { "@isFolder" : "0", "k" : "1628", "id" : "OBJ1628", "n" : "Basic", "vis" : "1", "scenDesc" : { "@fullUrl" : "http:\/\/v-shp-development.dev.fs.fsight.world\/", "@isShortcut" : "0", "@isLink" : "0", "@ver" : "0", "@hf" : "0", "i" : "OBJ1628", "n" : "Basic", "k" : "1628", "c" : "5124", "p" : "1627", "h" : "0", "hasPrv" : "0", "ic" : "0" }, "internalKey" : "1629" }, { "@isFolder" : "0", "k" : "5371", "id" : "OBJ5371", "n" : "Basic (copy1)", "vis" : "1", "scenDesc" : { "@fullUrl" : "http:\/\/v-shp-development.dev.fs.fsight.world\/", "@isShortcut" : "0", "@isLink" : "0", "@ver" : "0", "@hf" : "0", "i" : "OBJ5371", "n" : "Basic (copy1)", "k" : "5371", "c" : "5124", "p" : "1627", "h" : "0", "hasPrv" : "0", "ic" : "0" }, "internalKey" : "5372" } ] } } }, "readOnly" : "0" } }
The OpenMsMeta function gets information about scenarios from an opened modeling container. The repository connection moniker and container identifier are passed as input parameters. The example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier section.
public static MsScenarioTree OpenMsMeta(MbId mb, string msId) { // Get modeling container key ulong msKey = FindObjectById(mb, msId).k; // Set operation execution parameters var tMsOp = new OpenMs(); tMsOp.tArg = new OpenMsArg() { // Set container open parameters args = new MsOpenArgs(), // Set data get pattern metaGet = new MsMdPattern() { all = false, obInst = false, period = false, scenarios = ListOperation.Get } }; tMsOp.tOb = new OdId(); // Form modeling container moniker tMsOp.tOb.id = mb.id + "!" + msKey.ToString(); // Create proxy object for operation execution var somClient = new SomPortTypeClient(); // Open modeling container for edit OpenMsResult tResult = somClient.OpenMs(tMsOp); // Return scenario data MsMd mcMeta = tResult.meta; MsScenarioTree scTree = mcMeta.scenarios; return scTree; r
See also: