automating tasks using adams/view scripting, macros, · pdf fileautomating tasks using...

134
Automating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part Number: ADAM*V2012*Z*ADVVIEW*Z*SM-ADM704B-NT

Upload: dangnguyet

Post on 06-Mar-2018

258 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

Automating Tasks Using Adams/ViewScripting, Macros, and GUI

Customization

ADM 704B Course Notes

February 2013

Part Number: ADAM*V2012*Z*ADVVIEW*Z*SM-ADM704B-NT

Page 2: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

Legal Information

MSC.Software Corporation reserves the right to make changes in specifications and other information contained in thisdocument without prior notice. The concepts, methods, and examples presented in this text are for illustrative andeducational purposes only, and are not intended to be exhaustive or to apply to any particular engineering problem ordesign. MSC.Software Corporation assumes no liability or responsibility to any person or company for direct or indirectdamages resulting from the use of any information contained herein.

Copyright © 2013 MSC.Software Corporation. All Rights Reserved. This notice shall be marked on any reproduction ofthis documentation, in whole or in part. Any reproduction or distribution of this document, in whole or in part, without theprior written consent of MSC.Software Corporation is prohibited.

The MSC.Software corporate logo, Adams, Dytran, Easy5, Fatigue, Laminate Modeler, Marc, Mentat, MD Nastran, MDPatran, MSC, MSC Nastran, Mvision, Patran, SimDesigner, SimEnterprise, SimManager, SimXpert and Sofy aretrademarks or registered trademarks of the MSC.Software Corporation in the United States and/or othercountries. NASTRAN is a registered trademark of NASA. All other trademarks belong to their respective owners.countries. NASTRAN is a registered trademark of NASA. All other trademarks belong to their respective owners.

Page 3: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

Section Page

1 Command Language

What is in this Section 1-3

General Structure 1-4

Getting Familiar with Commands 1-7

Command Navigator 1-8

Command Window 1-10

Log File 1-12

Types of Commands 1-13

Exercise – Workshop 1 1-16

2 Conditional Constructs and Loops

CONTENTS

ADM704B, Section 0, February 2013Copyright© 2013 MSC.Software Corporation S0 - 3

2 Conditional Constructs and Loops

What is in this Section 2-3

FOR/END Loop (Numeric Iteration) 2-4

FOR /END Loop (Object-Based) 2-8

WHILE/END 2-11

IF/THEN/ELSE 2-13

Exercise – Workshop 2 2-16

3 Macros: Overview

What is in this Section 3-3

Macro Overview 3-4

Macro Object Parameters 3-7

Ways to Create Macros 3-8

Executing Macros 3-11

Page 4: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

Section Page

3 Macros: Overview (Cont.)

Debugging Macros 3-14

Exercise – Workshop 3 3-17

4 Macros: Parameters

What is in this section 4-3

Types of Parameters 4-4

Generalized Format 4-5

Naming Conventions 4-6

Qualifiers and Formats 4-7

Default Characteristics 4-8

CONTENTS

ADM704B, Section 0, February 2013Copyright© 2013 MSC.Software Corporation S0 - 4

Default Characteristics 4-8

Examples 4-9

Exercise – Workshop 4 4-10

5 Menus

What is in this section 5-3

Menu Builder 5-4

Syntax of Menu File 5-5

Using Commands to Add Menus 5-9

Exercise – Workshop 5 5-10

Page 5: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

Section Page

6 Dialog Boxes

What is in this Section 6-3

Adams/View Interface Overview 6-4

Terminology 6-5

Working with Dialog Boxes 6-6

Modifying Existing Pre-Built Dialog Boxes 6-7

Modifying Dialog Boxes that Were Auto Generated Using Macros 6-8

Creating Dialog Boxes from Scratch Using the Dialog Box Builder 6-9

Dialog Box Builder Overview 6-10

Dialog Box commands 6-14

CONTENTS

ADM704B, Section 0, February 2013Copyright© 2013 MSC.Software Corporation S0 - 5

Dialog Box commands 6-14

Dialog Box Database Storage 6-16

Exercise – Workshop 6 6-17

7 Dialog Box Builder

What is in this Section 7-3

Substituting Text into Commands 7-4

Working with Dialog Boxes 7-8

Buttons 7-9

Radio Boxes 7-10

Sliders 7-11

Containers 7-12

Option Menu 7-13

Saving Dialog Boxes 7-14

Exercise – Workshop 7 7-15

Page 6: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

Section Page

8 Organizing Customization with Command Files

What is in this Section 8-3

Build Files 8-4

Adams/View Startup Files 8-5

Exercise – Workshop 8 8-9

9 Plugins

What is in this Section 9-3

Creating an Adams/View Library 9-4

Macros, Dialog Boxes as Children of a Library 9-6

The Plugin Load & Unload Macros 9-7

CONTENTS

ADM704B, Section 0, February 2013Copyright© 2013 MSC.Software Corporation S0 - 6

The Plugin Load & Unload Macros 9-7

Adams/View Partial Binary Files 9-9

The Plugin XML File 9-10

Location for Plugin Files 9-11

Setting the MDI_USER_PLUGIN_DIR Variable 9-12

Test the Plugin 9-13

Exercise – Workshop 9 9-14

Page 7: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

SECTION 1

COMMAND LANGUAGE

ADM704B, Section 1, February 2013Copyright© 2013 MSC.Software Corporation S1 - 1

Page 8: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

ADM704B, Section 1, February 2013Copyright© 2013 MSC.Software Corporation S1 - 2

Page 9: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• General Structure

• Getting Familiar with Commands

• Types of Commands

WHAT IS IN THIS SECTION

ADM704B, Section 1, February 2013Copyright© 2013 MSC.Software Corporation S1 - 3

Page 10: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Syntax rules for commands

– Comment lines are allowed by placing an exclamation point (!) as the firstcharacter on the line.

– Continuation of a command is denoted by an ampersand (&) at the end of aline.

– Abbreviations are allowed as long as they are unique.

GENERAL STRUCTURE

ADM704B, Section 1, February 2013Copyright© 2013 MSC.Software Corporation S1 - 4

Page 11: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Examples:

– One “gotcha” when writing command files is that the last line might not getexecuted. Therefore, make it a habit of making the last line a commentcharacter (!).

– marker delete marker_name=.mod1.par4.mar27

– marker delete &

– marker_name=.mod1.part4.mar27

GENERAL STRUCTURE (CONT.)

ADM704B, Section 1, February 2013Copyright© 2013 MSC.Software Corporation S1 - 5

