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: ISAImf (VBA) Documentation?
Topic Summary: Is there any documentation / gotcha's / best practice / examples for the ISAImf VBA interface to SA?
Created On: 20-Nov-2006 11:07
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.
 20-Nov-2006 11:07
User is offline View Users Profile Print this message


Tim Jones

Posts: 6
Joined: 20-Jul-2006

Is there any documentation / gotcha's / best practice / examples for the ISAImf VBA interface to SA? I have used the standard documented SA extensibility interface to date, but have now have to use ISAImf to achieve what I need to do. One can of course browse the type library and infer what the functions might do and then test them out, but it would certainly be quicker and less error prone to have some examples / documentation. Does anyone know anything about this?
Report this to a Moderator Report this to a Moderator
 29-Nov-2006 04:28
User is offline View Users Profile Print this message


Duane Hennessy

Posts: 112
Joined: 18-May-2006

Not that I know of.

I'm currently trying to use the interface to create GUIDs. I think it is a variant buffer but not sure how large it is (I'll do a len on the guids).

Let everyone know how I go. If anyone already knows how to use the interface to create a GUID please let me know. Ta.
Report this to a Moderator Report this to a Moderator
 29-Nov-2006 04:39
User is offline View Users Profile Print this message


Duane Hennessy

Posts: 112
Joined: 18-May-2006

Don't worry, worked it out.

Public Sub creating_a_GUID()
    Dim imfSA As Object
    Dim guid As String
    
    Set imfSA = Application.Interface("ISAImf")
        'create a GUID
        Call imfSA.SAGetStringGUID(guid, 288)
        Stop
End Sub


So, each GUID is 36 chars long. 36 * 8 bits = 288. This gives me a SAGuid value. For example:
5e776a80-78cd-46de-b667-5d108a8eb372
or
83c4fc30-018b-48f7-9237-326627190649

I guessed it may work on a random function or something that is seeded by the timer in the computer and each pass through the SAGetStringGUID method produces a different unique number. I question the concept of uniqueness in these kinds of situations and wonder what I have to do to produce the same number. Eg, resetting the clock back to the exact same time in the routine a number of times until I reach a uniqueness failure
Report this to a Moderator Report this to a Moderator
 29-Nov-2006 14:06
User is offline View Users Profile Print this message


SA Team

Posts: 148
Joined: 18-Nov-2005

SAGetStringGUID uses Window's API :-

CoCreateGuid

Which creates GUIDS based on Physical Machine parameters, as well as date and time. It is pretty much guaranteed to be unique.
Hope this helps.

BTW there is not much public documentation on the IMF interface. The object model is the recommended route to programming against SA - although I do accept that some functions are not yet available from the object model.

Thanks
Ian

-------------------------

Senior Software Developer
Telelogic UK Ltd.
Report this to a Moderator Report this to a Moderator
 29-Nov-2006 20:36
User is offline View Users Profile Print this message


Tim Jones

Posts: 6
Joined: 20-Jul-2006

Your comment that there is not *much* public documentation, suggests that their is *some* public documentation. It also suggests that there is some *non-public* documentation. What is the reason for not releasing whatever documentation there is to those who are trying to drive forward the usage of the product? If it is a worry about quality, I can only say that *anything* is better than nothing and having to deduce what functions do and then test your assumptions prior to development is a very slow and frustrating experience. How do your consultants learn - surely it is not just by trial and error? Thanks for your help, Tim Enterprise Architect NHS
Report this to a Moderator Report this to a Moderator
 1-Dec-2006 01:54
User is offline View Users Profile Print this message


Duane Hennessy

Posts: 112
Joined: 18-May-2006

quote:

Originally posted by: SA Team
SAGetStringGUID uses Window's API :- CoCreateGuid Which creates GUIDS based on Physical Machine parameters, as well as date and time. It is pretty much guaranteed to be unique. Hope this helps. BTW there is not much public documentation on the IMF interface. The object model is the recommended route to programming against SA - although I do accept that some functions are not yet available from the object model. Thanks Ian


Excellent, thanks for that. In future I will be able to create the script I need without having to load a System Architect Application object to create the GUID. Then I can write the whole thing in either VBScript or Java or something.
Report this to a Moderator Report this to a Moderator
 4-Dec-2006 11:39
User is offline View Users Profile Print this message


SA Team

Posts: 148
Joined: 18-Nov-2005

Tim> I have passed your comments on to the documentation team (as this is not my area). I will let you know what I find.

As I say IMF is the old way to interact with SA, and is gradually being replaced by the Object model. But I do appreciate that there are still quite a few things which can only be done via IMF, and do understand your requirement for information.

If you have any specific questions relating to IMF functions (or just - how can I do this...) we will try to answer them in the forums.

I hope this helps

Ian

-------------------------

Senior Software Developer
Telelogic UK Ltd.
Report this to a Moderator Report this to a Moderator
 4-Dec-2006 17:29
