The MxTransItAutomation Sample contains examples which show how MxTransIt can be controlled from a C# program or a VBScript. There is also an example script in the Invert Sample project. You can use the MxTransIt COM Automation API to create your own program to control MxTransIt.
MxTransItAutomation.sln is a Visual Studio Solution that demonstrates how MxTransIt can be programmatically controlled.
|
The MxTransItAutomation.vbs script uses the MxTransIt COM Automation API to create and test a Harness. The script performs the following: 1.Opens MxTransIt 2.Adds an AND Transform with 3 inports to the Harness 3.Exports the ports on the AND Transform 4.Sets the TickResolution property of the Execution object 5.Executes a set of invalid commands to test the interface 6.Tests the AND Transform with all possible input combinations 7.Writes the input parameters to the Command Prompt window: ![]() Output from Automation.vbs To run the MxTransItAutomation.vbs script, right-click on the file name and select Open with Command Prompt:
|
The MxTransItAutomation2.vbs script uses the MxTransIt COM Automation API to test a Harness. The test is similar to the Invert Sample project. The script performs the following: 1.Opens MxTransIt 2.Adds an Invert Transform to the Harness 3.Exports the ports on the Transform 4.Sets the TickResolution property of the Execution object 5.Creates an array of stimulus transition values 6.Tests the Invert Transform by checking response transitions and sending stimulus transitions 7.Writes the response transition values to the Command Prompt window. To run the MxTransItAutomation2.vbs script, right-click on the file name and select Open with Command Prompt.
|
The Invert Sample folder contains a sample VBScript file, Automate Harness.vbs, that demonstrates the following programmatically: •Opens MxTransIt. •Adds an MxVMC Transform to the harness. •Sets the Transform's properties. •Builds the MxVMC project. •Exports all the ports. •Saves the harness (as Automated Harness.mxform). To run the script, select Automate Harness.vbs in Windows File Explorer, right-click, and select Open. After the script completes, you can view the Harness that was created by opening Automated Harness.mxform with MxTransit. The sample VBScript is listed here: on error resume next |
The GetSetSample project demonstrates using COM automation to get and set a property on a Transform. In this sample, it sets the Model File Path property on a Simulink Transform. This sample is available in MxSuite 3.40.1.42191 or higher. To use the sample: 1.Use the Copy Samples dialog to copy the Automation sample to a folder of your choice. 2.Use Visual Studio to open Automation.sln in the GetSetSample subfolder of the Automation folder. 3.Build the solution.
4.Select Debug->Start without Debugging to run the program.
|