Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
2 replies Latest Post - ‏2012-12-20T10:39:24Z by SystemAdmin
SystemAdmin
SystemAdmin
2260 Posts
ACCEPTED ANSWER

Pinned topic how to get the activity diagram in RoseRT? (C#)

‏2006-09-30T18:06:18Z |
Hallo everyone,

My code:

this.m_RoseRTApp = (RoseRT.Application)Marshal.GetActiveObject("RoseRT.Application");
this.m_RoseRTModel = this.m_RoseRTApp.CurrentModel;
RoseRT.LogicalPackage rootLogicalPackage = m_RoseRTModel.RootLogicalPackage;
RoseRT.AnalysisStateMachineOwner owner = rootLogicalPackage.AnalysisStateMachineOwner;
Console.WriteLine("Count: " + owner.AnalysisStateMachines.Count);

And now I get the Error message:
Error: Called an RRTEI function from an REI object.

And I can not go on any more.

Who can help me please?

Thx!
Updated on 2012-12-20T10:39:24Z at 2012-12-20T10:39:24Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    2260 Posts
    ACCEPTED ANSWER

    Re: how to get the activity diagram in RoseRT? (C#)

    ‏2007-07-26T07:21:54Z  in response to SystemAdmin
    Hi ,
    We can get handel of activity diagram in RoseRT using vB code.

    Problem : In the below model ,User wants to add a state on NewActivityDiagram.

    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Use Case view

    Logical View ---
    |---State/Activity Model1----
    |----NewActivityDiagram
    Component View

    deployement View
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Answer - The below RRTEI/VB code can be useful to acomplish this task,

    Sub Main
    Set thePackage = RoseRTApp.currentModel.RootLogicalPackage
    set theAnalysisColl = thePackage.GetAllAnalysisStateMachines()

    for counter=1 to theAnalysisColl.Count
    If theAnalysisColl.GetAt(counter).Name = "State/Activity Model1" Then
    goto level1
    end if
    next counter

    level1:

    Set AnalysisStateMachine = theAnalysisColl.GetAt(counter)

    Set AnalysisStateDiagColl = AnalysisStateMachine.Diagrams
    for counter1=1 to AnalysisStateDiagColl.Count
    If AnalysisStateDiagColl.GetAt(counter1).Name = "NewActivityDiagram" Then
    goto level2
    end if
    next counter

    level2:

    Set theActivitydiagram = AnalysisStateDiagColl.GetAt(counter1)

    set TheState = AnalysisStateMachine.AddAnalysisState("NewState")

    Set TheStateview = theActivitydiagram.AddAnalysisStateView(TheState)

    End Sub
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    I don't have much knowledge about C# but you can developed similar code in c#.

    Thanks
  • SystemAdmin
    SystemAdmin
    2260 Posts
    ACCEPTED ANSWER

    Re: how to get the activity diagram in RoseRT? (C#)

    ‏2012-12-20T10:39:24Z  in response to SystemAdmin
    Hi Everybody,

    To Capture all elements in all type of diagrams,predefined methods and attributes are there in Rational Rose RT Extensibility interface reference documentation except for activity diagram.Is there any reference documentation for capturing activity diagram?

    So, Any one help me, Are there any predefined methods for capturing activityDiagram other than the following methods
    1.GetAllAnalysisStateMachines()
    2.Diagrams
    3.AddAnalysisStateView()
    4.AddAnalysisState()?

    I wanted to know predefined methods to read activity, state, start state, end state,Transition, self transition, Horizontal synchronization,vertical synchronization,decision and swimlane.

    Could you please help me soon :)

    Thanks in advance

    Regards

    Lakshmi Narayana,