Hello Karen,

You note that you wish to retrieve classes, packages and realize
relationships from "class diagram." One can retrieve classes and packages
located on a class diagram but not realize relationships. First, the method
you listed retrieves classes belonging to a package/category and not to a
class diagram. Below is the code to retrieve classes and packages placed on
a class diagram.

    Dim theClassCollection As ClassCollection
    Dim theClass As Class
    Dim theClassDiagCollection As ClassDiagramCollection
    Dim theClassDiag As ClassDiagram
    Dim thePackageCollection As CategoryCollection
    Dim thePackage As Category
    Dim I As Integer
    
    Set theClassDiagCollection =
roseApp.CurrentModel.RootCategory.ClassDiagrams
    I = theClassDiagCollection.FindFirst("Main")
    If I < 1 Then
        Exit Sub
    End If
    ViewPort.Open
    Set theClassDiag = theClassDiagCollection.GetAt(I)
    
    Set thePackageCollection = theClassDiag.GetCategories
    For I = 1 To thePackageCollection.Count
        Set thePackage = thePackageCollection.GetAt(I)
        Print thePackage.Name
    Next I
    
    
    Set theClassCollection = theClassDiag.GetClasses
    For I = 1 To theClassCollection.Count
        Set theClass = theClassCollection.GetAt(I)
        Print theClass.Name
    Next I

To retrieve Realize relations, you should first fetch the classes and then
call the GetRealizeRelations method of the class.Please note however that
this method retrieves the collection of realize relations belonging to the
class and not just those displaying on the class diagram.

Please let me know if I can be of further assistance.

Cordially,
Oktay Amiry
Rose Technical Support
Rational Customer Service
Committed to Service Excellence
SCP Certified:  http://www.rational.com/support/scp.jsp
Rational Software
the Software Development company
http://www.rational.com/support/technotes/rose.jsp



> -----Original Message-----
> From: Muan Yong NG [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 23, 2002 10:00 AM
> To: [EMAIL PROTECTED]
> Subject: (ROSE) Retrieving packages and realize relations from class
> diagram
> 
> 
> 
> 
> Hi all.
> 
> 
> I have drawn some classes, packages and realize relationships 
> on a class 
> diagram in the logical views. For REI using VB script, i use 
> the following method to retrieve the 
> classes from the diagram:
> 
> Set theClasses = RoseApp.CurrentModel.RootCategory.Classes
> 
> 
> What method should i do to retrieve the packages and realize relation?
> 
> Thanks.
> 
> 
> Karen
> 
> **************************************************************
> **********
> * Rose Forum is a public venue for ideas and discussions.
> * For technical support, visit http://www.rational.com/support
> *
> * Post or Reply to: [EMAIL PROTECTED]
> * Subscription Requests: [EMAIL PROTECTED]
> * Archive of messages:
> *    http://www.rational.com/support/usergroups/rose/rose_forum.jsp
> * Other Requests: [EMAIL PROTECTED]
> *
> * To unsubscribe from the list, please send email
> *    To: [EMAIL PROTECTED]
> *    Subject: <BLANK>
> *    Body: unsubscribe rose_forum
> **************************************************************
> ***********
> 
************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
*
* Post or Reply to: [EMAIL PROTECTED]
* Subscription Requests: [EMAIL PROTECTED]
* Archive of messages:
*    http://www.rational.com/support/usergroups/rose/rose_forum.jsp
* Other Requests: [EMAIL PROTECTED]
*
* To unsubscribe from the list, please send email
*    To: [EMAIL PROTECTED]
*    Subject: <BLANK>
*    Body: unsubscribe rose_forum
*************************************************************************

Reply via email to