David,

Check this out:

*****
The Rose Extensibility Interface (REI) contains two methods called Render and 
RenderEnhanced
which can be used to save diagrams to Windows Metafile (.wmf) or Enhanced Windows 
Metafile
(.emf) formats respectively.  The script listed below can be used to save the currently
active diagram to either of these two formats:

'<<START SCRIPT>>

'Annamalai "Vishu" Viswanathan
'12/22/1999

Sub Main

Begin Dialog SaveDialog ,,180,51,"Save Diagram"
 OKButton 132,8,40,14
  OptionGroup .OptionGroup1
  OptionButton 12,12,84,8,"Windows Metafile (.wmf)",.wmf
  OptionButton 12,28,112,8,"Windows Enhanced Metafile (.emf)",.emf
End Dialog

Dim MyDialog As SaveDialog
Dim theModel As Model
Dim theDiagram As Diagram

Const w$ = "Windows Metafiles:*.WMF"
Const e$ = "Enhanced Windows Metafiles:*.EMF"

Set theModel = RoseApp.CurrentModel
Set theDiagram = theModel.GetActiveDiagram

If theDiagram Is Nothing Then
     MsgBox "There is currently no active diagram"
Else
     result = Dialog(MyDialog)
     ctrl = MyDialog.OptionGroup1
     If ctrl = 0 Then
        f$ = SaveFilename$(theDiagram.Name, w$)
        If f$ = "" Then
             MsgBox "No file name was specified"
       Else
             theDiagram.Render f$
       End If
     Else
          f$ = SaveFilename$(theDiagram.Name, e$)
          If f$ = "" Then
               MsgBox "No file name was specified"
         Else
               theDiagram.RenderEnhanced f$
         End If
     End If
End If

End Sub

'<<END SCRIPT>>
'--------------------

Take note however that the script using the GetActiveDiagram method to get the diagram 
that
you want to save to a graphic format.  This means that you must launch this script 
from a
menu item in Rose.  You cannot run this script from a script window because if you try 
to do
so the script window will be the active window and not a diagram window.  To launch 
this
script from a menu selection you will need to modify the rose.mnu file in the following
manner:

Menu Tools
{

  Separator
  option "Class Wizard..."
   {
 enable %model:writeable
 RoseScript $SCRIPT_PATH\cwizard.ebx
   }
  option "Save ActiveDiagram..."
   {
 RoseScript $SCRIPT_PATH\RenderRoseDiagrams.ebs
   }
 }

In this case the script listed above is named RenderRoseDiagrams.ebs and is located in 
the
directory pointed to by the $SCRIPT_PATH pathmap.

*****

Regards

Vishu






"Knight, David (MED)" wrote:

> The script outputs a bmp file but it can't be read by any program I
> have; it appears to be an invalid bitmap.  Using the
> Diagram.RenderEnhancedToClipBoard method produced a valid image.  Do I
> have to do something else with the Render and RenderEnhanced methods in
> order for them to produce correct output?
>
> David Knight
> ------------------
> GE Medical Systems
> Software Engineering Intern
> (262) 521-6586
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>
>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 10, 2001 5:36 PM
> To: Knight, David (MED)
> Subject: Re: (ROSE) saving diagrams as images
>
> Use 'Diagram' class in script.
> 'Diagram' class has 'Render(filename)' method. With 'Render()' method,
> you can save the image to BITMAP image file. You can save diagram image
> only to Bitmap file.
> And It's impossible to access every diagrams at one try. You must access
> categories, use cases and state machine owners for accessing every
> diagrams.
>
> ************************************************************************
> * Rose Forum is a public venue for ideas and discussions.
> * For technical support, visit http://www.rational.com/support
> *
> * Admin.Subscription Requests: [EMAIL PROTECTED]
> * Archive of messages: 
>http://www.rational.com/products/rose/usergroups/rose_forum.jtmpl
> * Other Requests: [EMAIL PROTECTED]
> *
> * To unsubscribe from the list, please send email
> *
> * To: [EMAIL PROTECTED]
> * Subject:<BLANK>
> * Body: unsubscribe rose_forum
> *
> *************************************************************************

--
---
Annamalai "Vishu" Viswanathan  --  [EMAIL PROTECTED]
Rose Technical Support Engineer
Rational WW Customer Service


Check out http://www.therationaledge.com/ for tips and news for Rose users

---

************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
*
* Admin.Subscription Requests: [EMAIL PROTECTED]
* Archive of messages: 
http://www.rational.com/products/rose/usergroups/rose_forum.jtmpl
* 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