Customization > Automation Interface > Modeler Meta Model > Navigating through a model (automation interface)
Navigating through a model (automation interface)
When you create a Visual Basic application to extract data from a Model, you must navigate to the data you require using the object types and associations defined in the Modeler Meta Model.
* 
If you want a Visual Basic or C# application to work with Modeler on a 64-bit Windows operating system, you must build the application to run as a 32-bit application. To do this, set the Target CPU up as X86 on the Advanced Compilation dialog.
To demonstrate navigating through a Model, we will show you two examples of navigating to a Class scoped Operation named Operation1.
Navigating through the Meta Model hierarchy
In this example, we navigate to Operation1 through the Meta Model hierarchy. The relevant Part of the Meta Model is as follows.
When a Visual Basic application wants to use the automation interface, it typically starts with the following line of code:
Set oProjects = CreateObject("OMTE.Projects")
The preceding code creates the Projectsobject, which is a container object for the Models that we can be access through the databases we have bookmarked in Model Explorer. For information about the Projects object, see Projects
From the Projects object, we navigate to the My Model model (a Project object) through the Project association. For more information about the Project object, click here
.
From the Project object, we navigate to the Dictionaryobject through the Dictionary association. The Dictionary object is a container for all dictionary items in the Model. For more information about the Dictionary object, see Dictionary.
From the Dictionary object, we navigate to Class1 (a Class object) through the Class association. The Class association returns all Classes in the Model, so we process the collection of Classes to find the Class named Class1. For more information about the Class object, see Class.
Finally, from Class1 we navigate to Operation1 (an Operation object) through the Operation association. The Operation association returns all Operations in the Class, so we process the collection of Operations to find the Operation named Operation1. For more information about the Operation object, see Operation .
Having navigated to Operation1, we can use the automation interface functions to change its properties and do other things. Typically you can guess how to navigate to an item, because the path you take is similar to the path shown in the Modeler Packages pane. You can use the object topics in 'Automation Interface > Object attributes and associations (item properties and links)' topics to confirm association names.
Navigating through the active dictionary item in Modeler
In this example, we select Operation1 in Modeler, and then navigate to the item that is selected in Modeler. The relevant Part of the Meta Model is as follows.
As with the previous example, we create the Projects object through the following line of code. For information about the Projects object, see Projects.
Set oProjects = CreateObject("OMTE.Projects")
From the Projects object, we navigate to the dictionary item that is currently selected in Modeler through the Active Dictionary Item association. Having navigated to Operation1, we can use the automation interface functions to change its properties and do other things. If you select multiple items in the active pane, Active Dictionary Item returns a collection of the selected items.
Active project, active diagram and active symbol
In addition to navigating to the active item in Modeler, from the Projects object you can also quickly navigate to the active project, the active diagram and the active symbol.
Where:
Active Project is the Model that is open in Modeler. If Modeler is not running, it is the last Model that was open in Modeler.
Active Diagram is the diagram that has the focus in Modeler, or if no diagrams are open in Modeler, the diagram selected in the active pane. If no diagrams are open and you select multiple diagrams in the active pane, Active Diagram returns a collection of the selected diagrams.
Active Symbol is the symbol that is selected on the active diagram in Modeler. If you select multiple symbols on a diagram, Active Symbol returns a collection of the selected symbols.