Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic System Architect (steve huntington)
Decrease font size
Increase font size
Topic Title: Outputting Diagram via VBA
Topic Summary: How to output a diagram automatically using VBA
Created On: 11-Jul-2006 06:19
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.
Answer This question was answered by Duane Hennessy, on Tuesday, July 11, 2006 11:33 PM

Answer:

'pass the diagram object to this routine (in this example called passed_diagram_object)


Dim imfSA as Object
If InitiateISAImf(SA2001.Application, imfSA) Then
 passed_diagram_object.Show
 call imfSA.SADiagramToMetaFile(passed_diagram_object.Handle, 100, "c:\Your file path")
End if


The other way to do it is from the wmf file within the Files table of the database but I don't have time to write it here at the moment. Let me know if you need that version and I'll dig it up.

Duane.

 11-Jul-2006 06:19
User is offline View Users Profile Print this message


Dale Moore

Posts: 23
Joined: 29-Jun-2006

Does anyone know how to output a diagram (say in JPG or SVG format) using VBA?

There is a method called render ( diagram.picture.render ) but I'm not sure of the properties to supply.  I have checked through the VBA Extensibility document that comes with SA but that doesn't even mention the method at all.  The method is as follows:

Sub Render(hdc as Long, x as Long, y as Long, cx as Long, cy as Long, xSrc as OLE_XPOS_HIMETRIC, ySrc as OLE_YPOS_HIMETRIC, cxSrc as OLE_XSIZE_HIMETRIC, cySrc as OLE_YSIZE_HIMETRIC, prcWBounds as Any)

I know I could output the pictures using a report, but I find the reports limited, and have written my own macro to search definitions and diagrams for text (case insensitive) and output the results.  I can output the properties of the diagrams it found, but I would really like to be able to output a picture of the diagram as well.

Any help would be greatly appreciated.
Report this to a Moderator Report this to a Moderator
 11-Jul-2006 06:56
User is offline View Users Profile Print this message


Duane Hennessy

Posts: 112
Joined: 18-May-2006

Answer Answer

'pass the diagram object to this routine (in this example called passed_diagram_object)


Dim imfSA as Object
If InitiateISAImf(SA2001.Application, imfSA) Then
 passed_diagram_object.Show
 call imfSA.SADiagramToMetaFile(passed_diagram_object.Handle, 100, "c:\Your file path")
End if


The other way to do it is from the wmf file within the Files table of the database but I don't have time to write it here at the moment. Let me know if you need that version and I'll dig it up.

Duane.



Edited: 11-Jul-2006 at 06:56 by Duane Hennessy
Report this to a Moderator Report this to a Moderator
 11-Jul-2006 07:23
User is offline View Users Profile Print this message


Dale Moore

Posts: 23
Joined: 29-Jun-2006

Do I need to add a reference to anything as I get a Sub or Function no defined on InitiateISAImf
Report this to a Moderator Report this to a Moderator
 11-Jul-2006 07:23
User is offline View Users Profile Print this message


Dale Moore

Posts: 23
Joined: 29-Jun-2006

Maybe a module I need to add?

PS Thanks for your help



Edited: 11-Jul-2006 at 07:29 by Dale Moore
Report this to a Moderator Report this to a Moderator
 11-Jul-2006 23:32
User is offline View Users Profile Print this message


Dale Moore

Posts: 23
Joined: 29-Jun-2006

Found it : Had to change it to be:

Set imfSA = saApp.Interface("ISAImf")

Woot!  Thanks for your help - it works.
Report this to a Moderator Report this to a Moderator
 17-Jul-2006 01:22
User is offline View Users Profile Print this message


Ian Souchard

Posts: 22
Joined: 28-Feb-2006

If you want to output the picture to a Word document for instance, check the code in the SA word templates, e.g. SADiags9.dot in the Templates folder...
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic System Architect forum.
There are currently 1 users logged in.
The most users ever online was 16 on 30-Oct-2008 at 14:46.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

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