You can create extensions by script to define additional properties, new metaclasses, forms, and any other type of extension to the standard metamodel.
Dim MyModel, MyExt, MyStype, MyExAtt, MyForm, FormDef set MyModel = CreateModel(PdEAM.Cls_Model,"Diagram=TechnologyInfrastructureDiagram") MyModel.SetNameAndCode "MyEAM" , "MyEAM" 'Create extension Set MyExt = MyModel.ExtendedModelDefinitions.CreateNew() MyExt.Name = "MyExtension" MyExt.Code = "MyExtension" 'Create stereotype Set MyStype = MyExt.AddMetaExtension(PdEAM.Cls_MobileDevice, Cls_StereotypeTargetItem) MyStype.Name = "Tablet" MyStype.UseAsMetaClass = true 'Create extended atrribute Set MyExAtt = MyStype.AddMetaExtension(Cls_ExtendedAttributeTargetItem) MyExAtt.Name = "TabletType" MyExAtt.Label = "Type" MyExAtt.DataType = "12" ' (String) For a full list of values, ' see ExtendedAttributeTargetItem in the Metamodel objects help MyExAtt.ListOfValues = "iPad;Android;Playbook;Windows8" MyExAtt.Value = "iPad" 'Create form to replace General tab Set MyForm = MyStype.AddMetaExtension(Cls_FormTargetItem) MyForm.Name = "ReplaceGeneral" MyForm.FormType = "GENERAL" 'Assemble form definition FormDef = "<Form><StandardNameAndCode Attribute=""NameAndCode"" />" & vbcrlf FormDef = FormDef + "<StandardAttribute Attribute=""Comment"" />" & vbcrlf FormDef = FormDef + "<ExtendedAttribute Attribute=""TabletType"" />" & vbcrlf FormDef = FormDef + "<StandardAttribute Attribute=""KeywordList"" /></Form>" MyForm.Value = FormDef
Dim col, obj
'The collection of tablets is not directly accessible
set col = ActiveModel.GetCollectionByStereotype("Tablet")
'Create an array to hold the values to assign to tablet properties
Dim myArray(3)
myArray(0) = "Tablet1, T1, PlayBook"
myArray(1) = "Tablet2, T2, Android"
myArray(2) = "Tablet3, T3, iPad"
myArray(3) = "Tablet4, T4, iPad"
CreateObjects col, myArray
'Procedure to assign values to properties
Sub CreateObjects(compColl, dataArray)
For Each line In dataArray
Dim myProps
myProps = split(line, ",")
set obj = compColl.CreateNew()
obj.Name = myProps(0)
obj.Code = myProps(1)
'Special syntax for setting extended attribute
obj.SetExtendedAttribute "MYEXT.TabletType", myProps(2)
Next
End Sub