– marker_name=.mod1.part4.mar27

– mar del mar=.mod1.par4.mar27

– mar del mar=mar27

Page 12: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Syntax rules for entering values

– Values can contain letters, numbers, and underscore characters.

– They must begin with a letter or underscore character.

– Values can contain any characters that are enclosed by double quotationmarks.

– They must have separators (blank space or tab) between keywords andparameters. Placing separators between parameters and their values is

GENERAL STRUCTURE (CONT.)

ADM704B, Section 1, February 2013Copyright© 2013 MSC.Software Corporation S1 - 6

parameters. Placing separators between parameters and their values isoptional.

– All parameter values of type string should be enclosed in double-quotes (“).

– All parameter values of type object will accept the full database name or therelative object name provided it is unique in the database.

Page 13: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Command Navigator

• Command Window

• Log file

GETTING FAMILIAR WITH COMMANDS

ADM704B, Section 1, February 2013Copyright© 2013 MSC.Software Corporation S1 - 7

Page 14: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Command Navigator

– Enables you to browse through the Adams/View command language andexecute commands.

• The entire Adams/View command language is accessible through the CommandNavigator.

• Use the Command Navigator to navigate on keywords.

• Double-clicking the last keyword of a command displays a dialog box ofparameter names and parameter values.

GETTING FAMILIAR WITH COMMANDS (CONT.)

ADM704B, Section 1, February 2013Copyright© 2013 MSC.Software Corporation S1 - 8

parameter names and parameter values.

Page 15: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

Example:

GETTING FAMILIAR WITH COMMANDS (CONT.)

Double-Click here

ADM704B, Section 1, February 2013Copyright© 2013 MSC.Software Corporation S1 - 9

Which executes the command :xy_plots template delete title plot_name =plot_1

Page 16: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Command Window

– Text-based way to enter commands.

– Assumes that you understand the Adams/View command language.

GETTING FAMILIAR WITH COMMANDS (CONT)

Command information area

ADM704B, Section 1, February 2013Copyright© 2013 MSC.Software Corporation S1 - 10

Inputfield

Page 17: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Command Window continued.

– Command History

• Use the up and down arrows on your keyboard to scroll through previouslyexecuted commands.

– Command Expansion

• Use a question mark (?) or the Esc key for help with completing commands:

– Completes keywords or parameter names.

– Prompts for keywords or parameter names.

GETTING FAMILIAR WITH COMMANDS (CONT.)

ADM704B, Section 1, February 2013Copyright© 2013 MSC.Software Corporation S1 - 11

– Prompts for keywords or parameter names.

– Prompts for parameter values.

Page 18: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Log file

– A file named aview.log is saved during each Adams/View session. In thevertical applications, it is called acar.log, aengine.log, and arail.log.

– Contains commands that you entered and messages you received.

– The log file for the previous session is aview.log% on UNIX and aview.logon Windows.

GETTING FAMILIAR WITH COMMANDS (CONT.)

ADM704B, Section 1, February 2013Copyright© 2013 MSC.Software Corporation S1 - 12

Page 19: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Adams/View commands can be categorized as follows:

– Model-based

• Examples:

– marker create marker_name=mar1 location=2,0,0

– marker modify marker=mar1 orientation=0d,90d,0d

– Interface-based (GUI)

• Example:interface dialog_box display &

TYPES OF COMMANDS

ADM704B, Section 1, February 2013Copyright© 2013 MSC.Software Corporation S1 - 13

interface dialog_box display &

dialog_box_name = .gui.db_beam_size &

parameters=”$f_beam_name”

Page 20: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Conditional constructs

– Adams/View command language contains commands for creatingconditional constructs and loops.

• BREAK

• CONTINUE

• IF/ELSEIF/ELSE/END

• FOR/END

TYPES OF COMMANDS (CONT.)

ADM704B, Section 1, February 2013Copyright© 2013 MSC.Software Corporation S1 - 14

• RETURN

• WHILE/END

Page 21: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• File text write

– This command writes information from Adams/View into a text file. Youcontrol the format of the output and, using database access expressions,you can write any model or simulation data from the Adams/View database.

Note: For more information on the file text write command, see KnowledgeBase Article KB8012767 available at:http://simcompanion.mscsoftware.com/infocenter/index?page=content&id=K

TYPES OF COMMANDS (CONT.)

ADM704B, Section 1, February 2013Copyright© 2013 MSC.Software Corporation S1 - 15

http://simcompanion.mscsoftware.com/infocenter/index?page=content&id=KB8012767

This command is also documented in the online help.

Page 22: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Perform Workshop 1, “Understanding the Command Language,” inyour exercise workbook

EXERCISE

ADM704B, Section 1, February 2013Copyright© 2013 MSC.Software Corporation S1 - 16

Page 23: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

SECTION 2

CONDITIONAL CONSTRUCTS AND LOOPS

ADM704B, Section 2, February 2013Copyright© 2013 MSC.Software Corporation S2 - 1

Page 24: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

ADM704B, Section 2, February 2013Copyright© 2013 MSC.Software Corporation S2 - 2

Page 25: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• FOR/END Loop (Numeric Iteration)

• FOR/END Loop (Object-Based)

• WHILE/END

• IF/THEN/ELSE

WHAT IS IN THIS SECTION

ADM704B, Section 2, February 2013Copyright© 2013 MSC.Software Corporation S2 - 3

Page 26: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Overview

– The FOR and END commands allow you to execute a group of commandsa fixed set of times.

– This example performs numeric iterations. Adams/View executes thecommands bracketed by the FOR and END for each value of a variable inthe specified range.

– You can nest any combination of looping (FOR/END, WHILE/END) andconditional constructs (IF/ELSEIF/ELSE/END).

FOR/END LOOP (NUMERIC ITERATION)

ADM704B, Section 2, February 2013Copyright© 2013 MSC.Software Corporation S2 - 4

conditional constructs (IF/ELSEIF/ELSE/END).

Page 27: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• SyntaxFOR VARIABLE_NAME=var START_VALUE=REAL &

INCREMENT_VALUE=REAL END_VALUE=REAL

...

END

– Adams/View executes the commands between the FOR and END for eachvalue of var in the range START_VALUE to END_VALUE.

FOR/END LOOP (NUMERIC ITERATION) (CONT.)

ADM704B, Section 2, February 2013Copyright© 2013 MSC.Software Corporation S2 - 5

