'Disclaimer: 'THE MATERIAL AND/OR SOFTWARE IS PROVIDED 'AS IS'. 'RATIONAL AND ITS THIRD PARTY LICENSORS DISCLAIM ALL 'REPRESENTATIONS OR WARRANTIES EXPRESS OR IMPLIED INCLUDING, 'WITHOUT LIMITATION, THE WARRANTY OF MERCHANTABILITY, 'NON-INFRINGEMENT, TITLE OR FITNESS FOR A PARTICULAR PURPOSE 'OR ARISING OUT OF THE COURSE OF DEALING, USAGE OR TRADE PRACTICE, 'CONTENT OF THE MATERIAL OR SOFTWARE. RATIONAL MAKES NO WARRANTIES 'OR REPRESENTATIONS REGARDING THE ACCURACY OR COMPLETENESS OF 'THE MATERIAL AND/OR SOFTWARE PROVIDED OR THAT IT WILL MEET 'LICENSEE'S REQUIREMENTS OR THAT THE MATERIAL AND/OR SOFTWARE 'WILL BE ERROR FREE. IN NO EVENT SHALL RATIONAL OR ITS LICENSORS 'BE LIABLE TO LICENSEE OR A THIRD PARTY FOR ANY INDIRECT, DIRECT, 'NEGLIGENCE, SPECIAL, OR CONSEQUENTIAL DAMAGES INCLUDING LOST PROFITS, 'LOST DATA AND THE LIKE ARISING OUT OF OR IN CONNECTION WITH THIS 'RECEIPT OF MATERIAL AND/OR SOFTWARE EVEN IF RATIONAL HAS BEEN ADVISED 'OF THE POSSIBILITY OF SUCH DAMAGES. 'This script creates one package containing: '1 Parametrized class with 1 parameter '1 helper class (actual value of the parameter) '1 Anonymous Instantiated class '1 derived class that inherits from the 'Anonymous Instantiated class Option Explicit Dim StrPClass As String Dim PClass As class Dim StrHClass As String Dim HClass As class Dim StrAClass As String Dim AClass As Class Dim StrDClass As String Dim DClass As class Dim StrCat As String Dim Cat As category Sub DefineNames StrCat = "ThePackage" StrPClass ="TheParametrizedClass" 'As this class is anonymous, empty name StrAClass = "" StrDClass = "TheDerivedClass" StrHClass = "TheHelperClass" End Sub Sub CreateCategoryAndClasses Dim themodel As model Set themodel = roseapp.currentmodel 'create the category Set cat = themodel.rootcategory.addcategory(StrCat) 'Create the helper Class Set HClass = cat.addClass(StrHClass) 'create the parametrized class Set PClass = cat.addclass(StrPClass) PClass.ClassKind.Value = 1 roseapp.writeerrorlog PClass.getqualifiedname +" "+PClass.ClassKind.Name Dim theFormalParameter As Parameter Set theFormalParameter = PClass.AddParameter("T","class","",0) 'create the instantiated class Set AClass = cat.addclass(StrAClass) AClass.ClassKind.Value = 2 roseapp.writeerrorlog AClass.getqualifiedname +" "+AClass.ClassKind.Name Dim theActualParameter As Parameter Set theActualParameter = AClass.addParameter(StrHClass,"","",0) 'create the derived class Set DClass = cat.addclass(StrDClass) End Sub Sub CreateRelationships 'create the instantiates relationship Dim theInstRel As InstantiateRelation Set theInstRel = AClass.addInstantiateRel(StrPClass) 'create the inheritance relationship Dim theInheRel As inheritRelation 'name the annymous class temporarily, otherwise the inheritance cannot be added AClass.name = "xxx" Set theInheRel = DClass.AddInheritRel("Inheritance",AClass.Name) AClass.name = "" End Sub Sub CreateDiagram Dim i As Integer Dim isadded As Boolean Dim theclass As class Dim theDiag As classdiagram Set thediag = cat.addClassDiagram("MainDiagram") For i = 1 To cat.classes.count Set theclass = cat.classes.getat(i) isadded = thediag.addclass(theclass) Next i End Sub Sub Main Call defineNames Call CreateCategoryAndClasses Call CreateRelationships Call CreateDiagram End Sub