Below is the example of using the SetMs operation to create a metamodel parameter. The request contains an instance of opened modeling container, parameters of operation execution, and parameters of the created parameter. After execution the operation returns the metamodel that contains parameters.
{ "SetMs" : { "tMs" : { "id" : "S11!M!S!C1"
}, "tArg" : { "pattern" : { "obInst" : "true", "item" : { "key" : "2804", "metaModel" :
{ "mmParams" : "Add" } } }, "meta" : { "item" : { "k" : "0",
"type" : "Unknown", "metaModelMd" : { "mmParams" : { "its" : { "Item" : { "k" : "0",
"n" : "testParam", "dataType" : "3", "defaultValue" : "0", "hidden" : "false" } } } } } },
"metaGet" : { "obInst" : "true", "item" : { "key" : "2804", "metaModel" : { "mmParams" : "Get" }
} }, "execParams" : { "execSaveMetaModel" : "true" } } } } } }
{ "SetMsResult" : { "id" : { "id" : "S11!M!S!C1" }, "meta" : {
"obInst" : { "obDesc" : { "@isShortcut" : "0", "i" : "MODELSPACE", "n" : "Modeling container", "k" : "1581", "c" : "5121", "p" : "1580",
"h" : "0" } }, "dirty" : "0", "item" : { "k" : "2804", "id" : "OBJ2804", "n" : "Model", "vis" : "1",
"type" : "MetaModel", "metaModelMd" : { "k" : "2804", "mmParams" : { "its" : { "Item" : [
{ "k" : "1", "id" : "ITEM1", "n" : "testParam", "vis" : "1", "dataType" : "3", "defaultValue" : "0", "hidden" : "0", "tag" : "" }
] } }, "visualController" : "" } } }
public static void SetMsAddParam(MsId ms, ulong mModelKey) { var setMsOp = new SetMs(); setMsOp.tMs = ms; setMsOp.tArg = new SetMsArg() { // Set data change pattern pattern = new MsMdPattern() { item = new MsItemPattern() { // Set metamodel key key = mModelKey, metaModel = new MsMetaModelPattern() {mmParams = ListOperation.Add}
} }, // Set data that must be changed meta = new MsMd { item = new MsItem { metaModelMd = new MsMetaModel { mmParams = new MsModelParams
{ its = new MsModelParam[] { new MsModelParam { n = "testParam", dataType = 3, defaultValue = "0", linkedObjectKey = null, hidden = false,
tag = null } } } } } }, metaGet = new MsMdPattern() { item = new MsItemPattern()
{ key = mModelKey, metaModel = new MsMetaModelPattern() { mmParams = ListOperation.Get } } }, execParams = new MsMdExecParams() { execSaveMetaModel = true } }; // Create a proxy object for operation execution var somClient = new SomPortTypeClient(); // Set operation execution parameters var result = somClient.SetMs(setMsOp); }
See also: