Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic Rhapsody (steve huntington)
Decrease font size
Increase font size
Topic Title: addnewaggr - object to object
Topic Summary:
Created On: 1-Oct-2007 16:42
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 1-Oct-2007 16:42
User is offline View Users Profile Print this message


kiwan kim

Posts: 8
Joined: 24-Sep-2007

I can add an RPModel element from a package using vba addnewaggr method but i can't add an RPModel element from another RPModel element. I also tried changing the owner to reflect this hiearchy and it doesn't work.

From Rhapsody I can add a RPModel element in this case Operational Activity to another Operational activity. In the API documentation it states this can be done for any objects.

Does anyone know how to include an RPmodel element to another RPModel element.. Thanks..
Report this to a Moderator Report this to a Moderator
 2-Oct-2007 07:21
User is offline View Users Profile Print this message


Charlie Lane

Posts: 86
Joined: 16-Sep-2005

Could you explain your question a bit more please, in particular the phrase "add an RPModelElement from another RPModelElement"?
addNewAggr creates a new model element of the given metaClass, rather than transferring an element from somewhere else. It only works for creation of valid nesting (for example I guess it wouldn't let me create an operation inside an operation).
If you are transferring an existing model element to another owner, then setting owner will work, but again only if it will be a valid nesting.
Report this to a Moderator Report this to a Moderator
 2-Oct-2007 13:44
User is offline View Users Profile Print this message


kiwan kim

Posts: 8
Joined: 24-Sep-2007

Ok I have a hiearchy of operational activities (DODAF profile). I can create operational activities using VBA under a package but I cant create a hiearchy of Operational activities under another Operational activity.

In Rhapsody I can create a hiearchy of operational activities so I assumed that I can do that using VBA. I tried addnewaggr and few others. It all worked under a package but not under an Operational activity.

Below is a sample hiearchy I would like VBA to create. Thanks..

Package A

Operational Activities
Myoperation
Operational Activities
Another Operation
Report this to a Moderator Report this to a Moderator
 3-Oct-2007 11:47
User is offline View Users Profile Print this message


Charlie Lane

Posts: 86
Joined: 16-Sep-2005

Hi Kiwan, How about this:
[CODE]Public Sub doMakeOperationalActivity()
'Find the default package, which should exist in a new project
Dim a_Pkg As RPPackage
Set a_Pkg = getProject.findAllByName("Default", "Package")

'Make an operational activity under a package
Dim a_OA1 As RPInstance
Set a_OA1 = a_Pkg.addImplicitObject("OA1")
a_OA1.addStereotype "OperationalActivity", "Instance"

'Make an operational activity under an operational activity
Dim a_OA1Class As RPClass
Set a_OA1Class = a_OA1.otherClass
Dim a_OA2 As RPInstance
Set a_OA2 = a_OA1Class.addNewAggr("Instance", "OA2")
a_OA2.addStereotype "OperationalActivity", "Instance"

'Make an operation under an operational activity
Dim a_OA2Class As RPClass
Set a_OA2Class = a_OA2.otherClass
Dim a_OA2Operation As RPOperation
Set a_OA2Operation = a_OA2Class.addOperation("OA2Operation")
End Sub[/CODE]
I don't think you'll be able to put an operational activity under an operation because an operational activity in the DoDAF profile is a stereotype of Object and you can't have an Object in an Operation.
Does that help? Regards, Charlie
Report this to a Moderator Report this to a Moderator
 3-Oct-2007 14:09
User is offline View Users Profile Print this message


kiwan kim

Posts: 8
Joined: 24-Sep-2007

Thanks.... It worked!!!!!!

Man I tried so many ways.. Only thing I missed was to set .otherclass. I got to do some more reading. I spent two days trying to figure this out..

I owe you one...
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic Rhapsody forum.
There are currently 0 users logged in.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.