Hi, I am trying to create EPC models using Macros.
Hoping to get some help on the following areas in bold font.
try{
var myDBs = Context.getSelectedDatabases()
var mainGroup = Explorer.getMainGroup(myDBs[0]);
var group1=Explorer.createGroup ( mainGroup, "Group1" )
var model1= Explorer.createModel ( group1, "Model1", 13 )
var objDef1 = Explorer.createObjDef ( group1, "Activity1", 22, 335 )
Designer.createAssignmentExistingModelPersistent ( objDef1, model1)
// the Activity is created and assigned but is not renedered in the Model.
// Question: How do I create the object (Activity1) in the model?
var objDef2 = Explorer.createObjDef ( group1, "Subsystem", 270, 817) //object, symbol
// Exception throws: reference Error: "ObjDef1" is not defined
// Question: Why is this being thrown? objDef1 is defined. Is it that Activity1 is not created in the model?
Designer.createCxnDefPersistent ( objDef2, ObjDef1, 49 ) // 49 "is input for"
}
catch( e)
{
var a=e
}
Thanks!
Resolved:
try{
var myDBs = Context.getSelectedDatabases()
var mainGroup = Explorer.getMainGroup(myDBs[0]);
var group1=Explorer.createGroup ( mainGroup, "TestCase" )
var model1= Explorer.createModel ( group1, "Model1", 13 )
var objDef1 = Explorer.createObjDef ( group1, "Activity1", 22, 335 )
Designer.openModel(model1, false,false,false)
var objOccur = Designer.createObjOcc ( model1, objDef1, 335, new java.awt.Point(0,0) )
Designer.save(model1)
}
catch( e)
{
var a=e
var e=a
}