Hi Team,
I am trying to generate the models using report instead of going to each and every object and selecting the option "Generate Model" by right clicking on it manually. I am half way through it. And I got stuck and doesn't know how to proceed. Can someone please let me know where I am doing wrong? Below is the function which I am using for generating model.
function generateModelfortheObject(objectName) { var group = objectName.Group(); var modelNew = Context.getComponent("ModelGeneration"); if(objectName.Name(g_nloc) == "XYZ") { modelNew.generateModelByObjDefs(objectName, objectName.Name(g_nloc), 21, group); } }
Thanks in advance.
Best Regards,
Srinivas.
var lSelectedObjDefs = ArisData.getSelectedObjDefs()
var modelNew = Context.getComponent("ModelGeneration");
var options = modelNew.createModelGenerationOptions()
var group = lSelectedObjDefs[0].Group();
modelNew.generateModelByObjDefs(lSelectedObjDefs, "Hallo", 21, group, options);
hope this helps, kind regards,
Ariene Kroeze
Hi Ariene Kroeze,
Thanks for your help!
However it is not working, I tried before also with options but in vain.
for(var i = 0; i < groups.length; i++) { // iterate through all groups var j = 0; var k = 0; var objectsApp = groups[i].ObjDefListFilter(6); for(k = 0; k < objectsApp.length; k++){ // iterate through all models in the group generateModelfortheObject(objectsApp[k]); } var childGroups = groups[i].Childs(true); for(j = 0; j < childGroups.length; j++){ //iterate through all sub groups var m = 0; var childobjectsApp = childGroups[j].ObjDefListFilter(6); for(m = 0; m < childobjectsApp.length; m++){ // iterate through all models in the group generateModelfortheObject(childobjectsApp[m]); } } } function generateModelfortheObject(objectName) { var group = objectName.Group(); var modelNew = Context.getComponent("ModelGeneration"); var options = modelNew.createModelGenerationOptions(); if(objectName.Name(g_nloc) == "XYZ") { modelNew.generateModelByObjDefs(objectName, objectName.Name(g_nloc), 21, group,options); } }
BR/Srinivas.
Hi Matias,
Now I can able to generate the model using report, However I cannot able to see the connections with the other objects, I know that can be possible with ModelGenerationOptions. Can you please let me know how the syntax will be to show the connections in the generated model? Many thanks in advance.
Best Regards,
Srinivas.
Hi Srinivas CH , you can set the new model's template like this, I tyied and it works.
var _subModel = modelNew.generateModelByObjDefs(ObjDefs, newModelName, Constants.MT_EEPC, group,options); _subModel.setTemplate("2ed57d10-68c8-11d7-5d85-000bcd25c95f");
_subModel.ApplyTemplate();