Hello Bob,
You stated:
<<I loop through the Items in the ClassDiagram
and delete all items that are not of type "Class">>
One must be careful when deleting in Rose script: the safe way to delete is
to loop from the highest element position back to the first one, in steps of
minus one, like in the example below (you must select a diagram in the
browser before running the script):
Sub Main
Dim theDiagram As diagram
Dim theView As RoseItemView
Set theDiagram = roseapp.currentmodel.getselectedDiagrams.getat(1)
For i = thediagram.Itemviews.count To 1 Step -1
Set theView = theDiagram.ItemViews.getat(i)
roseApp.WriteErrorLog theView.getpropertyClassName
If Not theView.getpropertyClassName = "Class" Then
isdeleted = theDiagram.removeitemview(theView)
End If
Next i
End Sub
This is because the collections returned by Rose are dynamically updated
when items are deleted. Note also that the example above only removes
ItemViews from the diagram, namely a shallow delete is performed, the items
are still in the model.
For more related examples:
http://solutions.rational.com/solutions/display.jsp?solutionId=14688
Subject: WINDOWS: Convert associations generated by ANSI C++ into
attributes
Solution Id: 14688
http://solutions.rational.com/solutions/display.jsp?solutionId=131179906
Subject: WINDOWS: How to delete all classes from selected packages through
the Rational Rose Extensibility?
Solution Id: 131179906
If you keep seeing such instabilities, please contact Rational Customer
Service with details including the Operating system and version, Rose exact
version from Help->About and (ideally) a copy of the script and of a test
model that shows the problem.
Regards, Lara
==========================================================================
Solutions knowledge base http://solutions.rational.com
==========================================================================
Lara Ziosi Technical Support Engineer
Rational WW Customer Service Rational Software
Phone: +31 (0)20 4546 200 Fax: +31 (0)20 4546 201
Beechavenue 30 -- 1119 PV Schiphol-Rijk The Netherlands
Email: [EMAIL PROTECTED] http://www.rational.com/support
==========================================================================
-----Original Message-----
From: Bob Beck [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 07, 2003 3:08 PM
To: [EMAIL PROTECTED]
Subject: (ROSE) Problem creating a class diagram from reverse engineered
C++ code
Using the ANSI C++ addin with Rose 2002, I reverse engineered
a few classes. One of the classes has 3 attributes, each of a
user defined type. I create a class diagram using a Rose script
and the names of these attributes appear as role names on the
association between the class and the attribute. Now I wish to
remove the associations so I loop through the Items in the ClassDiagram
and delete all items that are not of type "Class".
Some of the text of the role names I mentioned above is left on the
diagram. When I attempt to delete the text manually, Rose crashes.
Any help or ideas would be appreciated.
Bob Beck
Assurance Technology
Voice: 321-727-8890
Fax: 321-727-8964
E-mail: [EMAIL PROTECTED]
************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
* Only plain-text messages are supported.
* HTML or Rich-Text messages may be rejected.
*
* 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
* Only plain-text messages are supported.
* HTML or Rich-Text messages may be rejected.
*
* 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
*************************************************************************