You have to read the REI documentation very carefully on this one.  The method GetAllClasses says:

        This function returns all classes belonging to all categories in the model
The key word here is "categories".  The only classes in Rose that have parent classes are nested classes.  Since they do not belong to a category, they are not returned by aModel.GetAllClasses().  The code below will get to the nested classes.

If your definition of ParentClass is other than class containing a nested class, then there are probably other ways to get what you are looking for.

Sub Main
        Dim cc As ClassCollection
        Set cc = RoseApp.CurrentModel.GetAllClasses()

        Viewport.open
        For i = 1 To cc.Count
                Print cc.GetAt(i).name
               
                If cc.GetAt(i).GetNestedClasses.Count > 0 Then
                        For j = 1 To cc.GetAt(i).GetNestedClasses.Count  
                                Print Tab(5); cc.GetAt(i).GetNestedClasses.GetAt(j).Name
                                If Not cc.GetAt(i).GetNestedClasses.GetAt(j).ParentClass Is Nothing Then
                                        Print Tab (10); cc.GetAt(i).GetNestedClasses.GetAt(j).ParentClass.Name
                                End If
                        Next j
                End If
        Next i
End Sub

Reply via email to