– At the beginning of the FOR loop, Adams/View creates an Adams/Viewvariable of type REAL named var. Adams/View deletes the variable whenthe loop terminates. If you use the loop variable in an expression thatrequires it to persist, Adams/View issues a warning message and does notdelete the variable at the termination of the loop. If you do not want this tohappen, you can use the EVAL function.

– START_VALUE, INCREMENT_VALUE, and END_VALUE can be any validreal expression.

Page 28: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Syntax continued

– INCREMENT_VALUE can be either positive or negative and defaults to 1.0if not specified.

• If INCREMENT_VALUE is positive, Adams/View increments the value of var bythe increment for each iteration and stops looping when the value of var isgreater than END_VALUE.

• If INCREMENT_VALUE is negative, Adams/View decrements var by theincrement for each iteration and continues looping until var is less than

FOR/END LOOP (NUMERIC ITERATION) (CONT.)

ADM704B, Section 2, February 2013Copyright© 2013 MSC.Software Corporation S2 - 6

increment for each iteration and continues looping until var is less thanEND_VALUE.

– The commands inside the FOR/END loop can use var as they would anyother Adams/View variable of type REAL.

Page 29: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Example

– In this example, Adams/View creates 10 markers, MAR1 through MAR10,on the default part and locates them one unit apart on the x-axis of thepart’s reference frame.

for variable_name=tempreal start_value=1 end_value=10

