Simcenter Femap Using a Code Module in Femap API

2024-09-04T15:26:33.000-0400
Femap Teamcenter Share Simcenter Femap Marketing

Summary

Demonstrates the use of multiple API files in Femap


Details

Actions can be created in the Femap API Programming window including:

  • Macros
    • An application written to perform a specific task using the Femap API to have Femap complete tasks and operations
  • Code Modules
    • Implements a code library
    • Has a set of Public procedures accessible from other macros and modules
    • The public symbols are accessed directly
    • Provides a way to split up larger applications into multiple files
  • Object Modules
    • Implements an ActiveX Automation object
    • Has a set of Public procedures accessible from other macros and modules
    • The public symbols are accessed via the name of the object module or an object variable
  • Class Modules
    • Implements an ActiveX Automation object
    • Has a set of Public procedures accessible from other macros and modules
    • The public symbols are accessed via an object variable

This Code Module example will demonstrate the use of relative file locations.

For this example, assume the following arbitrary file structure
[C:\Temp\Code_Module_Example]

driver.BAS

[SUBFOLDER_EXAMPLE]

print_function.BAS


The contents of driver.BAS:
'#Uses "SUBFOLDER_EXAMPLE\print_function.BAS"
Sub Main
    Dim App As femap.model
    Set App = feFemap()
    local_print("demonstration_string")
End Sub

The contents of print_function.BAS
Public Module MYPRINT
    Public Function local_print(str As String)
        Dim App As femap.model
        Set App = feFemap()
        App.feAppMessage(FCM_WARNING, str)
    End Function
End Module

In the Femap API window, select the Open button and navigate to the location of driver.BAS and select it.  In the Femap API window, select the Play button.  In the Messages window, "demonstration" will be printed in blue.

KB Article ID# KB000152919_EN_US

Contents

SummaryDetails

Associated Components

API License Media Request Post Processing Preprocessing Satoolkit Stand Alone Solution Stress Wizard System Administration TMG Translator Analysis Translator Geometry Visq