User is offline View Users Profile Print this message


Tim Jones

Posts: 6
Joined: 20-Jul-2006

Ian, Thanks very much for your response. A current example is that we wish to create an extended explorer, which can help us navigate our larger collections of definitions (e.g. our 7,000 conceptual services). We would either wish to either filter the explorer tree based on attribute values or extend the tree to include levels defined by attribute. I can see functions which seem to relate to building trees, but was wanting guidance on how to work with the interface functionality as opposed to against it. Any light you can shed on this would be much appreciated, regards, Tim
Report this to a Moderator Report this to a Moderator
 5-Dec-2006 11:22
User is offline View Users Profile Print this message


SA Team

Posts: 148
Joined: 18-Nov-2005

Tim - I think this may help you.
Please note that VBA User Filters WILL affect the explorer performance adversly!!
Hence there slightly concealed nature.


Create a new VBA Project (READ WRITE).
Add a Module called 'AutoExec' and paste in the code.
Add a Module called 'clsEvents' and past in the code.
Save the project
Go to your Tools-Session Options
Select 'BrowserUserFilters' and type a Y  - for Yes
Press OK
Restart SA
Open an encyclopedia - Ensure your encyclopedia has UML turned on.
Select the 'All' tab
Expand Definitions
Expand Class
Notice they are all there
Right click the explorer and choose 'VBA User Filters'
You should only see Classes with the Package type 'XSD Types'

NOTE:
If you debug the macro and press STOP, you will have to run AutoExec.Main again to restart the event handler.


CAVEATS:
I don't know why the event handler users a Memo structure - these are NOT very well supported.
I have used a function from the SA core to translate the Memo into a readable attribute - this MAY NOT WORK IN FUTURE VERSIONS AS IT IS NOT A PUBLIC FUNCTION



-------------------------

Senior Software Developer
Telelogic UK Ltd.

Edited: 5-Dec-2006 at 11:25 by SA Team
Report this to a Moderator Report this to a Moderator
 5-Dec-2006 14:31
User is offline View Users Profile Print this message


Tim Jones

Posts: 6
Joined: 20-Jul-2006

Thanks very much for your reply. I have taken the code, modified and tested it. Unfortunately, as you suggested, this is a very slow process and filtering our 7,000 conceptual service definitions takes about 3 minutes, which will not acceptable to modellers. Is there a way of intercepting the process earlier (in returning the data to build the explorer tree items) rather than intercepting the ShowNode event to set their visibility? Regards, Tim

Edited: 5-Dec-2006 at 14:32 by Tim Jones
Report this to a Moderator Report this to a Moderator
 5-Dec-2006 17:03
User is offline View Users Profile Print this message


SA Team

Posts: 148
Joined: 18-Nov-2005

Sorry there is not another way to intercept the browser display.

It depends how complex you require your browser to be. If you want a simple search system you could
try something like the attached VBA listbox code.
Create a new VBA project and add a form called frmFilter
Add a ListBox control to the form called ListBox1
Paste the code in and save it
Add a reference to the project to 'Microsoft XML 3.0' or similar
Open the form and press run. (It will do the same filter as the previous example I posted)

To modify it :
The strReport is copied out of the Reporting System  (mock up the report and then choose 'text edit report' and copy it out, minus the report format and output details). Paste it into VBA and format the text (remembering to double quote all single double quotes)

Hope this helps
Ian

-------------------------

Senior Software Developer
Telelogic UK Ltd.

Edited: 5-Dec-2006 at 17:11 by SA Team
Report this to a Moderator Report this to a Moderator
 13-Feb-2007 17:21
User is offline View Users Profile Print this message


Raffaele Nappi

Posts: 8
Joined: 18-Jul-2006

Hi all,
I've the same problem (lack of documentation) about two following ISAIMF's functions:
- SAPlaceDiagramNodes(lphDiagramHandle As Long, wAlgorithm As Long) As IMFERRORCODE
- SARouteDiagramLines(lphDiagramHandle As Long) As IMFERRORCODE

Could you help me?
Thanks
rN
Report this to a Moderator Report this to a Moderator
 14-Feb-2007 11:39
User is offline View Users Profile Print this message


SA Team

Posts: 148
Joined: 18-Nov-2005

Hi
I have not used these functions before, but I believe their use is as follows :-

SAPlaceDiagramNodes :-
  lphDiagramHandle = is the handle to the diagram
  wAlgorithm can be :-
    -1  = collapse dgm
    
3  = draw hierarchies
     0  = simply route nodes

SARouteDiagramLines
   Simply takes a diagram handle and performs a route lines with assign connections

Diagram handles can be obtained by doing an IMF OpenDiagram, or using the object model by using Diagram.Handle

Hope this helps
Ian


-------------------------

Senior Software Developer
Telelogic UK Ltd.

Edited: 14-Feb-2007 at 11:40 by SA Team
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.