![]() |
Telelogic Rhapsody (steve huntington) | ![]() |
Topic Title: addnewaggr - object to object Topic Summary: Created On: 1-Oct-2007 16:42 Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
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.. |
|
![]() |
|
![]() |
|
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. |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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... |
|
![]() |
Telelogic Rhapsody
» Rhapsody Category » Rhapsody
»
addnewaggr - object to object
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.