The following steps are used to get to the toolset automation objects that are used to implement plug-ins:
The following is a CA Gen action diagram for a plug-in application that performs the above steps and also fetches a count of all the objects in the model and a MetaModelObjects collection object pointing to all the objects in the model. Note that plug-in applications are only executed after a model has already been opened and the views for the objects were all defined with the "Initialize on every entry" checkbox unchecked so that the values may be reused between event calls.
--- PLUGIN
| IMPORTS:
| EXPORTS:
| LOCALS:
| Work View toolset work
| obj
| Work View model work
| obj
| Work View openapi work
| obj
| Work View collection work
| obj
| Work View local ief_supplied
| command
| count
| ENTITY ACTIONS:
|
---
--- EVENT ACTION open_window
|
| NOTE ****************************************************
| Fetch the command line parameters (diagram name, scoping
| object, any selected objects)
| Note that you will have to parse the parameters explicitly
| *********************************************************
| SET local ief_supplied command TO COMMAND
|
| NOTE ****************************************************
| Fetch the toolset automation object
| *********************************************************
| SET toolset work obj TO CreateObject("COOLgen.Toolset")
| --- IF toolset work obj IS EQUAL TO NOTHING
| |
|<--|-- ESCAPE
| ---
|
| NOTE ****************************************************
| Fetch the Model object for the currently opened model
| *********************************************************
| SET model work obj TO toolset work obj.Models.Item(1)
| --- IF model work obj IS EQUAL TO NOTHING
| |
|<--|-- ESCAPE
| ---
|
| NOTE ****************************************************
| Fetch the OpenAPI object
| *********************************************************
| SET openapi work obj TO model work obj.OpenAPI
| --- IF openapi work obj IS EQUAL TO NOTHING
| |
|<--|-- ESCAPE
| ---
|
| NOTE ****************************************************
| Fetch a count of the number of objects in the model
| *********************************************************
| SET local ief_supplied count TO openapi work obj.CountModelObjs
|
| --- IF openapi work obj.LastReturnCode IS NOT EQUAL TO 0
| |
| | NOTE **************************************************
| | An error occurred
| | *******************************************************
| ---
|
| NOTE ****************************************************
| Fetch a MetaModelObjects collection for all objects in the model
| *********************************************************
| SET collection work obj TO openapi work obj.FetchAllModelObjs
|
| --- IF openapi work obj.LastReturnCode IS NOT EQUAL TO 0
| |
| | NOTE **************************************************
| | An error occurred
| | *******************************************************
| ---
---
--- EVENT ACTION close_window
|
| NOTE ****************************************************
| Clear out all the objects that had been set previously
| *********************************************************
| SET collection work obj TO NOTHING
| SET openapi work obj TO NOTHING
| SET model work obj TO NOTHING
| SET toolset work obj TO NOTHING
---
|
Copyright © 2014 CA.
All rights reserved.
|
|