1 / 18

SECTION 11 MACROS: OVERVIEW

SECTION 11 MACROS: OVERVIEW. MACROS: OVERVIEW. What’s in this section: Macro Overview Macro Object Parameters Ways to Create Macros Executing Macros Debugging. MACROS: OVERVIEW. Definition Purpose Types. MACROS: OVERVIEW (CONT.). Definition

Télécharger la présentation

SECTION 11 MACROS: OVERVIEW

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SECTION 11 MACROS: OVERVIEW

  2. MACROS: OVERVIEW • What’s in this section: • Macro Overview • Macro Object Parameters • Ways to Create Macros • Executing Macros • Debugging

  3. MACROS: OVERVIEW • Definition • Purpose • Types

  4. MACROS: OVERVIEW (CONT.) • Definition • A macro is an object that adds a command to the ADAMS/View language to execute a series of ADAMS/View commands. ADAMS/View treats a macro as it does all other ADAMS/View commands.

  5. MACROS: OVERVIEW (CONT.) • Purpose • Automate model building, simulating, and reviewing • Examples: • Generate a series of objects • Generate a series of plots for a simulation • Build an entire model (one for parts, one for joints, one for forces, and so on). • Automate user preferences You can also write macros to automate how you work in ADAMS/View. For example, you can: • Automatically turn icons on or off • Specify a certain grid size • Set whether or not to use the external ADAMS/Solver library, and so on. • Examples: • Icon settings (visibility, size, color) • Grid settings (on/off, size, and so on) • Solver preferences (use external/internal, save files, and so on)

  6. MACROS: OVERVIEW (CONT.) • Types • Parameterless • Executes the ADAMS/View commands stored in the macro. • With parameters • You can add parameters to a macro that will be evaluated when the macro is executed. • This makes the macro more generic.

  7. MACRO OBJECT PARAMETERS • To create a macro, you must specify: • Name (for database storage and reference). • We recommend that you save your macros in a user-created library. If you save them in the .gui library, they will not be upward compatible. • By default, macros are saved at the root level of the database. • A command that will run the macro. • The default is the macro name. • The commands the macro will execute. • What to do in case of a subsequent Undo.

  8. WAYS TO CREATE MACROS • Macro editor • Here, you enter the name of the macro and a unique command string that executes the macro.

  9. WAYS TO CREATE MACROS (CONT.) • Record/Replay • You can create a macro by recording a sequence of steps. Once you start the recording process, you perform the operations that you want to be included in the macro. Then, you stop the recording process and play it back. You can also save the macro you just recorded. • Reading text from a file • You can create a macro by using the Read command to read in an existing command file containing the commands to be executed. You can also assign a help file or text string to the macro that explains the macro’s use. • The file you supply that contains the macro definition is a standard command file but it can also contain parameters embedded in the commands and can have special comments at the top.

  10. WAYS TO CREATE MACROS (CONT.) • Example: macro read & file_name = "part_replicate_single_mac.cmd" & macro_name = .par_rep_single

  11. EXECUTING MACROS • When you create a macro, the command is added to ADAMS/View language. • Command line • Enter the command (with any applicable parameters) in the command line of the Command Window. Command line

  12. EXECUTING MACROS (CONT.) • Command Navigator • The Command Navigator displays a list of all ADAMS/View command keywords. When you select an object, a dialog box appears in which you enter parameters for executing the command. Selecting this command… Opens this dialog box

  13. EXECUTING MACROS (CONT.) • Custom dialog boxes • You can create a custom dialog box that, upon execution, executes a macro. • Other macros • If needed, a command within a macro can execute another macro.

  14. DEBUGGING • Using list information and temporary variables • Using the ADAMS Command Debugger • Crawl-walk-run approach

  15. DEBUGGING (CONT.) • Using list information and temporary variables • You can debug a macro if you: • Create it in pieces. • Store the pieces in variables. • Get list information on these variables. • For more information on building function expression strings in a macro, see the Knowledge Base Article 7477, available at: http://support.adams.com/kb/faq.asp?ID=7477. • Using the ADAMS Command Debugger • Used for heavy development • Unsupported and details undocumented

  16. DEBUGGING (CONT.) • Crawl-walk-run approach • Crawl - Learn the commands • Use interface to facilitate. • Execute by interface (GUI), Command Navigator, and so on. • Review commands and parameters (log file and Command Window). • Add to macro editor and test. • Walk - Add parameters and qualifiers • Declare parameters and simple qualifiers. • Substitute parameters into commands. • Test. • Add looping constructs, if necessary. • Use temporary variables.

  17. DEBUGGING (CONT.) • Run - Fine tune • Add comment lines • Remove dependencies (model object names, environment, and so on). • Add error trapping (using IF condition). • Add detailed qualifier, as needed.

More Related