marker create marker_name=(eval("MAR" // RTOI(tempreal))) &

location=(eval(tempreal-1)), 0, 0

end

FOR/END LOOP (NUMERIC ITERATION) (CONT.)

ADM704B, Section 2, February 2013Copyright© 2013 MSC.Software Corporation S2 - 7

end

Page 30: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Overview

– The FOR and END commands allow you to execute a group of commandsa fixed set of times.

– This example operates on a set of Adams/View objects, such as markers orparts. Adams/View executes the commands bracketed by the FOR andEND on the specified set of objects.

– You can nest any combination of looping (FOR/END, WHILE/END) andconditional constructs (IF/ELSEIF/ELSE/END).

FOR/END LOOP (OBJECT-BASED)

ADM704B, Section 2, February 2013Copyright© 2013 MSC.Software Corporation S2 - 8

conditional constructs (IF/ELSEIF/ELSE/END).

Page 31: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• SyntaxFOR VARIABLE_NAME=var OBJECT_NAMES=objects &

TYPE=database_object_type

...

END

– For this type of FOR loop, Adams/View creates an Adams/View variable oftype OBJECT and successively assigns the value of each object in the setto the variable. The commands inside the FOR/END pair can use var as

FOR/END LOOP (OBJECT-BASED) (CONT.)

ADM704B, Section 2, February 2013Copyright© 2013 MSC.Software Corporation S2 - 9

to the variable. The commands inside the FOR/END pair can use var asthey would any other Adams/View variable of type OBJECT.

Page 32: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Example

– In this example, Adams/View renumbers the ADAMS IDs of markersbelonging to the part follower; it starts at 5000 and increments by one foreach marker in the set.

variable create variable_name=ip integer_value=5000

for variable_name=the_marker object_names=.fourbar.follower.* type=marker

marker modify marker_name=(eval(the_marker)) adams_id=(eval(ip))

variable modify variable_name=ip integer_value=(eval(ip+1))

FOR/END LOOP (OBJECT-BASED) (CONT.)

ADM704B, Section 2, February 2013Copyright© 2013 MSC.Software Corporation S2 - 10

variable modify variable_name=ip integer_value=(eval(ip+1))

end

variable delete variable_name=ip

Page 33: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Overview

– Use the WHILE and END commands to execute a group of commands zeroor more times.

– Adams/View executes the commands that WHILE and END bracketrepeatedly until the condition associated with the WHILE command isFALSE (zero).

– You can nest any combination of looping (FOR/END, WHILE/END) andconditional constructs (IF/ELSEIF/ELSE/END).

WHILE/END

ADM704B, Section 2, February 2013Copyright© 2013 MSC.Software Corporation S2 - 11

conditional constructs (IF/ELSEIF/ELSE/END).

• Syntax

WHILE CONDITION=(expression)...END

Page 34: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Example

– In this example, Adams/View creates 10 markers, MAR1 through MAR10,on the default part and locates them one unit apart on the x-axis of thepart’s local part reference frame (LPRF).

variable create variable_name=ip integer_value=0

while condition=(ip < 10)

marker create marker_name=(eval("MAR"//ip+1)) &

location=(eval(ip)),0,0

WHILE/END (CONT.)

ADM704B, Section 2, February 2013Copyright© 2013 MSC.Software Corporation S2 - 12

location=(eval(ip)),0,0

variable modify variable_name=ip integer_value=(eval(ip+1))

end

variable delete variable_name=ip

Page 35: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Overview

– Use IF/ELSE to execute a group of commands conditionally.

– The execution of commands bracketed by IF and END depend on the valueof an expression.

IF/THEN/ELSE

ADM704B, Section 2, February 2013Copyright© 2013 MSC.Software Corporation S2 - 13

Page 36: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Syntax

IF/THEN/ELSE (CONT.)

IF CONDITION=(expression)

...

END

IF CONDITION=(expression)

...

ELSE

Helpful operators for expressions:

!= not equal to

&& logical AND

|| logical OR

== equal to

ADM704B, Section 2, February 2013Copyright© 2013 MSC.Software Corporation S2 - 14

...

END

IF CONDITION=(expression)

...

ELSEIF

...

ELSE

...

END

== equal to

< less than

For information on these and otheroperators, see the ExpressionLanguage Reference in theAdams/View Function Builder onlinehelp.

Page 37: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Example

– In the following example, if the marker MAR1 exists, Adams/View modifiesits location. If the marker does not exist, Adams/View creates it and sets itslocation.

if condition=(DB_EXISTS ("MAR1"))marker modify marker=mar1 location=2,0,0

elsemarker create marker=mar1 location=2,0,0

IF/THEN/ELSE (CONT.)

ADM704B, Section 2, February 2013Copyright© 2013 MSC.Software Corporation S2 - 15

marker create marker=mar1 location=2,0,0

end

Page 38: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Perform Workshop 2, “Conditional Constructs and Loops,” in yourexercise workbook

EXERCISE

ADM704B, Section 2, February 2013Copyright© 2013 MSC.Software Corporation S2 - 16

Page 39: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

SECTION 3

MACROS: OVERVIEW

ADM704B, Section 3, February 2013Copyright© 2013 MSC.Software Corporation S3 - 1

Page 40: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

ADM704B, Section 3, February 2013Copyright© 2013 MSC.Software Corporation S3 - 2

Page 41: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Macro Overview

• Macro Object Parameters

• Ways to Create Macros

• Executing Macros

• Debugging Macros

WHAT IS IN THIS SECTION

ADM704B, Section 3, February 2013Copyright© 2013 MSC.Software Corporation S3 - 3

Page 42: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Definition

– A macro is an object that adds a command to the Adams/View language toexecute a series of Adams/View commands.

– Adams/View treats a macro as it does all other Adams/View commands.

MACROS: OVERVIEW

ADM704B, Section 3, February 2013Copyright© 2013 MSC.Software Corporation S3 - 4

Page 43: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• 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

MACROS: OVERVIEW (CONT.)

ADM704B, Section 3, February 2013Copyright© 2013 MSC.Software Corporation S3 - 5

– You can also write macros to automate how you work in Adams/View. Forexample, 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)

Page 44: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• 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 isexecuted.

• This makes the macro more generic.

MACROS: OVERVIEW (CONT.)

ADM704B, Section 3, February 2013Copyright© 2013 MSC.Software Corporation S3 - 6

Page 45: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• 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.

MACRO OBJECT PARAMETERS

ADM704B, Section 3, February 2013Copyright© 2013 MSC.Software Corporation S3 - 7

• The default is the macro name.

– The commands the macro will execute.

– What to do in case of a subsequent Undo.

Page 46: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Macro editor

– Here, you enter the name of the macro and a unique command string thatexecutes the macro.

WAYS TO CREATE MACROS

ADM704B, Section 3, February 2013Copyright© 2013 MSC.Software Corporation S3 - 8

Commandtext area

Page 47: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Record/Replay

– You can create a macro by recording a sequence of steps. Once you startthe recording process, you perform the operations that you want to beincluded in the macro. Then, you stop the recording process and play itback. 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

WAYS TO CREATE MACROS (CONT.)

ADM704B, Section 3, February 2013Copyright© 2013 MSC.Software Corporation S3 - 9

– You can create a macro by using the Read command to read in an existingcommand file containing the commands to be executed. You can alsoassign 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 standardcommand file but it can also contain parameters embedded in thecommands and can have special comments at the top.

Page 48: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Example for reading text from a file

macro read &

file_name = "part_replicate_single_mac.cmd" &

macro_name = .par_rep_single

WAYS TO CREATE MACROS (CONT.)

ADM704B, Section 3, February 2013Copyright© 2013 MSC.Software Corporation S3 - 10

Page 49: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• When you create a macro, the command is added to Adams/Viewlanguage.

• Command line

– Enter the command (with any applicable parameters) in the command lineof the Command Window.

EXECUTING MACROS

ADM704B, Section 3, February 2013Copyright© 2013 MSC.Software Corporation S3 - 11

Commandline

Page 50: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Command Navigator

– The Command Navigator displays a list of all Adams/View commandkeywords. When you select an object, a dialog box appears in which youenter parameters for executing the command.

EXECUTING MACROS (CONT.)

Selecting this command…

ADM704B, Section 3, February 2013Copyright© 2013 MSC.Software Corporation S3 - 12

Selecting this command…

Opens thisdialog box

Page 51: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• 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.

EXECUTING MACROS (CONT.)

ADM704B, Section 3, February 2013Copyright© 2013 MSC.Software Corporation S3 - 13

Page 52: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Using list information and temporary variables

• Using the ADAMS Command Debugger

• Crawl-walk-run approach

DEBUGGING MACROS

ADM704B, Section 3, February 2013Copyright© 2013 MSC.Software Corporation S3 - 14

Page 53: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• 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, seethe Knowledge Base Article KB8013202, available at:http://simcompanion.mscsoftware.com/infocenter/index?page=content&id=K

DEBUGGING (CONT.)

ADM704B, Section 3, February 2013Copyright© 2013 MSC.Software Corporation S3 - 15

http://simcompanion.mscsoftware.com/infocenter/index?page=content&id=KB8013202

• Using the ADAMS Command Debugger

– Used for heavy development

– Unsupported and details undocumented

Page 54: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• 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.

DEBUGGING (CONT.)

ADM704B, Section 3, February 2013Copyright© 2013 MSC.Software Corporation S3 - 16

• Declare parameters and simple qualifiers.

• Substitute parameters into commands.

• Test.

• Add looping constructs, if necessary.

• Use temporary variables.

– 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.

Page 55: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Perform Workshop 3, “Macros Overview,” in your exerciseworkbook

EXERCISE

ADM704B, Section 3, February 2013Copyright© 2013 MSC.Software Corporation S3 - 17

Page 56: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

ADM704B, Section 3, February 2013Copyright© 2013 MSC.Software Corporation S3 - 18

Page 57: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

SECTION 4

MACROS: PARAMETERS

ADM704B, Section 4, February 2013Copyright© 2013 MSC.Software Corporation S4 - 1

Page 58: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

ADM704B, Section 4, February 2013Copyright© 2013 MSC.Software Corporation S4 - 2

Page 59: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Types of Parameters

• Generalized format

• Naming conventions

• Qualifiers and formats

• Default characteristics

• Examples

WHAT IS IN THIS SECTION

ADM704B, Section 4, February 2013Copyright© 2013 MSC.Software Corporation S4 - 3

Page 60: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Real

• Integer

• File

• Object

• String

TYPES OF PARAMETERS

ADM704B, Section 4, February 2013Copyright© 2013 MSC.Software Corporation S4 - 4

• List

• Location

• Orientation

Page 61: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• The general format of a parameter is $’name:q1:q2:q3...’, where:

– name is the name of the parameter.

– q1, q2, q3... are one or more qualifiers that specify the characteristics of theparameter.

GENERALIZED FORMAT

ADM704B, Section 4, February 2013Copyright© 2013 MSC.Software Corporation S4 - 5

Page 62: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Must start with an alphabetic character.

• The rest of the name can include numeric characters andunderscores (“_”) as well as alphabetic characters (a-z, A-Z).

• The name ends at the first character that is not alphabetic,numeric, or an underscore. Therefore, $P, $P1, and $PART_1 arevalid parameter names while $PART#1 and $1P are invalid.

NAMING CONVENTIONS

ADM704B, Section 4, February 2013Copyright© 2013 MSC.Software Corporation S4 - 6

• Not case sensitive.

• Use single quotes to explicitly separate the name or qualifiers fromcommand text immediately following the parameter.

Page 63: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• You can use qualifiers on the first occurrence of the parameter tocontrol the parameter characteristics.

– Qualifiers are optional.

– They can only be used the first time the parameter appears in the macrotext.

– You can use the qualifiers in any combination and any order.

– If repeated, ADAMS/View uses the last value.

QUALIFIERS AND FORMATS

ADM704B, Section 4, February 2013Copyright© 2013 MSC.Software Corporation S4 - 7

– If repeated, ADAMS/View uses the last value.

– Qualifiers are not case-sensitive.

• Parameters can have one or more of the following qualifiers:

– Type

– Range

– Count

– Defaults

Page 64: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• We recommend that you explicitly set the characteristics of yourparameters in comments at the beginning of your macro.

• The first occurrence of a parameter in the command text definesthe parameter characteristics. This is true even if the firstoccurrence is in a comment.

DEFAULT CHARACTERISTICS

ADM704B, Section 4, February 2013Copyright© 2013 MSC.Software Corporation S4 - 8

Page 65: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

EXAMPLES

The qualifiers: Specify that the parameter requires:

$parts:t=part:c=2 Names for two existing parts.

$NSpokes:T=INTEGER:GE=3:LE=8:D=3

An integer from 3 to 8 and a constantdefault of 3.

$infile:t=file(*.dat) File name. The File Selection dialog

ADM704B, Section 4, February 2013Copyright© 2013 MSC.Software Corporation S4 - 9

$cm_location_from_part:t=location:d=0,0,0$excitation_mode:t=list(heave,pitch,roll,warp):d=heave$error_variable:t=variable:d=.ACAR.variables.errorFlag$number_of_steps:t=integer:gt=0

For more examples of parameters, see the Customize tab in the ADAMS/Viewonline help.

$infile:t=file(*.dat) File name. The File Selection dialogbox lists all files with the extension.dat.

Page 66: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Perform Workshop 4, “Macros and Parameters Syntax,” in yourexercise workbook

EXERCISE

ADM704B, Section 4, February 2013Copyright© 2013 MSC.Software Corporation S4 - 10

Page 67: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

SECTION 5

MENUS

ADM704B, Section 5, February 2013Copyright© 2013 MSC.Software Corporation S5 - 1

Page 68: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

ADM704B, Section 5, February 2013Copyright© 2013 MSC.Software Corporation S5 - 2

Page 69: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Menu Builder

• Syntax of Menu File

• Using Commands to Add Menus

WHAT IS IN THIS SECTION

ADM704B, Section 5, February 2013Copyright© 2013 MSC.Software Corporation S5 - 3

Page 70: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Overview

– You can use the Menu Builder (Tools Menu Modify) to modify andcreate menus to better suit your needs and preferences or match yourindustry’s terminology.

– You can specify keyboard accelerators (shortcuts) and mnemonics.

• Mnemonics create an underlined keystroke equivalent to a menu item, such asFile.

• Accelerators let you associate a key (such as F10) or key sequence (such as

MENU BUILDER

ADM704B, Section 5, February 2013Copyright© 2013 MSC.Software Corporation S5 - 4

• Accelerators let you associate a key (such as F10) or key sequence (such asCTRL+k) with a menu item.

– You can build menus for a particular model or for an entire application. Forexample, you can add the elements shown below:

Menu Button

Page 71: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Each line of a menu file defines an object and its name or specifiesinformation about the parent object.

• For clarity, Adams/View indents the lines. As you edit the text, you can alsoindent the lines.

• The figure below shows a portion of the Menu Builder that defines the Toolsmenu in Adams/View. Below the Menu Builder is the corresponding Toolsmenu as it appears in Adams/View.

SYNTAX OF MENU FILE

ADM704B, Section 5, February 2013Copyright© 2013 MSC.Software Corporation S5 - 5

Page 72: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Menu

– MENUn TITLENAME=nameHELP=Help

• Button

– BUTTONn LABEL :: ACCELERATORNAME=nameHELP=helpCMD=command

SYNTAX OF MENU FILE (CONT.)

ADM704B, Section 5, February 2013Copyright© 2013 MSC.Software Corporation S5 - 6

CMD=command

• Separator

– SEPARATORn

• Toggle

– TOGGLEn TITLENAME=nameHELP=helpSTATE=stateCMD=command

Page 73: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Referring to the example syntax on the previous page, the textlines have the following parameters:

– n is an integer between 1 and 10, usually 1, 2, or 3. It defines the menulevel in which the object appears. Level 1 is the first level.

• For example, if MENU1 appears on the menu bar, then BUTTON2 will appear under thepreceding MENU1.

• The n is required for MENU, but is optional for the other objects.

• If you omit the level, Adams/View assumes the object belongs under the last MENU.

• You can cascade menus up to 10 deep by nesting MENUs below other MENUs. You can

SYNTAX OF MENU FILE (CONT.)

ADM704B, Section 5, February 2013Copyright© 2013 MSC.Software Corporation S5 - 7

• You can cascade menus up to 10 deep by nesting MENUs below other MENUs. You caninclude as many buttons in a menu as you want; although, you should not create more thanwill fit on your screen.

– LABEL is the text that appears in the menu.– LABELs can contain ampersand (&) characters that specify keyboard mnemonic shortcuts

for a menu item (for example, ALT-F opens the File menu).

– For an icon button, you specify the icon name instead of the text. In Motif,the icon name is the name of a XBM (X BitMap) or XPM (X PixMap) formatfile. In Windows, the icon name is the name of a bitmap (.bmp) format file.

Page 74: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• The text lines have the following parameters continued:

– BUTTONs can specify an accelerator key (for example, CTRL+M,SHIFT+G, or F12) that invokes the button action.

– If NAME is omitted, Adams/View constructs a default identifier, such asMENU_4 or BUTTON_7.

– TOGGLE buttons create a menu item that displays a check mark dependingon the STATE value (ON or OFF). The state value is toggled when the

SYNTAX OF MENU FILE (CONT.)

ADM704B, Section 5, February 2013Copyright© 2013 MSC.Software Corporation S5 - 8

on the STATE value (ON or OFF). The state value is toggled when thebutton is clicked.

– SEPARATOR elements create horizontal line breaks that denote groups ofcommands.

– Note, that with the exception of CMD= lines, spaces are not permitted in themenu structure input. So NAME = my_menu is not valid, butNAME=my_menu is valid. This differs from Adams/View commandlanguage syntax where spacing rules are flexible.

Page 75: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• If you want to modify the Adams/View main menu, we highlyrecommend that you do this using commands instead of the MenuBuilder or .mnu file.

– If you modify a menu structure for one version of Adams/View and save it, itmay not represent the full, default, menu structure for subsequentAdams/View versions.

– For the above reason, it is better to use command language to build onlythe changes that you want rather than re-doing the entire menu structure.

USING COMMANDS TO ADD MENUS

ADM704B, Section 5, February 2013Copyright© 2013 MSC.Software Corporation S5 - 9

the changes that you want rather than re-doing the entire menu structure.

Page 76: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Perform Workshop 5, “Creating Custom Menu Buttons,” in yourexercise workbook

EXERCISE

ADM704B, Section 5, February 2013Copyright© 2013 MSC.Software Corporation S5 - 10

Page 77: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

SECTION 6

DIALOG BOXES

ADM704B, Section 6, February 2013Copyright© 2013 MSC.Software Corporation S6 - 1

Page 78: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

ADM704B, Section 6, February 2013Copyright© 2013 MSC.Software Corporation S6 - 2

Page 79: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Adams/View Interface Overview

• Terminology

• Working with Dialog Boxes

• Dialog Box Builder Overview

• Dialog Box Commands

WHAT IS IN THIS SECTION

ADM704B, Section 6, February 2013Copyright© 2013 MSC.Software Corporation S6 - 3

• Dialog Box Database Storage

Page 80: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Database hierarchy for graphical user interface (GUI) objects

ADAMS/VIEW INTERFACE OVERVIEW

All default objectsStored in .gui library

ADM704B, Section 6, February 2013Copyright© 2013 MSC.Software Corporation S6 - 4

Page 81: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Dialog Box and its children’s object terminology

TERMINOLOGY

Label

OptionMenu

Text box

Slider

Button

Dialogbox

ADM704B, Section 6, February 2013Copyright© 2013 MSC.Software Corporation S6 - 5

Container

Toolstack

Radiobutton

Togglebutton

Separator

Page 82: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Modifying existing pre-built dialog boxes

• Modifying dialog boxes that were auto generated using macros

• Creating dialog boxes from scratch using the Dialog Box Builder

WORKING WITH DIALOG BOXES

ADM704B, Section 6, February 2013Copyright© 2013 MSC.Software Corporation S6 - 6

Page 83: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Modifying existing pre-built dialog boxes

WORKING WITH DIALOG BOXES (CONT.)

ADM704B, Section 6, February 2013Copyright© 2013 MSC.Software Corporation S6 - 7

Page 84: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Modifying dialog boxes that were auto generated using macros.

WORKING WITH DIALOG BOXES (CONT.)

ADM704B, Section 6, February 2013Copyright© 2013 MSC.Software Corporation S6 - 8

Page 85: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Creating dialog boxes from scratch using the Dialog Box Builder.

WORKING WITH DIALOG BOXES (CONT.)

ADM704B, Section 6, February 2013Copyright© 2013 MSC.Software Corporation S6 - 9

Page 86: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

DIALOG BOX BUILDER OVERVIEW

Title

Dimensioningand Positioning

Toolbar

Attributes

Attribute typeselector

ADM704B, Section 6, February 2013Copyright© 2013 MSC.Software Corporation S6 - 10

Attributesindicator

AttributesArea

Page 87: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

DIALOG BOX BUILDER OVERVIEW (CONT.)

• You can access the Dialog Box Builder in one of two ways:

– From the Tools menu, point to Dialog Box and then select Create or Modify.

– Double-click on a dialog box.

• For security reasons, this method is disabled by default.

• You can enable this feature by either:

– Modifying or creating a dialog box for the first time

– Setting the environment variable MDI_AVIEW_CUSTOMIZE=enabled

ADM704B, Section 6, February 2013Copyright© 2013 MSC.Software Corporation S6 - 11

Page 88: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Operational modes for renaming, reshaping, and modifying

• Open objects in the Dialog Box Builder

– Name of open object is displayed in title.

– You can only modify characteristics (size, name, attribute) of the openobject and/or a direct child of the open object. In other words, you cannotmodify a “grandchild” directly.

– Limited to dialog boxes, containers, toolbars, and tab containers.

DIALOG BOX BUILDER OVERVIEW (CONT.)

ADM704B, Section 6, February 2013Copyright© 2013 MSC.Software Corporation S6 - 12

– Limited to dialog boxes, containers, toolbars, and tab containers.

– Open objects using the Dialog Box Open menus.

• Editing open object

– Use the Dialog Box menu to rename, fit, or edit its attributes.

Page 89: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Editing children objects of open objects

– Double-click the object with the left mouse button (notice that the attributesindicator changes).

OR

– Select the object you want to modify:

• Single-click on an object with the left mouse button.

or

DIALOG BOX BUILDER OVERVIEW (CONT.)

ADM704B, Section 6, February 2013Copyright© 2013 MSC.Software Corporation S6 - 13

or

• From the Edit menu, point to Select and then browse for the object in theDatabase Navigator.

– Then, use the Edit menu to rename, resize, or edit its attributes.

Page 90: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Start

– Commands are executed when object is displayed.

– Useful in initializing settings and putting default values into fields whenobject is displayed.

• Execution

– Commands are executed by the dialog box when the user clicks OK orApply.

DIALOG BOX COMMANDS

ADM704B, Section 6, February 2013Copyright© 2013 MSC.Software Corporation S6 - 14

Apply.

Page 91: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Finish

– Commands are executed when object is undisplayed.

– Allows you to clean up work when object is undisplayed.

DIALOG BOX COMMANDS (CONT.)

ADM704B, Section 6, February 2013Copyright© 2013 MSC.Software Corporation S6 - 15

Page 92: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Existing interface objects

DIALOG BOX DATABASE STORAGE

All dialog boxesare placed in thislibrary by default

ADM704B, Section 6, February 2013Copyright© 2013 MSC.Software Corporation S6 - 16

• New GUI objects

– It is highly recommended that you place all new objects in a user-createdlibrary.

– Objects placed in the .gui library will not be upward compatible!

Page 93: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Perform Workshop 6, “Working with Dialog Boxes,” in yourexercise workbook

EXERCISE

ADM704B, Section 6, February 2013Copyright© 2013 MSC.Software Corporation S6 - 17

Page 94: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

ADM704B, Section 6, February 2013Copyright© 2013 MSC.Software Corporation S6 - 18

Page 95: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

SECTION 7

DIALOG BOX BUILDER

ADM704B, Section 7, February 2013Copyright© 2013 MSC.Software Corporation S7 - 1

Page 96: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

ADM704B, Section 7, February 2013Copyright© 2013 MSC.Software Corporation S7 - 2

Page 97: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Substituting Text into Commands

• Working with Dialog Boxes

• Saving Dialog Boxes

WHATS IN THIS SECTION

ADM704B, Section 7, February 2013Copyright© 2013 MSC.Software Corporation S7 - 3

Page 98: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Holding down the right mouse button over the Commands area ofthe Dialog Box Builder displays a pop-up menu with severaloptions for editing the commands.

• When you select References, you can display and insert theavailable $xxx references.

SUBSTITUTING TEXT INTO COMMANDS

ADM704B, Section 7, February 2013Copyright© 2013 MSC.Software Corporation S7 - 4

Page 99: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

SUBSTITUTING TEXT INTO COMMANDS (CONT.)

ADM704B, Section 7, February 2013Copyright© 2013 MSC.Software Corporation S7 - 5

Page 100: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Objects that contain values

SUBSTITUTING TEXT INTO COMMANDS (CONT.)

ADM704B, Section 7, February 2013Copyright© 2013 MSC.Software Corporation S7 - 6

Page 101: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Example

SUBSTITUTING TEXT INTO COMMANDS (CONT.)

ADM704B, Section 7, February 2013Copyright© 2013 MSC.Software Corporation S7 - 7

Page 102: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Buttons

• Radio boxes

• Sliders

• Containers

• Option menu

WORKING WITH DIALOG BOX OBJECTS

ADM704B, Section 7, February 2013Copyright© 2013 MSC.Software Corporation S7 - 8

Page 103: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Buttons

– Buttons do not contain values.

– They simply execute commands upon single or double-clicking.

WORKING WITH DIALOG BOX OBJECTS (CONT.)

ADM704B, Section 7, February 2013Copyright© 2013 MSC.Software Corporation S7 - 9

Buttons

Button

Page 104: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Radio boxes

– Set states or modes

WORKING WITH DIALOG BOX OBJECTS (CONT.)

ADM704B, Section 7, February 2013Copyright© 2013 MSC.Software Corporation S7 - 10

Radioboxes

Textappearance

Values

Page 105: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Sliders

– Sets value of an object without having to type it in.

– Currently limited to integer values.

WORKING WITH DIALOG BOX OBJECTS (CONT.)

As you move the slider to theright, notice that value changes.

ADM704B, Section 7, February 2013Copyright© 2013 MSC.Software Corporation S7 - 11

Page 106: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Containers

– Sub-region inside dialog box windowor toolbar.

– Can hold other objects

WORKING WITH DIALOG BOX OBJECTS (CONT.)

ADM704B, Section 7, February 2013Copyright© 2013 MSC.Software Corporation S7 - 12

Container fordesign study

Page 107: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Option menu

– Allows one of many selections

– Contains a push graphic that displays the entire list, like a menu.

– Displays only one column of options.

WORKING WITH DIALOG BOX OBJECTS (CONT.)

When you select the arrow here…

You will get the pull-down menu

ADM704B, Section 7, February 2013Copyright© 2013 MSC.Software Corporation S7 - 13

You will get the pull-down menuof available selections here

Page 108: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• On the Dialog Box menu, point to Export and then selectCommand File.

– The dialog box is saved in the current working directory.

– The file name will be the dialog box name.

– You will probably want to rename the file so that subsequent saves do notoverwrite the file.

– You can also save your dialog box by saving your modeling database as abinary file. All of your changes are saved if you save a binary file.

SAVING DIALOG BOXES

ADM704B, Section 7, February 2013Copyright© 2013 MSC.Software Corporation S7 - 14

binary file. All of your changes are saved if you save a binary file.

Page 109: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Perform Workshop 7, “Working with Dialog Box Builder,” in yourexercise workbook

EXERCISE

ADM704B, Section 7, February 2013Copyright© 2013 MSC.Software Corporation S7 - 15

Page 110: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

ADM704B, Section 7, February 2013Copyright© 2013 MSC.Software Corporation S7 - 16

Page 111: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

SECTION 8

Organizing Customization with CommandFiles

ADM704B, Section 8, February 2013Copyright© 2013 MSC.Software Corporation S8 - 1

Files

Page 112: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

ADM704B, Section 8, February 2013Copyright© 2013 MSC.Software Corporation S8 - 2

Page 113: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Build Files

• Adams/View Startup Files

WHAT IS IN THIS SECTION

ADM704B, Section 8, February 2013Copyright© 2013 MSC.Software Corporation S8 - 3

Page 114: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Files that read in (or create) the various components of a customizedinterface are typically called “build” files.

• We highly recommend that you organize all types of GUI customizationobjects in subdirectories for organization and easy access.

• Sample build file:

BUILD FILES

ADM704B, Section 8, February 2013Copyright© 2013 MSC.Software Corporation S8 - 4

Page 115: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Startup files

– Startup files are files that Adams/View searches for and loads automatically if theyexist.

– The following are the types of Adams/View startup files. They are listed in the order inwhich Adams/View searches for them:

• Aview.bin

– Used to save a customized Adams/View environment in binary format.

– Used to store the state of a specific modeling session.

– file is unique when compared to the other startup files. This is because it is always read

ADAMS/VIEW STARTUP FILES

ADM704B, Section 8, February 2013Copyright© 2013 MSC.Software Corporation S8 - 5

– file is unique when compared to the other startup files. This is because it is always readin. By default, this file is located in the <install>/aview directory and will load in thedefault Adams/View session. Adams/View will open the Aview.bin file that it finds first.

• AviewBS.cmd

– Preferences that you set. Before Startup (BS) means that Adams/View reads thiscommand file before it reads other startup files.

• Aview.cmd

– Contains commands for starting Adams/View. This file tends to be more model/projectspecific.

• AviewAS.cmd

– Preferences that you set. After Startup (AS) means that Adams/View reads thiscommand file after it reads other startup files.

Page 116: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• You can use the startup files to:

– Automatically customize your interface (for example, menus, buttons, anddialog boxes)

– Speed up the file-import/open process

– Modify your Adams/View environment (for example, lighting features,layouts, and creating custom views)

ADAMS/VIEW STARTUP FILES (CONT.)

ADM704B, Section 8, February 2013Copyright© 2013 MSC.Software Corporation S8 - 6

Page 117: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Locations:

– Adams/View will read in the first startup file it encounters with the correctname (Aview.bin, AviewBS.cmd, Aview.cmd, and so on).

– Adams/View searches first for these files in your current working directory.

– If these files do not exist in your local working directory, Adams/Viewsearches for them in your directories specified in the aview.pth file.

– The aview.pth file is located by default in your <install>/common directory.

ADAMS/VIEW STARTUP FILES (CONT.)

ADM704B, Section 8, February 2013Copyright© 2013 MSC.Software Corporation S8 - 7

– The aview.pth file is located by default in your <install>/common directory.

Page 118: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

ADAMS/VIEW STARTUP FILES (CONT.)

ADM704B, Section 8, February 2013Copyright© 2013 MSC.Software Corporation S8 - 8

Page 119: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Perform Workshop 8, “Organizing Customization with CommandFiles,” in your exercise workbook

EXERCISE

ADM704B, Section 8, February 2013Copyright© 2013 MSC.Software Corporation S8 - 9

Page 120: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

ADM704B, Section 8, February 2013Copyright© 2013 MSC.Software Corporation S8 - 10

Page 121: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

SECTION 9

PLUGINS

ADM704B, Section 9, February 2013Copyright© 2013 MSC.Software Corporation S9 - 1

Page 122: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

ADM704B, Section 9, February 2013Copyright© 2013 MSC.Software Corporation S9 - 2

Page 123: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Creating an Adams/View Library

• Macros, Dialog Boxes as children of a Library

• The plugin Load & Unload Macros

• Adams/View partial binary files

• The plugin XML file

WHAT IS IN THIS SECTION

ADM704B, Section 9, February 2013Copyright© 2013 MSC.Software Corporation S9 - 3

• Location for plugin files

• Setting the MDI_USER_PLUGIN_DIR variable

• Test the plugin

Page 124: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• A library is created from the command navigator as shown in the imagebelow.

• A library is just that: a container in which to hold other elements such asmacros, dialog boxes and variables.

CREATING AN ADAMS/VIEW LIBARY

ADM704B, Section 9, February 2013Copyright© 2013 MSC.Software Corporation S9 - 4

Page 125: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Set the ‘Filter’ to ‘All’ to see the library in the database navigator:

CREATING AND ADAMS/VIEW LIBRARY (CONT.)

ADM704B, Section 9, February 2013Copyright© 2013 MSC.Software Corporation S9 - 5

Page 126: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• It is a good practice to write/test macros separately.

• Once they are complete, read them into the library using thecommand:

macro read file_name = "create_circular_pattern.mac" macro_name =.example_plugin.MACRO_1 create_panel = yes

– Note how the macro name indicates that the macro is a child of the library.

MACROS, DIALOG BOXES AS CHILDREN OF ALIBRARY

ADM704B, Section 9, February 2013Copyright© 2013 MSC.Software Corporation S9 - 6

– Note how the macro name indicates that the macro is a child of the library.

– Dialog boxes are handled in a similar fashion

• Read the dialog box into View, naming it as a child of the library

OR

• Simply rename an existing dialog box (or macro) in your model such that it is thechild of the library.

Page 127: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

PLUGIN LOAD AND UNLOAD MACROS

ADM704B, Section 9, February 2013Copyright© 2013 MSC.Software Corporation S9 - 7

Page 128: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• When the plugin library is loaded, Adams/View looks for a specialmacro named LOAD under the library. If found, the macro isexecuted when the plugin is loaded.

• Similarly, an UNLOAD macro is sought when the plugin isunloaded; if found, Adams/View executes it.

• The LOAD and UNLOAD macros should do tasks such asloading/unloading custom menus in View.

PLUGIN LOAD AND UNLOAD MACROS (CONT.)

ADM704B, Section 9, February 2013Copyright© 2013 MSC.Software Corporation S9 - 8

loading/unloading custom menus in View.

Page 129: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Adams/View allows you to save portions of your existing databasesession into partial binary files

• Save the custom library to the partial binary file. The pluginautomatically loads this binary file giving access to yourcustomization library.

ADAMS/VIEW PARTIAL BINARY FILES

ADM704B, Section 9, February 2013Copyright© 2013 MSC.Software Corporation S9 - 9

Page 130: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• <basename>_plg.xml file needs to be created so that theAdams/View Plugin Manager can find the plugin.

• The naming convention must be followed such that the<basename> is same as the prefix part of the partial binary file.

• For example:

example_plugin.bin

PLUGIN XML FILE

ADM704B, Section 9, February 2013Copyright© 2013 MSC.Software Corporation S9 - 10

example_plugin_plg.xml

Page 131: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Adams/View searches for plugin files in the following order:

– Current working directory

– Private location for product (ie: MDI_ACAR_PRIVATE)

– MDI_USER_PLUGIN_DIR environment variable

– Site location for product (ie: MDI_ACAR_SITE)

– System path (ie: $PATH, %PATH%)

– Installation path of Adams

LOCATION FOR PLUGIN FILES (XML, BIN)

ADM704B, Section 9, February 2013Copyright© 2013 MSC.Software Corporation S9 - 11

– Installation path of Adams

– Library path (ie: $SHLIB_PATH, LD_LIBRARY_PATH)

Page 132: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• To set an environment variable, identify a folder location where thenecessary files will be placed then point the environment variableto this location.

• There are two ways to set an environment variable:

– Temporary method: Open a DOS command window and issue thecommand:

set MDI_USER_PLUGIN_DIR=C:\temp\plugindir

SETTING THE MDI_USER_PLUGIN_DIR VARIABLE

ADM704B, Section 9, February 2013Copyright© 2013 MSC.Software Corporation S9 - 12

set MDI_USER_PLUGIN_DIR=C:\temp\plugindir

• Adams/View must be launched from this DOS shell so that the environmentvariable is properly picked up.

– Permanent method: Right-click on ‘My Computer’ on your machine andselect ‘Properties’. Under ‘Advanced’ tab select ‘Environment Variables’.Under ‘User variables’ create your new variable.

Page 133: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Launch Adams/View from the DOS shell where theMDI_USER_PLUGIN_DIR environment variable was set.

• Go to Tools Plugin Manager and check whether your pluginappears in the list.

• Check on the plugin and hit OK to load the plugin. Verify that theplugin library is loaded, then test the customization in the library.

TEST THE PLUGIN

ADM704B, Section 9, February 2013Copyright© 2013 MSC.Software Corporation S9 - 13

plugin library is loaded, then test the customization in the library.

Page 134: Automating Tasks Using Adams/View Scripting, Macros, · PDF fileAutomating Tasks Using Adams/View Scripting, Macros, and GUI Customization ADM 704B Course Notes February 2013 Part

• Perform Workshop 9, “Working with Plugins,” in your exerciseworkbook

EXERCISE

ADM704B, Section 9, February 2013Copyright© 2013 MSC.Software Corporation S9 - 14