Presentation is loading. Please wait.

Presentation is loading. Please wait.

S11-1 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation SECTION 11 MACROS: OVERVIEW.

Similar presentations


Presentation on theme: "S11-1 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation SECTION 11 MACROS: OVERVIEW."— Presentation transcript:

1 S11-1 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation SECTION 11 MACROS: OVERVIEW

2 S11-2 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation

3 S11-3 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation MACROS: OVERVIEW n What’s in this section: u Macro Overview u Macro Object Parameters u Ways to Create Macros u Executing Macros u Debugging

4 S11-4 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation MACROS: OVERVIEW n Definition n Purpose n Types

5 S11-5 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation MACROS: OVERVIEW (CONT.) n Definition u 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.

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

7 S11-7 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation MACROS: OVERVIEW (CONT.) n Types u Parameterless l Executes the ADAMS/View commands stored in the macro. u With parameters l You can add parameters to a macro that will be evaluated when the macro is executed. l This makes the macro more generic.

8 S11-8 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation MACRO OBJECT PARAMETERS n To create a macro, you must specify: u Name (for database storage and reference). l 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. l By default, macros are saved at the root level of the database. u A command that will run the macro. l The default is the macro name. u The commands the macro will execute. u What to do in case of a subsequent Undo.

9 S11-9 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation WAYS TO CREATE MACROS n Macro editor u Here, you enter the name of the macro and a unique command string that executes the macro.

10 S11-10 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation WAYS TO CREATE MACROS (CONT.) n Record/Replay u 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. n Reading text from a file u 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. u 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.

11 S11-11 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation WAYS TO CREATE MACROS (CONT.) u Example: macro read & file_name = "part_replicate_single_mac.cmd" & macro_name =.par_rep_single

12 S11-12 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation EXECUTING MACROS u When you create a macro, the command is added to ADAMS/View language. n Command line u Enter the command (with any applicable parameters) in the command line of the Command Window. Command line

13 S11-13 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation EXECUTING MACROS (CONT.) n Command Navigator u 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

14 S11-14 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation EXECUTING MACROS (CONT.) n Custom dialog boxes u You can create a custom dialog box that, upon execution, executes a macro. n Other macros u If needed, a command within a macro can execute another macro.

15 S11-15 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation DEBUGGING n Using list information and temporary variables n Using the ADAMS Command Debugger n Crawl-walk-run approach

16 S11-16 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation DEBUGGING (CONT.) n Using list information and temporary variables u You can debug a macro if you: l Create it in pieces. l Store the pieces in variables. l Get list information on these variables. u 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. n Using the ADAMS Command Debugger u Used for heavy development u Unsupported and details undocumented

17 S11-17 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation DEBUGGING (CONT.) n Crawl-walk-run approach u Crawl - Learn the commands l Use interface to facilitate. l Execute by interface (GUI), Command Navigator, and so on. l Review commands and parameters (log file and Command Window). l Add to macro editor and test. u Walk - Add parameters and qualifiers l Declare parameters and simple qualifiers. l Substitute parameters into commands. l Test. l Add looping constructs, if necessary. l Use temporary variables.

18 S11-18 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation DEBUGGING (CONT.) u Run - Fine tune l Add comment lines l Remove dependencies (model object names, environment, and so on). l Add error trapping (using IF condition). l Add detailed qualifier, as needed.


Download ppt "S11-1 ADM704-705, Section 11, August 2005 Copyright  2005 MSC.Software Corporation SECTION 11 MACROS: OVERVIEW."

Similar presentations


Ads by Google