Professional Documents
Culture Documents
0
PART NUMBER
110VIEWAD-01
Visit us at: www.adams.com
Advanced
ADAMS/View Training
Guide
2 Copyright
U.S. Government Restricted Rights: If the Software and Documentation are provided in connection with a
government contract, then they are provided with RESTRICTED RIGHTS. Use, duplication or disclosure is
subject to restrictions stated in paragraph (c)(1)(ii) of the Rights in Technical Data and Computer Software
clause at 252.227-7013. Mechanical Dynamics, Incorporated, 2300 Traverwood Drive, Ann Arbor, Michigan
48105.
The information in this document is furnished for informational use only, may be revised from time to time,
and should not be construed as a commitment by Mechanical Dynamics, Incorporated. Mechanical
Dynamics, Incorporated, assumes no responsibility or liability for any errors or inaccuracies that may
appear in this document.
This document contains proprietary and copyrighted information. Mechanical Dynamics, Incorporated
permits licensees of ADAMS
Tell the students that they can change the pick tolerance (currently 0.015) by using the instructions in
mod_04_sla/misc/readme.txt. Also, the example shown above can be found in mod_04_sla/
misc/test_pick_tol.cmd.
Zoomed in
Zoomed out
More
objects
attached
TooIs for Purumetrics,,,
Parametrics: Overview 75
F{} on Muin TooIbo
F{} on Muin TooIbo
Use of construction points
Purumetrics in verticuI uppIicutions
Parametrics in the ADAMS vertical products are based on a slightly different paradigm. They
use hardpoints and construction frames. For more information, refer to the tutorials in the
guides, Getting Started Using ADAMS/Car and Getting Started Using ADAMS/Engine.
TooIs for Purumetrics,,,
76 Parametrics: Overview
This workshop takes about one hour to complete.
ProbIem stutement
Parameterize the locations of points in the model, and then plot toe angle for different
configurations of the given suspension model.
ModeI description
s The model has five parts (not including ground).
s All appropriate constraints are in the model.
s There are markers attached to ground at each key location (see the figure on the next
page).
s There is a point motion driving the spindle up and down 100 mm.
s There is one function measure that calculates toe angle, and one that calculates wheel
height.
Be sure to explain that ADAMS/View isnt meant for suspension analysis, the vertical applications,
ADAMS/Car and ADAMS/Pre, are. The context here is to understand parametrics. Understanding para-
metrics will help you create better ADAMS/Car templates.
XII I
II
III
IV
V VI VII
X
XI
VIII
IX
Workshop 4-Purumeterizing un isting ModeI
Parametrics: Overview 77
9etting sturted
To import the modeI:
1 Start ADAMS/View from the mod_04_sla directory.
2 Import the sla_start.cmd file.
9etting fumiIiur with points
To identify the purts:
1 Simulate the model to observe its behavior:
s End Time: 1
s Steps: 50
2 Get to know the part names and the locations of the reference markers in the suspension.
Label the parts in the figure below. UCA has been done for you.
Tip: Use the Database Navigator in Browse and Highlight modes.
pnt5_ref
pnt7_ref
pnt2_ref
pnt1_ref
pnt4_ref
pnt3_ref
pnt11_ref
pnt10_ref
pnt6_ref
pnt9_ref
pnt8_ref
UCA
Workshop 4-Purumeterizing un isting ModeI,,,
78 Parametrics: Overview
Purumeterizing the tierod
In this section, you parameterize the tierod objects (geometry and joints) to markers pnt7_ref and
pnt8_ref.
To purumeterize the Iocution of the tierod geometry:
1 Find out the name of the marker that is the center marker for the cylinder geometry that
makes up the tierod. It is ______________________________________________.
2 Turn on the appearance of that marker:
s Select the marker by adding it to the select list.
s From the Edit menu, select Appearance.
s Set Visibility to On.
3 Parameterize the location of that center marker to pnt7_ref using the location
parameterization tool, f(x).
s From the Main toolbox, in the Move toolstack, select the f(x) tool.
s Set the menu to Collapse (distance).
s Follow the prompts that appear in the status bar:
x Select the marker you want to parameterize (tierod_geo_base).
x Select the marker to which you want to parameterize (pnt7_ref).
4 Display the modify dialog box for the marker tierod_geo_base.
pnt7_ref pnt8_ref
Workshop 4-Purumeterizing un isting ModeI,,,
Parametrics: Overview 79
5 What is in the Location text box? ________________________________________
You should see a parametric expression that ADAMS/View just wrote for you.
To purumeterize the orientution of the tierod geometry:
1 Parameterize the z-axis of the center marker so it points from pnt7_ref to pnt8_ref using the
orientation parameterization tool, f().
s From the Main toolbox, in the Move toolstack, select on the f() tool.
s Set the first menu to Along Axis.
s Set the second menu to Z.
s Following the prompts:
x Select the object whose orientation you want to parameterize (tierod_geo_base).
x Define the axis start location (pnt7_ref).
x Define the axis end location (pnt8_ref).
2 Display the modify dialog box for the marker tierod_geo_base.
3 What is in the Orientation text box? ___________________________
You should see a parametric expression that ADAMS/View just wrote for you.
4 Move pnt7_ref upwards (as shown in the figure below), and make sure the cylinders
location and orientation are changing accordingly.
5 Does the length of the cylinder adjust parametrically? ______Yes ______ No
Workshop 4-Purumeterizing un isting ModeI,,,
80 Parametrics: Overview
To purumeterize the Iength of the tierod geometry:
s Parameterize the cylinders length to change based on the locations of pnt7_ref and
pnt8_ref.
Tip: Use the DM function just as you did in Workshop 3Expressions: Functions
on page 56.
To purumeterize the universuI goint:
1 Use the f(x) tool to parameterize the universal joint to pnt7_ref.
2 Obtain information about the I and J markers associated with that joint.
Hint: Select Verbose in the Information window.
3 Do you see a parametric expression written for the location of each marker?
_____Yes _____ No
The f() tool is not as useful for the orientation of the universal joint because of the
complexity of the I and J marker orientations. Therefore, we will leave this joint alone for
now.
Workshop 4-Purumeterizing un isting ModeI,,,
Parametrics: Overview 81
Purumeterizing the upper controI urm {ucu}
You will now parameterize the cylindrical geometry of the UCA part. This time you will use
design points as well as parametric expressions. The long and short cylinders will be treated
differently in the ways they are parameterized.
A markers icon must be visible on the screen if you want to parameterize using graphical
methods. Therefore, you need to turn on some marker icons.
To dispIuy murker icons:
s Display the icons for the center_marker of each cylinder belonging to the UCA part.
Tip: Turn the visibility of the center_marker on and off by using the command files
cntr_mar_on.cmd and cntr_mar_off.cmd in the subdirectory utils (use the F2 shortcut
key). This is a utility weve custom written for this workshop, and you can
customize it for other models.
To purumeterize the Iocution of the Iong cyIinders:
1 Create a design point:
s Set its characteristics to:
x Add to Ground
x Attach Near
s Select ground.pnt3_ref as the point location.
Right-click here
at pnt3_ref
Workshop 4-Purumeterizing un isting ModeI,,,
82 Parametrics: Overview
2 Use the Command Window (F3 shortcut key) to review the commands issued during the
point creation.
3 How many markers were automatically parameterized?
Circle the best answer: 1 2 3
4 Create another design point, this time selecting ground.pnt4_ref as the point location.
To purumeterize the orientution of the Iong cyIinders:
1 From the Main Toolbox, select the F() tool.
2 Set the characteristic to Along Axis and the Axis to Z.
3 Right-click the location shown in the figure on page 81.
4 Select the object whose orientation you want to parameterize (uca.uca_geo1_base).
5 Define the axis start location (pnt3_ref).
6 Define the axis end location (ground.pnt6_ref).
7 Use the Command Window to review what commands were issued during the F()
parameterization.
8 Select F() again.
9 Set the characteristic to Along Axis and the Axis to Z.
10 Select the object whose orientation you want to parameterize (uca_geo3_base).
11 Define the axis start location (pnt4_ref).
12 Define the axis end location (pnt6_ref).
To purumeterize the Iength of the Iong cyIinders:
s Use an expression to define the cylinder length so that it updates parametrically as the
endpoints change.
Tip: Use the DM function (again).
Workshop 4-Purumeterizing un isting ModeI,,,
Parametrics: Overview 83
To purumeterize the orientution of the short cyIinders:
1 From the Main Toolbox, select the F() tool
2 Set the characteristic to Along Axis and the Axis to Z.
3 Right-click the location shown next:
4 Select uca_geo2_base.
5 Select pnt3_ref.
6 Select pnt4_ref.
7 Choose F() again.
8 Set the characteristic to Along Axis and the Axis to Z.
9 Right-click the other short cylinders end.
10 Select uca_geo4_base.
11 Select pnt4_ref.
12 Select pnt3_ref.
Right-click
here
Workshop 4-Purumeterizing un isting ModeI,,,
84 Parametrics: Overview
To inspect the behuvior of short cyIinder purumetrics:
Its a good idea to test the parametrics as you build them. This follows the crawl-walk-run
process that we teach. You will move one of the design points and see what happens.
1 Select the design point at pnt3_ref (POINT_32).
2 Set the view to the right.
3 Using the Move tool, translate (10 cm) upward in the global z direction.
4 Inspect the model from different viewpoints.
5 Do the centerlines of the short cylinders pass through pnt3_ref and pnt4_ref?
____ Yes ____ No
6 What do you think went wrong? __________________________________________
_________________________________________________________________
To purumeterize the Iocutions of the short cyIinders:
1 Display the modify dialog box for marker uca.uca_geo2_base.
2 Clear the Location text box.
Tip: To quickly clear a text box, left-click the start of the text box, and then press Ctrl-k.
3 In the Location text box, point to Parameterize, and then select Expression Builder.
4 In the Expression Builder, set the function category to Location/Orientation.
5 From the Selection menu, highlight LOC_ALONG_LINE, and then select Assist.
Before moving POINT_32 After moving POINT_32 up 10 cm
Workshop 4-Purumeterizing un isting ModeI,,,
Parametrics: Overview 85
6 In the assist dialog box, set the options to:
s Object for Start Point: pnt3_ref
s Object for Point on Line: pnt4_ref
s Distance: -0.5
7 Select OK.
The expression is now in the work area.
You want to change the distance from -0.5 to be half of the cylinder's length so youll
multiply the -0.5 by the cylinder length.
8 Place your cursor after the -0.5, type the multiplier operator, for example, type asterisk, *.
9 Use the Getting Object Data section to obtain the length of the cylinder uca_geo2.
When you are done, your expression should look like:
LOC_ALONG_LINE( pnt3_ref , pnt4_ref , -0.5*uca_geo2.length )
10 Select Evaluate to verify syntax and see the location array values.
11 In the Expression Builder, select OK.
Notice that the expression is sent to the Marker Modify dialog box, and in the process, the
Expression Builder automatically wrapped the expression in the required parentheses.
12 In the Marker Modify dialog box, select Apply.
The short cylinder adjusts its location.
13 Place your cursor at the start of the Location text box. Press Shift-End to select all of the
text. Then, right-click in the Location text box, and select Copy to save the expression,
which you will paste later.
14 In the Name text box, browse for uca_geo4_base.
15 Clear the entry in the Location text box.
16 Paste the text you saved in Step 13.
17 Hand-edit the expression to be as follows:
(LOC_ALONG_LINE(pnt4_ref, pnt3_ref, -0.5 * uca_geo4.length))
18 In the Marker Modify dialog box, select Apply.
Workshop 4-Purumeterizing un isting ModeI,,,
86 Parametrics: Overview
The short cylinder adjusts its location.
19 Using the Table Editor, move POINT_32 back to its original position (384.0, 1330.0, 710.348).
Purumeterizing construints connected to UCA
To dispIuy goint murker icons:
Again you will need the marker icons to use the parameterization tools. Therefore, you need to
turn on some joint marker icons.
s Display the marker icons for all the joints connected to the UCA part.
Tip: Turn joint marker visibility on and off by using jnt_mar_on.cmd and
jnt_mar_toggle.cmd in the subdirectory utils (use the F2 shortcut key). This is another
utility weve custom written, and you can customize it for use on other models. The
I and J markers for the joints are displayed, colored maize and blue, respectively.
To purumeterize the Iocution of the UCA-spindIe sphericuI goint:
1 Create a design point:
s Set its characteristics to:
x Add to Ground
x Attach Near
s Select ground.pnt6_ref as the point location.
Workshop 4-Purumeterizing un isting ModeI,,,
Parametrics: Overview 87
2 Use the Command Window (F3 shortcut key) to review what commands were issued
during the point creation.
3 Were the joint markers parameterized to pnt6_ref or to the design point?
______________________________
4 If you dragged pnt6_ref to a new location would the spherical joint move as well?
____ Yes _____ No
5 What do you think would happen?___________________________________________
______________________________________________________________________
To purumeterize the Iocution of UCA_ground_rev revoIute goint:
1 Parameterize the location of the revolute joint's J marker uca.uca_ground_rev2 so it lies
halfway between the ground markers, pnt3_ref and pnt4_ref.
Tip: Use the LOC_ALONG_LINE() function and + 0.5*DM().
2 Use the f(x) tool to collapse the location of I marker, ground.uca_ground_rev1, onto the
J marker, uca.uca_ground_rev2.
Earlier in this workshop, you parameterized the tierod universal joint using the f(x) tool. That
simultaneously parameterized the underlying I and J markers of the joint using a
LOC_RELATIVE_TO function. In the next section, you need to use the LOC_ALONG_LINE
function so you parameterize the joint markers one at a time.
Mention that the completed .sla model is a command file written by hand. They might want to review it
as an intro to what command language looks like. Command language will be covered in Workshop 9
Understanding the Command Language on page 174.
Parameterize this
joint (UCA_ground_rev)
Workshop 4-Purumeterizing un isting ModeI,,,
88 Parametrics: Overview
Purumeterizing the orientution of UCA_ground_rev revoIute goint
In this section, you want the joint markers to be oriented such that the z-axis points from pnt3_ref
to pnt4_ref and the x-axis lies in the plane of the three points: pnt3_ref, pnt4_ref, and pnt6_ref.
To purumeterize the orientution of the J murker:
s Write an function expression for the orientation of uca.uca_ground_rev2 as follows:
(ORI_IN_PLANE( pnt3_ref , pnt4_ref , pnt6_ref , "Z_ZX" ))
To purumeterize the orientution of the I murker:
1 Use the F() tool to collapse the orientation of I marker, ground.uca_ground_rev1, onto the
J marker, uca.uca_ground_rev2.
2 Inspect the commands issued to the Command Window.
3 Which of the following functions was used? Circle the best answer:
ORI_ALONG_AXIS ORI_LOCAL
ORI_FRAME_MIRROR ORI_RELATIVE_TO
Defining u murker Iocution in terms of design vuriubIes
The model is parameterized, but you need to take it one step further. You should use design
variables to define the x, y, and z locations of the marker pnt7_ref.
To define u Iocution in terms of design vuriubIes:
1 Display the Table Editor.
2 Filter on markers:
s Select Filter.
s Set Scope to .sla.ground.
s Set Name Filter to *pnt*.
s Clear the selection of Adams ID.
s Select Location and Location and Ori. Components in Individual Columns.
3 Select Apply.
Workshop 4-Purumeterizing un isting ModeI,,,
Parametrics: Overview 89
4 Select the cell in the Loc_X column for pnt7_ref.
5 Right-click the input box at the top of the Table Editor, point to Parameterize, point to
Create Design Variable, and then select Real.
6 Repeat for the Loc_Y and Loc_Z cells, creating new design variables for each.
7 Select Apply.
8 Close the Table Editor.
9 Adjust the value of DV_3 to see what effect it has on the SLA geometry:
s From the Build menu, point to Design Variable, and then select Modify.
s From the Database Navigator, select DV_3.
s In the dialog box, set Standard Value to 500, and then select OK.
Notice that pnt7_ref moved upwards, and the geometry and constraint adjusted
parametrically.
Running simuIutions of different modeI configurutions
To run different simuIutions:
1 Display the toe angle measure, if necessary.
2 Simulate the model:
s End time: 1.0
s Steps: 50
3 Save the curve on the strip chart.
4 Change DV_3 to 480 and simulate again, and observe the effect on the toe angle
measurement.
Workshop 4-Purumeterizing un isting ModeI,,,
90 Parametrics: Overview
OptionuI tusks
1 Parameterize the outline geometry on ground so it adjusts as you move key points.
Tip: Use the f(x) tool to collapse ground geometry markers onto corresponding cylinder
center markers.
2 Parameterize the lower control arm (lca).
You should parameterize the lca geometry similar to how you parameterized the rest of the
model. In general, the steps are:
s Create design points at pnt1_ref and pnt2_ref.
s Use the F() tool to parameterize:
x Orientation of first long cylinder
x Orientation of second long cylinder
s Parameterize the following:
x Long cylinder lengths using DM.
x Short cylinder orientations using F() tool.
x Short cylinder locations using LOC_ALONG_LINE.
x LCA-to-spindle spherical joint using design points.
x LCA_ground_rev J marker orientation to lie in plane using F() tool with Same As/
Collapse options.
3 Preview what can be achieved with optimization in ADAMS/View:
s Start a new database and change directories to the completed subdirectory.
s Import the model mod_04_completed.cmd from the completed subdirectory.
This will build the fully parameterized SLA model.
s Import the command file prep_model_for_opt.cmd.
This file puts the SLA model into a configuration that needs to have its toe angle
optimized. It prepares the model for optimizing by defining design variables and an
optimization objective.
s Simulate using SIM_SCRIPT_1 to see the design performance of the SLA before
optimization.
Demonstrate the use of design points with simple link geometry. First create a few design points, then
draw the link showing how you want to pick each point when creating the link endpoints.
Workshop 4-Purumeterizing un isting ModeI,,,
Parametrics: Overview 91
s Plot Wheel Height vs. Toe Angle as shown in the figure below:
s Initiate the optimization by importing the command file run_opt.cmd.
You will have to wait a while as it will run several simulations.
s Use Reload Simulations tool in the ADAMS/Post Processor to update the plot with
the optimized design.
Read the readme.txt file for instructions on replay.
Workshop 4-Purumeterizing un isting ModeI,,,
92 Parametrics: Overview
Workshop 4-Purumeterizing un isting ModeI,,,
93
S
PARAMTRIZIM9 A MW MODL
Design the linkage on the hood mechanism so that the hood does not interfere
with the air filter when it is opened.
Bracket
Air
filter
Hood
Whut's in this moduIe:
s Construction Points to Parameterize a New
Model, 94
s Workshop 5Parameterizing a New Model, 95
94 Parameterizing a New Model
Construction Points to Purumeterize u Mew ModeI
Creute und Iocute uII construction points
s Using main toolbar
s Using the Table Editor.
s Creating them on ground (conventional method). You can, however, create them on
parts as well.
Note: For information on importing design points from a file, refer to the Knowledge
Base Article 8122 available at: http://support.adams.com/kb/faq.asp?ID=8122.
When creuting mechunism tie Iocution to construction points
s Ensure that the construction point is selected (either visually or by selecting with right
mouse button) when locating mechanism objects, such as geometry, joints, and
forces.
Parameterizing a New Model 95
This workshop takes about one hour to complete.
ProbIem stutement
You are the designer of the hood mechanism for a storage compartment. The new design of the
compartment has an air filter that needs to be changed frequently. You need to design the
linkage so that the hood does not interfere with the filter when it is opened. By building a
parametric model, you can study different design configurations.
.
9etting sturted
To import the modeI:
1 Start ADAMS/View from the mod_05_hood directory.
2 Import the basic model in hood_start.cmd.
Entire model can be built using a replay file on NT: mod_05_hood/rr/name_visi_via_dbnav.rr
XII I
II
III
IV
V VI VII
X
XI
VIII
IX
Bracket
Air
filter
Hood
Workshop -Purumeterizing u Mew ModeI
96 Parameterizing a New Model
Creuting design points
Now youll create four design points on ground. These points will be the basis on which you
build the rest of the model.
To creute the design points:
1 On the Main toolbox, double-click the Point tool . (Double-clicking the tool puts the
tool in repeat mode and lets you to create multiple points without selecting the tool again.)
2 In the Main toolbox container, ensure that the options are set to the defaults Add to Ground
and Dont Attach.
3 Click on the ADAMS/View window in four different places to create four different
points in roughly the locations shown above. Dont worry about placing the points
exactly because you will set their initial locations later.
4 Select the Select tool to turn off repeat mode.
To renume the points:
1 Using the mouse, draw a box around the four points you've just created to select them.
2 From the Edit menu, select Appearance, set Visibility and Name Visibility to On, and then
select OK.
Now you will see the points and their names.
3 Rename the points to POINT_1, POINT_2, POINT_3, and POINT_4. (To rename a point, right-
click the point, point to the name of the point, and then select Rename.)
You can use the Database Navigator to control steps 2 and 3 of the renaming procedure. To replay the file
on NT, use: mod_05_hood/rr/name_visi_via_dbnav.rr
E
D
A
C
B
Place your
points in
this area
Workshop -Purumeterizing u Mew ModeI,,,
Parameterizing a New Model 97
To set their initiuI Iocutions:
Using the Table Editor, set the point locations to the configuration for the initial design.
1 From the Tools menu, select Table Editor.
2 If necessary, at the bottom of the Table Editor, select Points.
3 In the cells, change the location of the points as shown in the table below.
4 Select OK.
The points should appear as shown below:
Initial Design Point Locations
Design point: Loc_X Loc_Y Loc_Z
ground.POINT_1 -2.3 -89.0 0.0
ground.POINT_2 111.0 -111.0 0.0
ground.POINT_3 40.0 -152.5 0.0
ground.POINT_4 166.0 -142.0 0.0
Workshop -Purumeterizing u Mew ModeI,,,
98 Parameterizing a New Model
Creuting Iinks
Now you will create links between the points. All the links will be of the same width and depth
so you can quickly create the links by setting the desired options and then setting the Link tool
to repeat mode.
To creute Iinks:
1 From the Main toolbox, select the Link tool .
2 In the container, set the options to:
s New Part
s Width: 2.0 cm
s Depth: 2.0 cm
Tip: Be sure to select the check boxes to ensure that ADAMS/View uses the width and
depth.
3 Double-click the Link tool to set repeat mode.
4 Create four links:
s Link from PT_B to POINT_4
s Link from PT_D to POINT_3
s Link from PT_E to POINT_2
s Link from PT_A to POINT_2
Note the following as you draw the links:
s As you select the points, ADAMS/View automatically parameterizes the link to the
design point locations.
s Therefore, when you select the locations, make sure you pick the actual points, not
other markers that might be located on top of the points.
s When prompted for a location, right-click the top of the point and choose the desired
point from the select list. This ensures that the point was selected.
Workshop -Purumeterizing u Mew ModeI,,,
Parameterizing a New Model 99
5 Select the Select tool to turn off repeat mode.
The links should appear as shown below:
Creuting connections between the Iinks
Now youll connect the links using revolute joints, inline joint primitives, and a spring-damper.
To creute revoIute goints:
1 From the Main toolbox, select the Revolute Joint tool .
2 In the container, set the options to:
s 1 Location
s Normal to Grid
3 Double-click the Revolute Joint tool to set repeat mode.
4 Create five revolute joints, taking care to select the correct design point:
s Revolute joint at PT_A (between PART_5 and ground)
s Revolute joint at PT_B (between PART_2 and ground)
s Revolute joint at PT_D (between PART_3 and PART_1)
s Revolute joint at PT_E (between PART_4 and PART_1)
s Revolute joint at POINT_1 (between PART_3 and PART_5)
5 Select the Select tool to turn off repeat mode.
Workshop -Purumeterizing u Mew ModeI,,,
100 Parameterizing a New Model
To creute inIine goint primitives:
You use the Joint palette to create inline joint primitives.
1 From the Build menu, select Joints.
2 Select the Inline Joint Primitive tool.
3 In the container, set the options to:
s 1 Location - Bodies Impl.
s Normal to Grid
4 Double-click the Joint Primitive tool to set repeat mode.
5 Create two inline joint primitives, again taking care to pick the correct design points:
s Inline joint primitive at POINT_2 (between PART_4 and PART_5)
s Inline joint primitive at POINT_3 (between PART_2 and PART_3)
6 Select the Select tool to turn off repeat mode.
To creute the spring-dumper:
1 From the Main toolbox, select the Translational Spring-damper tool .
2 Create the spring-damper from PT_C to marker on PART_2 at POINT_4.
Tip: Because both PT_C and POINT_4 are on ground, be sure to select the marker
belonging to PART_2 at POINT_4 (for example, MARKER_126) not POINT_4.
Workshop -Purumeterizing u Mew ModeI,,,
Parameterizing a New Model 101
To modify the spring-dumper purumeters:
1 Right-click the spring-damper, and then select Modify.
2 Set Stiffness Coefficient to (90(newton/mm)).
3 Set Damping Coefficient to (8(newton-sec/mm))
4 In the Preload text box, enter 0.
5 Select Length at Preload, and in the text box that appears, enter 250.
6 Select OK.
The connected hood should look like the following.
Initial Design
Workshop -Purumeterizing u Mew ModeI,,,
102 Parameterizing a New Model
Testing the purumeterizution
Now youll test the work that youve done so far. Youll verify that the model has only one
degree of freedom (DOF), and then simulate and animate it to see how the hood opens.
To test the purumeterizution:
1 From the Information tool stack on the status bar, select the Model Verify tool , and then
verify that the model has only one DOF. (If it doesnt, go back through the steps and see if
you can find your error.)
2 Simulate the model:
s End Time: 1.0
s Steps: 50
3 As the model simulates, confirm that the hood opens.
4 Does the hood interfere with the filter? _______ Yes _______ No
5 Animate as desired to observe the behavior of the hood mechanism.
6 Look at the strip chart of the measure FUNCTION_MEA_Y to see the displacement of the
hood marker relative to the marker representing the top surface. (If the strip chart is not
visible, from the Build menu, point to Measure, and then select Display.)
Workshop -Purumeterizing u Mew ModeI,,,
Parameterizing a New Model 103
Moving design points to see effect on design
Because you have parameterized the model to be dependent on the design point locations, you
can move the design points to see their effect on the design.
To move the design points to u second configurution:
1 Using the Table Editor, change the location of the points as shown in the table below.
Second Design
2 Simulate the model:
s End Time: 1.0
s Steps: 50
3 Does the hood interfere with the filter? _______ Yes _______ No
Point Locations for Second Design Configuration
Design point: Loc_X Loc_Y Loc_Z
ground.POINT_1 34.5 -91.3 0.0
ground.POINT_2 146.0 -109.0 0.0
ground.POINT_3 112.0 -150.0 0.0
ground.POINT_4 160.6 -147.0 0.0
Workshop -Purumeterizing u Mew ModeI,,,
104 Parameterizing a New Model
To move design points to u third design configurution:
1 Again using the Table Editor, change the location of the points as shown in the table
below.
Third Design
2 Simulate the model:
s End Time: 1.0
s Steps: 50
3 Does the hood interfere with the filter? _______ Yes _______ No
Point Locations for Third Design Configuration
Design point: Loc_X Loc_Y Loc_Z
ground.POINT_1 46.1 -98.4 0.0
ground.POINT_2 111.0 -111.0 0.0
ground.POINT_3 111.4 -146.4 0.0
ground.POINT_4 159.8 -142.3 0.0
Workshop -Purumeterizing u Mew ModeI,,,
Parameterizing a New Model 105
The following figure compares the fully opened hood for each design configuration:
Moving points using the move tooIs
s Move the points using the move tools to identify shortcomings in the way the model
was parameterized, such as the joint not at an intersection, joint not along line, both x
and y-values must be manipulated, as illustrated in the following figures:
Initial Design
Second Design Third Design
Joint_5 not at
*
intersection (*)
POINT_3 isnt along
line from PT_B
to POINT_4
Workshop -Purumeterizing u Mew ModeI,,,
106 Parameterizing a New Model
In this section, you learned how to parameterize a model using design points. In the next
module, you will learn how to create design variables, use them in your parametric model, and
perform a design study to see the effect that variables have on the hood motion.
Workshop -Purumeterizing u Mew ModeI,,,
107
6
DSI9M STUDY
Study the effect of changing link length in the hood mechanism.
Bracket
Air
filter
Hood
Whut's in this moduIe:
s Design Variables, 108
s Design Studies Overview, 111
s Specifying an Objective, 113
s Execution Display Settings, 114
s Output Settings, 118
s Setting Design Variables to Trial Values, 119
s Plotting, 120
s Workshop 6Performing a Design Study, 121
108 Design Study
Design VuriubIes
Overview
Feutures
Design Study 109
Design VuriubIes,,,
Overview
Design vuriubIes
s Define independent parameters that can be tied to objects.
s Organize the critical parameters of the design into a concise list of values that can be
easily reviewed and modified.
umpIe
You can create a design variable called cylinder_length to control the lengths of all three
cylinders as shown next:
Feutures
Cylinder_length = 150
Cylinder_length = 300
C
y
l
i
n
d
e
r
_
l
e
n
g
t
h
C
y
l
i
n
d
e
r
_
l
e
n
g
t
h
C
y
l
i
n
d
e
r
_
l
e
n
g
t
h
C
y
l
i
n
d
e
r
_
l
e
n
g
t
h
C
y
l
i
n
d
e
r
_
l
e
n
g
t
h
C
y
l
i
n
d
e
r
_
l
e
n
g
t
h
110 Design Study
Design VuriubIes,,,
Overview
Feutures
Runge
List of uIIowed vuIues
s Enter a discrete list of values to use in the design study.
Ignore Iist
s Lets you switch back and forth between using the range and the list of values, without
re-entering the list each time.
DefuuIt IeveIs
s If you specify a range only, ADAMS/View uses equally spaced levels across the
range. You specify the number of default levels.
s If you specify a list of values and Ignore List is not selected, ADAMS/View runs a
simulation using each value, ignoring the default levels specified.
Design Study 111
Design Studies Overview
TriuI und error method {munuuI iterutions}
Design study method {uutomuted iterutions}
Model
s Parts
s Joints
s Forces
Simulate
View results
Manually change
the variable
Loop is repeated
several times
Is the
design
optimal?
Completed
Yes
No
Design Variable
(V)
Objective (O)
Model
s Parts
s Joints
s Forces
Simulate
Results
automatically
generated
Plot O versus V
(for each iteration)
Tabular
report
Is this
the final
iteration?
(i=n)
Yes
Variable
changes
automatically
No
The loop goes through specified
number of iterations (i=1,n)
Model gets
updated
112 Design Study
Design Studies Overview,,,
Definition of u design study
s Varies a single design variable (V) across a range of values.
s Runs a simulation at each value.
s Reports the performance measure for each simulation.
From the resuIts generuted you cun determine
s The best value for V among the values simulated.
s The approximate design sensitivity of V (rate of change of performance measure with
respect to V).
Design Study 113
Specifying un Obgective
Meusures
s Select measure and specify whether to use the minimum, maximum, average, or last
simulated value of the measure as the objective value.
s You can easily reference the model outputs and perform many types of computations
on model outputs or other measures.
s You must specify the value of interest every time you perform a multi-run.
Obgective
s Objective objects are valuable when you want to do complex or multi-step
computations on model outputs.
s Use objective objects when measures are not flexible enough.
s Unlike using the measures method, objectives store the value of interest.
Defined viu:
s Measure
x Specify the characteristics directly (minimum, maximum, last value, and so
on).
s Result Set Component (new or existing)
x Specify the characteristics directly (minimum, maximum, average, and so on).
s ADAMS/View Function
x Specify the characteristics indirectly.
s ADAMS/View variable and macro
x Specify the characteristics indirectly.
114 Design Study
ecution DispIuy Settings
ModeI dispIuy updute
Strip churts
TubuIur output
Design Study 115
ecution DispIuy Settings,,,
ModeI dispIuy updute
When you want to update the model:
s Never
s At simulation end
x Most often used for multi-run simulations
s At every output step
s At every integration step
s At every iteration
Strip churts
TubuIur output
116 Design Study
ecution DispIuy Settings,,,
ModeI DispIuy Updute
Strip churts
Churt obgective
Depending on the type of parametric analysis, displays a strip chart of the following:
s Objective value versus variable value for a design study.
s Objective value versus trial for a DOE.
s Objective value versus iteration number for an optimization.
Churt design vuriubIes
Displays a strip chart of the following for each design variable:
s Variable value versus trial or iteration number.
Suve stripchurt curves
Clears all displayed measures at the beginning of the parametric analysis and automatically
saves the curve from each trial or iteration.
umpIe
TubuIur Output
Design Study 117
ecution DispIuy Settings,,,
ModeI dispIuy updute
Strip churts
TubuIur output
Automatically displays a tabular report at the end of the parametric simulation.
Note: You can use the Tabular Report tool to display this table at any time, write it to a
file, and control its format.
118 Design Study
Output Settings
IndividuuI versus muIti-run simuIution
s Both can save analyses
s Only individual can show ADAMS/Solver messages and save ADAMS/Solver files.
MuIti-run simuIution resuIts set
s Analogous format for DOE and optimization studies
s Structure for design studies:
Stop on errors
Stops the analyses if ADAMS/Solver encounters an error during the simulation.
Individual simulation settings
Multi-run simulation settings
Model
Multi-Run Results
Design_Study_Results
Trial Design Variable Objective
Design Study 119
Setting Design VuriubIes to TriuI VuIues
s Sets the design variable values to match those used in a specified trial, and updates
the model graphics to reflect the new values.
120 Design Study
PIotting
Meusure/obgective vuIue versus run
s Plots measure or objective versus the variable value, trial number, or iteration
number.
Meusure versus time
s Plots measure or objective versus time with a curve for each trial or iteration.
s Must have specified a measure or an objective that refers to a measure or result set
component (not a macro or function).
s Must have saved results from individual runs.
Design Study 121
This workshop takes about one hour to complete.
ProbIem stutement
In this workshop you will study the effect of changing link length in the hood mechanism. You
will learn how to create design variables, use them in your parametric model, and perform a
design study to see the effect that variables have on the hood motion.
In Workshop 5Parameterizing a New Model on page 95, you created a parametric model of
the hood mechanism by using design points. You learned that the model configuration could be
altered by moving the points to new locations. You also identified some shortcomings with that
approach. In this workshop you will define the parametric relationships in a different way so
that you eliminate the shortcomings and perform a design study.
9etting sturted
To import the modeI:
1 Start ADAMS/View from the mod_06_hood_DS directory.
2 Import the parameterized hood model, hood_2_start.cmd.
3 From the Settings menu, select Names.
4 In the Default Names dialog box, select Full Names.
5 Select OK.
XII I
II
III
IV
V VI VII
X
XI
VIII
IX
Bracket
Air
filter Hood
Workshop -Performing u Design Study
122 Design Study
Creuting design vuriubIes
In general, you need to identify the parameters in a model that you want to represent with design
variables. In deciding which model parameters would make good design variables youll find
there are a variety of choices you could make. In this example, youll consider a physical
characteristic, such as length, and an assembly characteristic, such as assembly angle.
You will define link lengths and assembly angles through design variables (L1, L2 and A1, A2
respectively). Then, you will prescribe the point locations of POINT_2, POINT_3, and POINT_4
so they are dictated by these design variables through the use of design-time expressions.
A2
A1
L1
L2
Workshop -Performing u Design Study,,,
Design Study 123
To creute design vuriubIes:
1 From the Build menu, point to Design Variable, and then select New. Create design variables
with parameters as shown in the table shown below.
Tip: You may find it easier to use the command line to create the variables.
2 From the Tools menu, select Table Editor.
3 At the bottom of the Table Editor, choose Points, and then select Filters.
The Points Table Editor Filters dialog box opens. Notice that several points are listed. Next,
reduce the set of points so only those of interest are shown.
4 From the Points Table Editor Filters dialog box, select Single Column for X,Y,Z and use a
Name Filter of *POI*.
5 Select OK.
The number of points listed has been reduced by the filtering operation.
Name Real_value Units
Absolute
Range
L1 215.0 length 200,250
L2 210.5 length 200,250
A1 -11.0 no_units -25,+10
A2 +4.8 no_units -10,+10
D1 0.77 no_units 0.15,0.85
Workshop -Performing u Design Study,,,
124 Design Study
Using cyIindricuI coordinutes
To use cyIindricuI coordinutes to redefine POIMT_Z reIutive to PT_A with
the design vuriubIes L1 und A1:
1 Select the location for POINT_2.
2 Right-click in the text box located at the top of the dialog box, point to Parameterize, and
then select Expression Builder.
3 In the Function Builder, replace the existing location with the following:
4 Select Evaluate to check the syntax.
5 Select OK.
The function has been sent to the Table Editor.
6 In the Table Editor, select OK.
The point location is now defined by the expression.
POINT_2
PT_A
A1
L1
Given:
Cylindrical coordinates (r,,z)
You know:
LOC_CYLINDRICAL(r,,z)
Here:
r=L1, =A1, z=0
Therefore:
LOC_CYLINDRICAL(L1,A1,0)
which is a 3x1 location array.
Then:
Express this array relative to
PT_A, by nesting it inside of
LOC_RELATIVE_TO. (See
highlighted step below.)
(LOC_RELATIVE_TO(LOC_CYLINDRICAL(L1, A1, 0),.hood1.ground.PT_A))
Workshop -Performing u Design Study,,,
Design Study 125
7 Using the procedure described in Using cylindrical coordinates on page 124 (or your own
method), redefine POINT_4 relative to PT_B using the design variables L2 and A2. Use the
following nested location expression:
(LOC_RELATIVE_TO(LOC_CYLINDRICAL(L2, A2, 0),.hood1.ground.PT_B))
8 Using the procedure described in Using cylindrical coordinates on page 124, redefine
POINT_3 to be located between PT_B and POINT_4 (as shown in figure below). Use D1 as a
multiplier for % offset from PT_B along line. Use the following location expression:
(LOC_ALONG_LINE(PT_B, POINT_4, D1*DM(PT_B,POINT_4) ))
Sweeping vuriubIes
Now that your design variables have been implemented in the points, you should make sure they
work properly. The usual way to do this is to modify them and change the real_value, testing
the upper and lower limits and values in between. To make this easier for you, we have provided
a custom macro and menu button (sweep) that will sweep a design variable between its upper
and lower limits.
To sweep vuriubIes:
1 Use the F2 key and import utils/DV_sweep/load_sweep_mac.cmd.
This loads the macro into your database and creates a custom menu button.
2 Use the custom menu button:
s From the Build menu, point to Design Variable, and then select Sweep.
0.85*DM
D1*DM
0.15*DM
PT_B POINT_4
DM
Workshop -Performing u Design Study,,,
126 Design Study
3 In the Variable Sweep dialog box, sweep D1 to see how it works.
4 Sweep A1, noticing that POINT_1 isnt staying on the point of intersection between the
links. You will fix that problem in the next section.
5 Sweep the remaining variables, L1, L2, and A2, to confirm that theyre being used
correctly.
Locuting u point ut un intersection of two Iines
As you observed in Workshop 5Parameterizing a New Model on page 95, one of the
shortcomings of parameterizing by points only was that interdependencies werent captured. In
the hood mechanism you saw that POINT_1 should lie at the intersection of the lines PT_A-to-
POINT_2 and PT_D-to-POINT_3. You can calculate this intersection mathematically and store
it in an ADAMS/View user-written function. This function can then be used to define the
location of POINT_1.
To Iocute u point ut un intersection:
1 Change the appearance of POINT_1 to blue so that its easier to see.
2 The algebraic mathematics needed to find the intersection of two lines from four points
are rather involved. Using a text editor, review the contents of find_intersection.cmd (in
the Misc folder) to see the syntax for creating the user-written interpreted function,
INT_PT.
3 How many input arguments are used? 2 3 4
4 How many output values are returned? 2 3 4
5 Would you like to type the lengthy expression text by hand every time you wanted to
calculate an intersection? ____Yes ____No
Note: For information on finding the intersection point of two lines and parameterizing
its location, refer to the Knowledge Base Article 8901, available at:
http://support.adams.com/kb/faq.asp?ID=kb8901.dasp
6 Import the INT_PT user-written interpreted function to calculate the intersection of two
lines from four points in a plane.
Tip: Use the F2 key to quickly import the file find_intersection.cmd (in the Misc folder).
Workshop -Performing u Design Study,,,
Design Study 127
7 Set POINT_1 to lie at intersection of the lines PT_A-to-POINT_2 and PT_D-to-POINT_3 by using
the INT_PT user-written interpreted function. Do so by using the following location
expression syntax to define the POINT_1 location:
(INT_PT(PT_A, POINT_2, PT_D, POINT_3))
8 Test the behavior of the INT_PT function by modifying a design variable and observing
whether or not POINT_1 updates parametrically. Use Sweep Variable and sweep D1.
Notice that the Intersection function (INT_PT) works as desired and all interdependencies
are correctly maintained.
Defining u meusure to study
Soon you will run design studies for several of the design variables. A little later in the course,
you will optimize the model using all the design variables. Both of these analysis types are
known as multi-run simulations, and their command language requires a measure or an
objective as one of the input parameters.
Remember that you want to design the linkage so the hood never touches the filter as it is
opened. Therefore, a measure of that is what you want to study in the design study. As you recall
from Workshop 5Parameterizing a New Model on page 95, there was a pre-existing measure
FUNCTION_MEA_Y that measured the distance from a marker on the rear of the hood to the top
surface of the filter. When the value of that measure became negative, you knew that the hood
was penetrating the filter and was, therefore, an unacceptable linkage design.
Workshop -Performing u Design Study,,,
128 Design Study
As you become more familiar with optimization objectives and constraints, you will learn that
the sign of a measure (+ or -) has special meaning. For example, if an optimization constraint is
positive, then it has been violated. If it is negative, it has not been violated and the design is
considered acceptable. To begin thinking along those lines, modify the FUNCTION_MEA_Y so
that a positive value of the measure indicates that the hood marker has interfered with the filters
top surface. Conversely, if the measure stays negative throughout the operation cycle, it means
that its an acceptable linkage design.
To define u meusure to study:
1 Modify FUNCTION_MEA_Y.
Negate the DY function expression so it appears like this:
-DY(.hood1.PART_1.MARKER_rear, .hood1.ground.top_surf, .hood1.ground.top_surf)
2 If the strip chart is not already displayed, display it.
Note: Later in Workshop 8Optimization on page 158, you will use this measure as a
design constraint in an optimization. Now that youve negated it, its ready to use.
3 Run a baseline simulation (1 sec/50 steps) from the Main Toolbox and review how the
mechanism operates and what the measure looks like.
4 Does the measure stay negative throughout the simulation?_____ Yes _____ No
i
y
j
x
UNACCEPTABLE
The hood should
not interfere with
the filter at any
time during the
simulation.
FUNCTION_MEA_Y=DY(i,j,j)
Workshop -Performing u Design Study,,,
Design Study 129
Performing u design study
Here you will study the effect of L1 on the hood opening behavior by performing a design study.
To perform u design study:
1 From the Simulate menu, select Design Evaluation, and complete the Design Evaluation Tools
dialog box as follows:
s Select Design Study radio button
s Simulation Script: Last_sim
s Study a: Maximum of
s Measure: FUNCTION_MEA_Y
s Design Variable: L1
s Default Levels: 5
2 Select Start to initiate the design study.
3 When the design study has finished, generate a tabular summary report of the design
study by clicking the icon at the bottom of the dialog box.
4 Briefly review its contents.
5 Study the effect of A1 by running a design study.
6 Which trial(s) in this design study had some strange or unexpected linkage behavior?
______________________________________________________________________
Workshop -Performing u Design Study,,,
130 Design Study
7 What was the value of A1 for that trial? ______________________________________
8 Reduce the lower bound for variable A1 so the absolute range is: -15, +10.
Now youll run the design study of A1 again, using the new range. First you will make some
settings that will allow the multi-run simulations to run faster, while still giving you visual
feedback of the opened hood for each design configuration.
To run the design study uguin:
1 In the Design Evaluation Tools dialog box, select the Display button.
The Simulation Settings dialog box opens.
2 Complete the dialog box as follows:
s Execution Display
s Model Display Update: At Simulation End
s Status Bar Monitor Update: At Every Output Step
s Chart Objective
s Save strip chart curves
s Show tabular report
3 Run another design study of A1.
4 Did the study exercise A1 through its new range (-15 to 10)? _____ Yes _____ No
5 Does the range on the variable seem well-bounded now? Why or why not?
_____________________________________________________________________
_____________________________________________________________________
6 In which trial(s) did the objective stay negative (that is, the hood didnt touch the filter)?
___________________
7 Export the model in command file format as after_DS.cmd.
Step 7: There is a known bug where lengthy user-written interpreted functions are not written out cor-
rectly (cr24536). You will encounter errors if you try to read it back in. Workaround: replace function cre-
ate text with that from find_intersection.cmd.
Workshop -Performing u Design Study,,,
Design Study 131
Setting the design vuriubIe to vuIues used in u triuI
Here you will run the simulation using the value obtained from the previous design study.
To set the design vuriubIe:
1 Using the Set Variables tool set the design variable A1 to the value from the trial where
the objective was the maximum negative value (that is, trial 2).
2 Run an individual simulation and animate the results.
3 Save the database.
4 If time permits, complete some of the optional tasks.
OptionuI tusks
1 Run more design studies.
s Set the output settings to Save Analyses for both individual simulations and multi-run
simulations. Perform a design study and select the Plot Results tool from the
dialog box to generate the plots. Review the various plots that are created.
s If you run an additional design study, will it overwrite the saved analyses or create a
series of new ones with similar naming structure?
__________________________________________________________________
s Do you know how to delete the analyses from the database? Please explain.
__________________________________________________________________
2 Experiment with sliders.
s Import the file utils/DV_live_slider/hood_variable_control.cmd. This displays a customized
dialog box with sliders to control the values of the design variables. Experiment with
different settings and run simulations.
3 Run design studies of design variables D1, L2, A2.
s Run design studies of the remaining variables (D1, L2, A2). See how the mechanism
behaves as the design variables sweep throughout their ranges.
s Do the design variable ranges seem well bounded? ___Yes ___No
Slider behavior is somewhat problematic in version 11.0. See CR 25048 for details.
Workshop -Performing u Design Study,,,
132 Design Study
4 Run design study using list of values.
s Modify one of the design variables so that it is defined by a list of values. Run a
design study of that variable and review the summary report to see if it actually used
the list of values you provided.
s Was the list of values used? ____Yes ___No
s Select Allow Design Study to ignore list on the design variable modify dialog box. Run
a design study again.
s Did it ignore your list of values? ____Yes ___No
5 Answer the following questions:
s Do you think it's possible to study more than one measure at a time? ____Yes ___No
Try it.
s How about studying more than one objective at a time. Do you think that would
work? _____ Yes _____ No
Try it.
Tip: Make two objectives, average value and minimum absolute value.
Step 4: There is a known issue where warning pertaining to the list of values may be
reported incorrectly (CR24535). For example, the warning will be in radians when the
user would expect degrees.
Workshop -Performing u Design Study,,,
133
7
DSI9M OF XPRIMMTS
Simulate the motion of a one-legged robot, referred to as the unipod.
Whut's in this moduIe:
s Design of Experiments (DOE) Overview, 134
s Trials Defined By, 135
s DOE Process in ADAMS/View, 139
s Workshop 7Design of Experiments, 140
134 Design of Experiments
Design of periments {DO} Overview
Whut is DO?
s DOE is a collection of procedures and statistical tools for planning experiments and
analyzing the results.
s DOE shows the effects of varying several design variables simultaneously.
Types
s Screening: Identifies which factors and combinations of factors most affect the
behavior of the system.
s Robust design: Methodology developed by Dr. Genichi Taguchi for improving
quality by controlling the effects of variations in a system.
s Response surface methods (RSM): Fit polynomials to the results of the runs, which
gives you a easy-to-use approximation of your systems behavior.
Design of Experiments 135
TriuIs Defined y
uiIt-in technique
Direct input
FiIe input
136 Design of Experiments
TriuIs Defined y,,,
uiIt-in technique
DO technique
s Full Factorial: Simulates every possible combination of levels.
Example: 2 variables (factors) with 3 levels each = 9 simulations.
s User-defined Algorithms: Run simulations based on algorithms you define.
Direct input
FiIe input
Design of Experiments 137
TriuIs Defined y,,,
uiIt-in technique
Direct input
s Does not directly specify factor values.
s Specifies indexes to the levels for each factor. The indexes center on zero. This means
that for a two-level factor, the only possible values are -1 and +1; for three-levels, -1,
0 and +1; for four-levels, -2, -1, +1, +2; and so on.
umpIe
s DOE setup:
s Desired test:
s Corresponding design matrix:
0 +1
-1 0
+1 -1
+1 +1
FiIe input
Factors Levels Corresponding Index
Factor 1 9, 10, 11 -1, 0, +1
Factor 2 85, 90, 95 -1, 0, +1
Run Factor 1 Factor 2
1 10 95
2 9 90
3 11 85
4 11 95
138 Design of Experiments
TriuIs Defined y,,,
uiIt-in technique
Direct input
FiIe input-
s Specify the name of the file containing the trial matrix.
s First line of file must contain:
x number of factors
x number of levels
x number of runs
See user.dat in the mod_07_unipod_DOE directory for an example of file input.
Design of Experiments 139
DO Process in ADAMS/View
The following is the DOE process in ADAMS/View:
1 Start with a parametric ADAMS/View model.
2 Add list of values to the design variables.
3 Define an objective function (that is, the quantity you want to measure).
4 Generate or input the design matrix.
5 Execute runs.
6 Tabulate and output variable and objective values.
The DOE capabilities in ADAMS/View are somewhat limited. You can, however, use
ADAMS/Insight to perform more advanced functions. Refer to the ADAMS/Insight
documentation for more information.
140 Design of Experiments
This workshop takes about one hour to complete.
ProbIem stutement
In this workshop you will simulate the motion of a one-legged robot, referred to as a unipod.
This unipod has a triangular truss structure that has been parameterized using points whose
locations are defined by eight design variables. The unipod is able to move through a small force
actuator that turns on and off repeatedly, applying 650 N of force during its extension. A spring
allows the return stroke of this leg. Your goal is to make the robot walk toward the semi-circular
arc located at the edge of the platform in such a way that when the simulation is complete, its
base is contained within the boundary of the semicircle.
You will learn how to run Design of Experiment (DOE) analyses to identify which design
variables are significant. This screening process will result in a good starting point for an
optimization study.
XII I
II
III
IV
V VI VII
X
XI
VIII
IX
Workshop 7-Design of periments
Design of Experiments 141
9etting sturted
To get sturted:
1 Start ADAMS/View from the mod_07_unipod_DOE directory.
2 Import the baseline model, unipod_start.cmd.
3 Move the strip chart aside so you can see the unipod.
4 From the Settings menu, select Names.
5 In the Default Names dialog box, select Full Names.
6 Select OK.
7 Simulate the model for 1 second using the script SIM_SHORT.
8 Animate as needed to answer the following question:
Does it walk? _____ Yes _____ No
Workshop 7-Design of periments,,,
142 Design of Experiments
Figure 1. Unipod views
Pt4_y
Pt3_x
Pt2_x
FRONT VIEW
w1 and w2 represent weighting factors. The
smaller the value, the less pull the
corresponding ball has at the vertex.
When w1=w2=0.333, the foot is centered in
the lower triangle as shown by the solid
black circle. Each ball has equal weighting.
When w1=w2=0.15, the foot is biased
toward ball 3 as shown by the x. These two
variables are coupled to each other.
2
1
3
TOP VIEW
Pt2_z
Pt4_z
Pt3_z
RIGHT VIEW
x
Workshop 7-Design of periments,,,
Design of Experiments 143
Performing u design study
To perform u design study:
1 Review the eight design parameters by studying Figure 1 on page 142, and sweeping the
design variables with the Sweep Variable customized menu button
s From the Build menu, point to Design Variables, and then select Sweep.
Tip: Use 15 frames.
2 Circle the two parameters that would have the biggest effect on making the unipod walk:
3 Perform a five-level design study of pt4_z:
s Simulation Script: SIM_SHORT
s Study a: Minimum of
s Measure: DM_TO_ZONE
s Design Variable: pt4_z
s Default Levels: 5
4 Create a tabular report of the results. Save the file as U_DS_summary.txt.
5 Which trial made it walk closer to its destination than the others? Write the trial number
and the value here: ________, _______
6 Save the design study multi-run results set:
s Use the Save Last Results button to open the Save Design Evaluation Results
dialog box.
s Name the design study U_DS.
7 Set the value of pt4_z to that of trial 5:
s From the Design Evaluation Tools dialog box, select the Set Variables button to
open the Update Design Variables dialog box.
s Enter 5.
pt4_y pt2_x pt3_x w1
pt4_z pt2_z pt3_z w2
1, -2
1, -1
1, +1
1, +2
2, -2
2, -1
2, +1
2, +2
Workshop 7-Design of periments,,,
Design of Experiments 147
12 Describe, in general, the nature of the path that the unipod takes.
________________________________________________________________
13 Is the unipod fully contained inside the blue semi-circle arc? ____ Yes ____ No
14 Does this seem like a good starting point for an optimization? ____ Yes ____ No
15 Turn off the Saving of Solver files and set Model Display Update to At simulation end so as to
maximize the speed of the optimization multi-run simulations.
16 Save the model database as after_DOE_screen.bin.
OptionuI tusks
Optimizution 1-
1 Using the results from the DOE screen as a starting point, optimize the design using all
eight design variables (pt2_x, pt2_z, pt3_x, pt3_z, pt4_y, pt4_z, w1, w2) and the optimization
constraints OPT_CNSTR_1, OPT_CNSTR_2, OPT_CNSTR_3.
s Simulation Script: SIM_LONG
s Study a: Last Value of
s Measure: DM_TO_ZONE
s Goal: Minimize Des. Meas./Objective
2 Save the optimization multi-run result set as U_OPT_all.
3 Create a tabular report of results named U_OPT_all.txt.
Optimizution Z-
s Using the best solution from the initial design study as a starting point (Trial 5), see if
the solution can be found without the DOE screen, using only an unconstrained
optimization:
x Simulation Script: SIM_LONG
x Study a: Minimum of
x Measure: DM_TO_ZONE
x Design Variables: pt2_x, pt2_z, pt3_x, pt3_z, pt4_y, pt4_z, w1, w2
x Goal: Minimize Des. Meas./Objective
May encounter warning message.
Have them run optimization 1 before lunch as it may take a while.
Computing gradients/performing line search. Iteration: 3 Pass: 1
Objective 1 = 3.902882e+002
Constraint 1 = -5.046156e+002
Constraint 2 = -4.763955e+002
Constraint 3 = -2.728929e+001
The optimization has terminated.
Total optimization analysis calls: 24
Have them run optimization 2 at night because it takes a long time.
Computing gradients/performing line search. Iteration: 8 Pass: 1
Objective 1 = 6.974371e+001
The optimization has terminated.
Total optimization analysis calls: 76
Workshop 7-Design of periments,,,
148 Design of Experiments
Workshop 7-Design of periments,,,
149
8
OPTIMIZATIOM
Optimize the design of the hood mechanism while minimizing the material
cost of the linkage and satisfying three design constraints.
Whut's in this moduIe:
s Optimization Overview, 150
s Constraints, 151
s Optimization Settings, 152
s Workshop 8Optimization, 158
150 Optimization
Optimizution Overview
Optimization adjusts design variables to minimize or maximize a particular aspect of your
models performance.
It involves:
s Determining which objective function you want to minimize or maximize,
s Selecting the design variables you want to change, and
s Specifying the constraint functions that must be specified.
Examples of objectives you might want to optimize are:
s Execution time
s Energy (effort) required
s Total material costs
s Comfort
s Stability
Optimization 151
Construints
Design vuriubIes
s Purpose and setup for optimization studies is the same as for design studies and
DOEs.
s By default, ADAMS/View uses the design variable lower and upper limit (that is, the
range) as constraints for optimization studies.
s You can tell ADAMS/View to Allow Optimization to ignore range.
Construint functions
s Setup is analogous to Objective Functions.
s During optimization study, ADAMS/View ensure that evaluated constraint functions
are always negative, and therefore not violated.
152 Optimization
Optimizution Settings
AIgorithm types
Convergence toIerunce
Iterutions
Differencing
Debugging
AIgorithm types
Optimization 153
Optimizution Settings,,,
AIgorithm types
s DOT1: Use DOT with BFGS (Broydon-Fletcher-Goldfarb-Shanno) for unconstrained
problems; use DOT with MMFD (Modified Method of Feasible Directions) for
constrained problems.
s DOT2: Use DOT with FR (Fletcher-Reeves) for unconstrained problems; use DOT
with SLP (Sequential Linear Programming) for constrained problems.
s DOT3: Use DOT with FR for unconstrained problems; use DOT with SQP
(Sequential Quadratic Programming) for constrained problems.
s OPTDES_GRG: Uses OPTDES Generalized Reduced Gradient.
s OPTDES_SQP: Uses OPTDES Sequential Quadratic Programming.
For more information on algorithms, refer to the paper, Numerical Optimization, which can be
found on the course CD in papers/UC950004.PDF.
Convergence toIerunce
Iterutions
Differencing
Debugging
Provided with ADAMS/View
Provided by Design
Synthesis, Inc.
User-written algorithms
linked to ADAMS/View
DOT1
DOT2
DOT3
OPTDES-GRG
OPTDES-SQP
User1, User2, User3
154 Optimization
Optimizution Settings,,,
AIgorithm types
Convergence toIerunce
s The limit below which subsequent differences of the objective must fall before an
optimization is considered successful.
s Satisfied when:
ABS(objective[new] - objective[new-1]) < convergence tolerance
Iterutions
Differencing
Debugging
Optimization 155
Optimizution Settings,,,
AIgorithm types
Convergence toIerunce
Iterutions
Muimum
s Tells the optimizer algorithm how many iterations it should take before it admits
failure.
RescuIe
s The number of iterations after which the design variable values are rescaled.
s If you set the value to -1, scaling is turned off.
Differencing
Debugging
156 Optimization
Optimizution Settings,,,
AIgorithm types
Convergence toIerunce
Iterutions
Differencing
Technique
s Controls how the optimizer computes gradients for the design functions.
Increment
s Specifies the size of the increment to use when performing finite differencing to
compute gradients.
Debugging
More accurate approximating
More susceptible to random
variations
Helps minimize the effects of
variations.
Gives less accurate gradients.
+
-
+
-
Smaller Increments
Larger Increments
Optimization 157
Optimizution Settings,,,
AIgorithm types
Convergence toIerunce
Iterutions
Differencing
Debugging-
s Sends detailed optimizer diagnostics to the window that launched ADAMS/View.
For more information on optimization, refer to the ADAMS Version 8 Optimization white paper
(in .pdf format) and examples that can be found on the course CD in the old_v8_opt directory.
Debugging output is written to fort.80 file on NT.
158 Optimization
This workshop takes about one hour to complete.
ProbIem stutement
In this workshop, you will optimize the design of the hood mechanism. The goal is to minimize
the material cost of the linkage while satisfying the following three design constraints:
s Inclination angle of 55 degrees when the hood is fully open
s Filter is accessible from above when the hood is open
s Hood doesnt interfere with the filter throughout the entire range of motion.
You will learn how to create a design objective and design constraints, and how to use them in
your parametric model to optimize the design.
9etting sturted
To import the modeI:
1 Start ADAMS/View from the mod_08_hood_OPT directory.
2 Import the hood model that has been parameterized with design variables,
hood_3_start.cmd.
XII I
II
III
IV
V VI VII
X
XI
VIII
IX
Workshop -Optimizution
Optimization 159
3 From the Settings menu, select Names.
4 In the Default Names dialog box, select Full Names.
5 Select OK.
Creuting design construints
In Workshop 6Performing a Design Study, you performed a design study of the parametric
hood mechanism. You learned that you could study the effect of one design parameter in
isolation. Optimization offers many advantages over a design study. For example:
s Multiple design parameters can be changed simultaneously.
s Various design criteria can be monitored and maintained.
s An objective can be minimized (or maximized) automatically to find an optimal
solution.
Each design constraint creates an inequality relationship or criteria. The optimization algorithm
tries to keep the value of the constraint less than or equal to zero. You need to construct your
constraints in such a way that positive values represent undesirable designs, and negative or zero
values represent acceptable designs (or satisfied criteria).
To creute the first construint:
The first design criteria is to have the hood open to a maximum inclination angle of 55 degrees.
You will create a design constraint to monitor the angle, making sure its satisfied during the
optimization.
Here you find the current inclination angle of the hood relative to ground using the AZ function
and then subtract it from the desired angle. This will result in a positive value for the measure
when the angle is less than 55 degrees. This design constraint will be used in the optimization.
1 Create a function measure.
s From the Build menu, point to Measure, point to Function, and then select New.
s Specify the following:
x Measure Name: FUNCTION_MEA_AZ
x Function: 55d - AZ(.hood1.PART_1.MARKER_front)
x Units: angle
Workshop -Optimizution,,,
160 Optimization
2 Define a design constraint using the measure you just created.
s From the Simulate menu, point to Design Constraint, and then select New.
s Specify the following:
x Constraint Name: OPT_CONSTRAINT_1
x Measure: FUNCTION_MEA_AZ
x Design Constraints value: value at simulation end
The output characteristic to monitor is the last value of this measure; that is, when the hood
it fully open.
To creute the second construint:
The second design criteria is to design the hood linkage such that the air filter is easily accessible
from above when the hood is fully open. One way to achieve this goal is to have the rearward
end of the hood move forward as the hood opens, ending at 50 mm offset from the starting
configuration.
Here you find the current distance between PART_1.MARKER_rear and ground.top_surf
relative to ground using the DX function and then subtract it from the desired offset distance of
50 mm. This results in a positive value for the measure when the distance is less than 50 mm.
Again, this will be used as a design constraint in the optimization. When the value of the
constraint is negative, the criteria is satisfied.
Want access
from above
func = 50 - DX(i,j,j)
i
function
- negative side
j
y
x
50
positive side +
Workshop -Optimizution,,,
Optimization 161
1 Create a function measure:
s Measure Name: FUNCTION_MEA_DX
s Function: 50-DX(PART_1.MARKER_rear, ground.top_surf, ground.top_surf)
s Units: length
2 Define a design constraint using the measure you just created:
s Constraint Name: OPT_CONSTRAINT_2
s Measure: FUNCTION_MEA_DX
s Design Constraints value: value at simulation end
The last value of this distance measure is what you want to monitor using this constraint.
To creute the third construint:
The third optimization constraint will be based on the measure you created for the design study
in Workshop 6Performing a Design Study on page 121, FUNCTION_MEA_Y. Remember that
you already negated the value of the measure, so any positive values indicated that the hood was
interfering with the filter. Refer back to the figure on page 128 see what that measure calculates.
1 Define a design constraint using the maximum value of the measure:
s Constraint Name: OPT_CONSTRAINT_3
s Measure: FUNCTION_MEA_Y
s Design Constraints value: maximum value during simulation
vuIuuting the construints
After youve created the constraints, you need to test and evaluate them.
To test the construints:
1 Run a 1 second/50 step simulation using the Main Toolbox.
2 Animate the optimized design using trace markers for: PART_1.MARKER_front and
PART_1.MARKER_rear.
Workshop -Optimizution,,,
162 Optimization
To evuIuute the construints:
1 Press F3 to display the Command Window.
This is where ADAMS/View writes the values of the evaluated constraints.
2 From the Tools menu, select Command Navigator.
3 Select optimize, select constraint, and then select evaluate.
4 Browse the Constraint Name text box and select all three of the constraints you just created.
5 In the Analysis Name text box, point to Guesses, and then select Last_Run.
6 Select Apply.
7 Look in the Command Window to see the approximate values of the constraints.
.hood1.OPT_CONSTRAINT_1(.hood1.Last_Run) 18.18 (deg)
.hood1.OPT_CONSTRAINT_2(.hood1.Last_Run) 43.98 (mm)
.hood1.OPT_CONSTRAINT_3(.hood1.Last_Run) -0.12 (mm)
8 Circle the design criteria that are not satisfied in the given design.
A an inclination angle of 55 degrees
B filter is accessible from above
C hood doesnt interfere with filter
The constraints have been created and evaluated. Now you need to create the optimization
objective.
Workshop -Optimizution,,,
Optimization 163
Creuting the optimizution obgective
You want to optimize the mechanism for minimum material cost. The cost of the material is
proportional to the overall mass of the link parts. You can create a measure that sums the total
mass of the linkage and multiply this by a scale factor to approximate the overall cost. Using a
computed measure, sum the part masses (as accessed with the .mass component value) and
multiply by a scale factor of 10.
To creute u computed meusure:
1 From the Build menu, point to Measure, point to Computed, and then select New.
2 In the Measure Name text box, enter COMP_MEA_COST.
3 In the Create or Modify a Computed Measure text box, enter:
(10*(PART_2.mass + PART_3.mass + PART_4.mass + PART_5.mass))
Note: You could create an objective using procedures similar to those used to create the
constraints, but instead youll just use the measure itself during the optimization,
because its easier.
Optimizing the design
Now you will perform a multi-run simulation known as an optimization.
To run un optimizution:
1 Set execution graphics to update at the end.
This will let the simulation run quickly while still giving you feedback about the opened
hood for each design configuration.
2 Submit a baseline analysis:
s End Time: 1
s Steps: 50
Youll use this script later for the optimization.
Workshop -Optimizution,,,
164 Optimization
3 Submit the first constrained optimization to minimize cost, using the design variables L1,
A1, L2, A2, and D1.
s From the Simulate menu, select Design Evaluation.
s Select Optimization.
s Specify the following:
x Model: .hood1
x Simulation Script: .hood1.Last_Sim
x Study a: Last value of
x Measure: .hood1.COMP_MEA_COST
x Design Variables: A1,A2,D1,L1,L2
x Goal: Minimize Des. Meas./Objective
x Constraints: OPT_CONSTRAINT_1,OPT_CONSTRAINT_2,OPT_CONSTRAINT_3
s Select Start to begin the optimization.
Your Command Window will update with the information from the optimizer.
4 When the optimization is completed, animate the optimized design with trace markers for
PART_1.MARKER_front and PART_1.MARKER_rear.
5 Save the optimization results using the Save Results tool and write a summary table
named opt_results_1.txt. Briefly review its contents.
6 Write down the cost of the optimized design and the angle of the hood.
$______________, ________________
7 Look in the Command Window and answer the following questions:
s Were each of the constraints satisfied? ____ Yes ____ No
s What is the total number of calls made by the optimizer? _______________________
8 Using a text editor, review the file, opt_results_1.txt.
9 Which of the design variables was driven to an upper or lower limit of its range?
_____________________________________________________________________
It doesnt matter what you set in the Study a option menu because the mass doesnt change during the
simulation.
Workshop -Optimizution,,,
Optimization 165
Ignoring the runge of u vuriubIe during optimizution
To ignore the vuriubIe runge:
1 Modify design variable L1 and select Allow Optimization to ignore range.
Make sure that Units is set to length.
2 Perform another optimization.
Note: Warning messages will be issued when L1 is pushed beyond the range.
3 Save the results in a file named, opt_results_2.txt.
4 Have all of the constraints been satisfied? _____ Yes _____No
5 What is the cost of this design? $_____________________________________________
Using u toIerunce bund on u construint
Perhaps you can save some cost by being less strict about the fully-open hood angle. Consider
what design optimum you might find if you said the inclination angle could be 50 +/-5 degrees.
To use u toIerunce bund:
1 Create a design variable A_tolerance that represents the loosening of the inclination angle
design constraint:
s Name: .hood1.A_tolerance
s Units: angle
s Real value: 55.0
s Range: 45.0, 55.0
s Unselect Allow Optimization to ignore range
Consider this a change in the design specification of the inclination angle so that it has a
tolerance band of 50 +/-5 degrees.
2 Modify the measure:
s Measure Name = .hood1.FUNCTION_MEA_AZ
s Function = .hood1.A_tolerance-AZ(.hood1.PART_1.MARKER_front)
s Units = angle
When A_tolerance is included in the list of variables for the optimization, it allows the
constraint to be relaxed, as needed, to find a more optimal solution.
Workshop -Optimizution,,,
166 Optimization
3 Submit a second constrained optimization to minimize cost, using the design variables:
L1, A1, L2, A2, and D1. This time, relax the angle constraint by including the design
variable A_tolerance:
s Model: .hood1
s Simulation Script: .hood1.Last_Sim
s Study a: Last value of
s Measure: .hood1.COMP_MEA_COST
s Design Variables: A1,A2,A_tolerance,D1,L1,L2
s Goal: Minimize Des. Meas./Objective
s Constraints: OPT_CONSTRAINT_1,OPT_CONSTRAINT_2,OPT_CONSTRAINT_3
4 Save the optimization results and write a summary file named opt_results_3.txt. Briefly
review its contents.
5 Write down the cost of the optimized design and the angle of the hood.
$_______________, __________________
6 Were you able to save some cost by loosening the tolerance on the hood angle?
____ Yes____ No
7 Animate the optimized design with trace markers for:
PART_1.MARKER_front, PART_1.MARKER_rear
8 Export the optimized model in command file format as after_OPT2.cmd.
OptionuI tusks
1 Optimize the sla model from Workshop 4Parameterizing an Existing Model by
following the steps in Optional Task 3 on page 90.
2 Read the chapter, About Optimization in the guide, Refining Model Designs in ADAMS/
View to learn about other optimization settings. Try some and see how they work.
3 Use a customized menu button to evaluate design objectives and design constraints.
Import the file misc/eval_menu_buttons.cmd. From the Simulate menu, point to Design
Constraint, and then select Evaluate.
4 Repeat this workshop using a different starting point. Use the third design from
Workshop 5Parameterizing a New Model on page 95 by importing the file,
misc/wkshp_05_3rd_design_setpoint.cmd.
There is a known bug where lengthy user-written interpreted functions are not written out correctly
(CR24536). You will encounter errors if you try to read it back in. Workaround: replace function create
text with that from find_intersection.cmd.
Workshop -Optimizution,,,
167
9
COMMAMD LAM9UA9
Become familiar with the ADAMS/View command language while using a
model of a wing retraction mechanism.
Whut's in this moduIe:
s General Structure, 168
s Getting Familiar with Commands, 169
s Types of Commands, 173
s Workshop 9Understanding the Command
Language, 174
168 Command Language
9eneruI Structure
Syntu ruIes for communds-
s Comment lines are allowed by placing an exclamation point (!) as the first character
on the line.
s Continuation of a command is denoted by an ampersand (&) at the end of a line.
s Abbreviations are allowed, as long as they are unique.
s Examples:
x marker delete marker_name=.mod1.par4.mar27
x marker delete &
marker_name=.mod1.part4.mar27
x mar del mar=.mod1.par4.mar27
x mar del mar=mar27
Syntu ruIes for vuIues
The rules for entering values are:
s Values can contain letters, numbers, and underscore characters.
s They must begin with a letter or underscore character.
s Values can contain any characters that are enclosed by double quotation marks.
s They must have separators (blank space or tab) between keywords and parameters.
Placing separators between parameters and their values is optional.
s All parameter values of type string should be enclosed in double-quotes ().
s All parameter values of type object will accept the full database name or the relative
object name, provided it is unique in the database.
Main point: ADAMS/View is command driven.
May get questions on length of line. Explain that ADAMS/Solver has an 80-character limit, but ADAMS/
View commands do not.
Cover command abbreviation, and mention that a full command is preferred.
One gotcha when writing command files is that the last line might not get executed. Therefore, make it
a habit of making the last line a comment character (!).
Separator (blank or tab)
KEYWORD KEYWORD PARAMETER_NAME=VALUE PARAMETER_NAME = VALUE , VALUE
Parameter Parameter
Command Language 169
9etting FumiIiur with Communds
Commund Muvigutor
Commund Window
Log fiIe
170 Command Language
9etting FumiIiur with Communds,,,
Commund Muvigutor
Enables you to browse through the ADAMS/View command language and execute commands.
s The entire ADAMS/View command language is accessible through the Command
Navigator.
s Use the Command Navigator to navigate on keywords.
s Double-clicking the last keyword of a command displays a dialog box of parameter
names and parameter values.
s Example:
Commund Window
Log FiIe
Double-clicking here
opens...
Which executes the command:
xy_plots template delete title plot_name = .plot_1
Command Language 171
9etting FumiIiur with Communds,,,
Commund Muvigutor
Commund Window
Text-based way to enter commands. Assumes that you understand the ADAMS/View command
language.
Commund History
s Use the up and down arrows on your keyboard to scroll through previously executed
commands.
Commund punsion
s Use a question mark (?) or the Esc key for help with completing commands:
x Completes keywords or parameter names.
x Prompts for keywords or parameter names.
x Prompts for parameter values.
Log fiIe
Input
field
Command
information
area
172 Command Language
9etting FumiIiur with Communds,,,
Commund Muvigutor
Commund Window
Log fiIe
s A file named aview.log is saved during each ADAMS/View session. In the vertical
applications, it is called acar.log, aengine.log, and arail.log.
s Contains commands that you entered and messages you received.
s The previous sessions log file name is aview.log% on Unix and aview.loq on NT.
Command Language 173
Types of Communds
ADAMS/View commands can be categorized as follows:
ModeI-bused
umpIes:
marker create marker_name=mar1 location=2,0,0
marker modify marker=mar1 orientation=0d,90d,0d
Interfuce-bused {9UI}
umpIe:
interface dialog box display &
dialog_box_name = .gui.db_beam_size &
parameters=$f_beam_name
ConditionuI constructs
ADAMS/View command language contains commands for creating conditional constructs and
loops.
s BREAK
s CONTINUE
s IF/ELSE/ELSEIF/END
s FOR/END
s RETURN
s WHILE/END
fiIe tet write
This command writes information from ADAMS/View into a text file. You control 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 additional information on the file text write command, refer to the Knowledge
Base Article 7017 available at: http://support.adams.com/kb/faq.asp?ID=7017.
174 Command Language
This workshop takes about one hour to complete.
ProbIem stutement
In this workshop you will become familiar with the ADAMS/View command language while
using a model of a wing retraction mechanism. You will learn how to write a command file, how
to use the command line for command input, where to go for syntax help, and more.
9etting sturted
To import the modeI:
1 Start ADAMS/View from the mod_09_cmd_lang directory.
2 Import the wing retraction model, wing_retractor_start.cmd.
XII I
II
III
IV
V VI VII
X
XI
VIII
IX
Workshop 9-Understunding the Commund Lunguuge
Command Language 175
ecuting u simpIe commund
In the ADAMS Basic Training class you learned how to use the graphical user interface (GUI)
to build your models. What you may not have realized at the time was that you could have built
them just the same by executing individual commands instead of using the interface. As you
heard in the last lecture, ADAMS/View has a command language. Learning more about this
language will make you a better ADAMS/View user.
Verifying u modeI
Many actions performed with the interface have equivalents in ADAMS/View command
language. You may have seen these commands scroll by in the Command Window or noticed
them in your aview.log file. To begin getting comfortable with the language, you will learn the
command that verifies a model.
To verify the modeI:
1 Display the Command Window so that you can see commands echoed to the screen.
s From the View menu, select Command Window (or you can use the F3 shortcut key).
2 Verify the model by right-clicking the I icon in the Status Bar and selecting the checkmark
icon.
3 From the Tools menu, select Model Verify.
This also verifies the model.
4 Look in the Command Window. What is the command for verifying a model?
______________________________________________________________________
5 In the text box at the bottom of the Command Window, type the command for verifying a
model, and then select Enter.
6 Did it verify the model the same as it did using the interface? _____ Yes _____ No
Input field
Workshop 9-Understunding the Commund Lunguuge,,,
176 Command Language
Commund history eumpIe
The command line input field has helpful features, such as command completion and command
history. Lets use some of them.
To use the commund Iine with history:
1 Place your cursor in the Command Window and click in the input field to activate the
window.
2 Click the Up arrow on your keyboard to see the last command entered, it should be model
verify.
3 Press Enter.
ADAMS/View executes the command.
Notice that the Information window has become cluttered with multiple verify operations.
4 Clear the contents by selecting Clear in the Information window.
5 What was the command that cleared the window?________________________________
Workshop 9-Understunding the Commund Lunguuge,,,
Command Language 177
Commund compIetion eumpIe
At times when you do not remember the full name of a command or its parameter list, you can
use command completion.
In the previous section, you cleared the Information window using an abbreviated command
(info empty). You can learn the full syntax by using command completion.
To use the commund compIetion to cIose the informution window:
1 Enter the following two characters into the Command Window: in
2 Type a question mark (?).
Notice that the Command Window shows that there are two commands that start with the
characters in: interface and info_window.
3 Type the third letter, f, and then enter a question mark.
Notice how ADAMS/View automatically completes the command (with info_window)
when it has enough information to see that it is unique.
4 Enter another question mark, or the Esc key.
The Command Window shows the parameters that are now available. They are: close,
empty, up_page, down_page, read, and set.
Note: The set, up_page, and down_page parameters are obsolete. Occasionally you
may run across old commands in the interface that are no longer being used.
5 Complete the command that will close the information window.
You have just learned how to execute a command by using the command line input. But, what
if you don't even know the first character of a command?
6 Clear the contents of the command line.
7 Type a question mark.
The Command Navigator opens. It displays many of the commands you can use in
ADAMS/View. You can go here for help when you don't know the command syntax. You
will learn more about it later on.
info_window close
Workshop 9-Understunding the Commund Lunguuge,,,
178 Command Language
8 Close the navigator.
Look in the Command Window. Can you see any commands issued to the Command
Window that are equivalent to the closing of the Command Navigator? You probably have
noticed there werent any equivalent commands. There are some GUI operations that are
done in code that are neither shown to you nor echoed to the Command Window.
Using the Commund Muvigutor
Quite often you will see that there are multiple paths to the same command. Earlier you saw that
the GUI has more than one way for you to verify a model, but each use the same underlying
command.
You can see all of these underlying commands arranged in a hierarchical fashion in the
Command Navigator.
To use the Commund Muvigutor to turn off the uppeurunce of u murker
icon:
1 If the model icons are not already visible, turn them on by selecting Icons in the Main
Toolbox.
2 From the Edit menu, select Appearance.
3 In the Database Navigator, browse to and select PART_12.cm.
4 In the dialog box that opens, set Visibility to Off, and select Apply.
5 Look at the command that was issued in the Command Window:
This is the command you want to issue by using the Command Navigator.
Workshop 9-Understunding the Commund Lunguuge,,,
Command Language 179
6 Undo the command so the marker is visible again. (Select Undo from the Main
Toolbox.)
7 Display the Command Navigator by selecting Command Navigator from the Tools menu.
8 Select entity, and then attributes.
The Entity Attributes dialog box opens.
9 Compare this Entity Attributes dialog box to the Edit Appearance dialog box.
Notice that there are some differences in what and how the information is presented.
Usually you will find the dialog boxes from the Command Navigator to be more generic,
whereas dialog boxes from other parts of the interface are specialized for certain tasks or
tailored to look a special way. All the dialog boxes from the Command Navigator are auto
generated. This is a nice feature that you can use when you need a basic dialog box for a
macro you may have written. More information on dialog boxes will come in Workshop
9Understanding the Command Language on page 174.
Tip: Auto-generated dialog boxes may not always display the correct options and text
box values. If you place your cursor in the Name text box and press Enter, the
information will update with the correct information.
10 Complete the Entity Attributes dialog box (shown above on the left) the best you can and
see if you can turn off the visibility of the marker, PART_12.cm.
Hint: Use Visibility instead of Expr Visibility.
Workshop 9-Understunding the Commund Lunguuge,,,
180 Command Language
You saw how to use the Command Navigator to turn off the appearance of a single marker.
What if you wanted to turn off more than one marker? You can use wildcards, such as the
asterisk (*).
11 Turn off all markers using a wildcard:
s Entity Name: .model_1.*
s Type Filter: marker
s Visibility: off
s Name Visibility: off
12 Select Apply.
Notice all the markers have turned off.
If you want to learn about other wildcards, see Using Wildcards in the guide, Learning
ADAMS/View Basics.
Workshop 9-Understunding the Commund Lunguuge,,,
Command Language 181
ecuting communds in u fiIe
The commands that you issue can be stored in a file and imported as needed. For example, say
you want to turn the visibility of all the markers back on by importing a file.
To eecute communds in u fiIe:
1 Look in the Command Window until you find the commands that just turned off the
marker visibility with the wildcard.
2 Highlight the commands, right-click, and then select Copy.
Selecting Copy places them on the clipboard.
3 Open a text editor and paste in the commands.
Look closely at the commands and compare them to the dialog box. You will see that there
is a strong similarity (nearly identical) between the command language syntax and the field
names in the dialog box. Observing and studying this information is another way to learn
the command language which helps you to write and understand command files.
4 Edit the text, changing the visibility parameter to on, instead of off.
5 Save the file as all_markers_on.cmd.
6 Import the file to execute the commands.
The markers turn on.
7 Modify the file, changing the visibility to off.
8 Save the file as all_markers_off.cmd.
9 Import the file to turn off the marker visibility using the F2 keyboard shortcut.
The markers turn off again.
10 Looking at the command files youve written, will they work as is, on a model that is
named .model_2? _____ Yes _____ No
11 This name-specific dependency is quite common. Which of the following seems like the
best solution to this sort of problem (check one):
____ Hand-edit the file every time you want to use it on a different model.
____ Always name all of your models .model_1
____ Write the command file more generically so that it's not model-name dependent.
____ Just use the interface and don't write your own command files.
If the students try to run the model as is, the disk replicates will just fall, due to gravity. Therefore they
must use fixed joints to prevent them from falling. The kb6607 has a parameterless macro for locking parts
to ground. They can access it in the subdirectory from_kb/fixed_jnt_selected_parts.
Workshop 1Z-Mucros und Purumeter Syntu,,,
Macros: Syntax and Parameters 257
umpIe of how to orgunize u suite of mucros
Sooner or later you will have written enough macros that keeping them organized will be a task
in and of itself. Lets look at one approach you could use to organize a suite of macros.
Several versions ago, one of the application engineers at the MDI office in Germany had
assembled many of his macros and packaged them together for internal use as the TK_toolkit.
Since then, ADAMS/View has changed quite a bit, making many of the macros in the toolkit
obsolete. However, there are still some very useful gems: a fine set of examples from which you
can harvest tricks, expand your understanding of macro syntax usage, and see some creative
ideas.
The Arc TooIkit eumpIe
A large portion of the macros in the TK_toolkit dealt with the creation of arc geometry. Here
weve taken that subset of macros and grouped them together in a custom interface window,
complete with its own set of menus, and called it the Arc Toolkit.
Workshop 1Z-Mucros und Purumeter Syntu,,,
258 Macros: Syntax and Parameters
To orgunize u mucro:
1 Open a new database, and select Create a new model.
2 Draw a simple arc on ground (using the Main Toolbox).
3 Load the Arc Toolkit by importing the command file, custom_window_start.cmd.
Notice that it displayed the standard toolbar, which appears beneath the Main menubar, as
shown in the previous figure.
4 To display the Arc Toolkit, from the standard toolbar, select the Arc Toolkit icon .
5 Browse through the menus to see the variety of choices available. Behind each menu
push button is a separate set of macro commands.
6 Select one of the menu buttons and fill in the text boxes in the dialog box accordingly.
7 Pick one or two of the macros and review their commands in the macro editor.
Hint: You can find the macros inside the library, my_cust.
Do you notice anything different about the macro(s)? One big difference is that $_self was
not used. Why? Because it didnt exist back when the macros were originally developed.
Keep that in mind when you review these or any other macros, because some of the
techniques used may be a bit dated when judged against the latest standards or available
commands and features.
Using u buiId fiIe
When you imported the file that built the Arc Toolkit, the building was being done in a creative
way. All of the macros for the Arc Toolkit are in a separate subdirectory. An environment
variable stores the path. When the build file is imported, it uses the value of the environment
variable to know where to look for the macros. Here youll learn more about how it was done.
Workshop 1Z-Mucros und Purumeter Syntu,,,
Macros: Syntax and Parameters 259
To use u buiId fiIe:
1 Open the custom_window_start.cmd file in a text editor.
A
B
C
D
E
Workshop 1Z-Mucros und Purumeter Syntu,,,
260 Macros: Syntax and Parameters
2 Review the general structure of this build file. (We refer to it as a build file because it
builds the toolkit.) Here are the primary sections:
A The PUTENV design-time function is used so that the environment variable tk_tools
is set to the directory path where all of the macros reside. (Setting the environment
variable using a command in this fashion is optional. Although you must set the
environment variable for the macros to load properly, it is not necessary to set it with
this command. You could set it directly in a UNIX or DOS shell, if you prefer.)
B An ADAMS/View library is created, which acts as a repository for all the
customizations of the Arc Toolkit, such as macros and menus. This keeps the
database organized so that everything customized is isolated from the standard
interface objects.
C ADAMS/View reads the macros into the database and stores them in the library,
.my_cust. The path to each macro file is constructed by getting the value of the
environment variable and concatenating that string with the known path beneath the
known macros subdirectory structure.
D An interface window, menubar, and menus are created.
E Menu push buttons are defined, with each having an underlying macro command.
You will learn more about D and E in Workshop 13Creating Custom Menu Buttons on
page 269.
This is one approach for building a suite of customized macros. You might consider doing
something similar with the macros you develop.
You have learned to write macros. You can find more information about the syntax in the
online documentation.
Workshop 1Z-Mucros und Purumeter Syntu,,,
Macros: Syntax and Parameters 261
Other resources
This workshop contains a few macros from the Knowledge Base. You can find the macros in
the subdirectory, from_kb. Some of the subdirectories are:
s contact_site - Contains a macro, cont_site_mac.cmd, for visualization of the site of
contact. This is a good example of how to use comments in your macro for
documentation purposes.
s fixed_jnt_selected parts - Contains two macros for creating fixed joints for every part
that is on the select list.
s geometry_select_only - Contains a menu button that uses a parameterless macro to
loop through all the parts on the select_list and find the immediate children that are of
type=geometry. Then, it empties the select list and replaces it with those geometries
that it found. It also displays the select list manager so you can remove some
geometry from the list.
s line_of_markers - Contains a macro, line_of_markers_mac.cmd, that uses a FOR loop
to generate a number of new markers equally spaced along the line between two
existing markers. All new markers will automatically belong to whatever part is
currently the default and will be given unique names like MAR_1, MAR_2, and so on.
The new markers will all have their primary axis (which is the z-axis, by default)
pointing from the first marker toward the second marker.
s list_inactive_objects - Contains a macro, check_if_inactive.mac, that will loop
through parts, forces, and joints in a model. When it finds an object that has attributes
of active=off, it will put it inside a group. This group of objects will be listed later in
the Information window when the macro finishes running.
s solver_curve_to_polyline - Contains a macro, curve2poly.mac, that will convert an
ADAMS_curve entity to a Polyline entity. All you have to do is specify the curve that
you want converted and the marker representing the reference frame for the data. The
polyline will be created and will belong to the parent of the marker specified.
For more information, see the ADAMS Knowledge Base, located on the support site (http://
support.adams.com). To find macros, use the keyword macro or perform boolean searches like
macro* and joint or macro* and beam.
Workshop 1Z-Mucros und Purumeter Syntu,,,
262 Macros: Syntax and Parameters
Several older macros, from version 8.2, are on the CD in the directory, old_v8_macros. This
directory contains many macro examples that were shipped with version 8.x (as mentioned in
kb6660). None of the macros provided there have been updated for release 9.x or beyond. In
fact, its possible that the functionality provided by a given example may now be superseded by
standard ADAMS/View features. Regardless, they represent an assortment of examples from
which you can improve your understanding of syntax and expressions, and what you can do
with the macro language in general. See the file, readme.txt, in that directory for a list of the
macros available.
The macros are provided on the CD for this training course on an "as is" basis.
OptionuI tusks
1 Write a macro that creates markers at every vertex of a given polyline. Use either a
FOR/END or a WHILE/END construct.
2 Write a macro, poly_2_outline_mac.cmd, that converts polyline geometry to outline
geometry.
3 Review the commands for the macro that was used to sweep the value of a design
variable. You can find the macro, var_swe_mac.cmd in the subdirectory, DV_sweep.
4 Write a macro, cre_imp_sfo_mac.cmd that creates an impact SFORCE from two markers,
and the IMPACT function parameters: stiffness, damping_coefficient, and free_length.
For simplicity, for this example, hardcode the exponent to 1.0 and the penetration to 0.1.
5 Write a macro, display_joint_mac.cmd, that displays a joint and its parent parts.
6 Try out the macro, tra_swe_btw_mar_mac.cmd, which can sweep the animation trace in
ADAMS/PostProcessor from one marker to another.
Workshop 1Z-Mucros und Purumeter Syntu,,,
263
J3
MMUS
Learn how to create new menu buttons on the main menu bar, as well as your
own menu bar.
Whut's in this moduIe:
s Menu Builder, 264
s Syntax of Menu File, 265
s Using Commands to Add Menus, 268
s Workshop 13Creating Custom Menu Buttons,
269
264 Menus
Menu uiIder
Overview-
s You can use the Menu Builder to modify and create menus to better suit your needs
and preferences, or match your industrys terminology.
s You can specify keyboard accelerators (shortcuts) and mnemonics.
s You can build menus for a particular model or for an entire application. You can add
the elements shown in the following figure:
Mention to the students that the interface terminology used in the ADAMS command language may not
match the terms found in the online documentation.
Menu
Button
Button
Menus 265
Syntu of Menu FiIe
s Each line of a menu file defines an object and its name, or specifies information about
the parent object. For clarity, ADAMS/View indents the lines. As you edit the text,
you can also indent the lines.
s The following figure shows a portion of the Menu Builder that defines the Help menu
in ADAMS/View. To the right of the Menu Builder is the corresponding Help menu
as it appears in ADAMS/View.
266 Menus
Syntu of Menu FiIe,,,
Menu
MENUn TITLE
NAME=name
HELP=Help
utton
BUTTONn LABEL :: ACCELERATOR
NAME=name
HELP=help
CMD=command
Sepurutor
SEPARATORn
ToggIe
TOGGLEn TITLE
NAME=name
HELP=help
STATE=state
CMD=command
Menus 267
Syntu of Menu FiIe,,,
s The text lines have the following parameters:
x n is an integer between 1 and 10, usually 1, 2, or 3. It defines the menu level
in which the object appears. Level 1 is the first level. MENU1 appears on the
menu bar, for example, while BUTTON2 appears under the preceding 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.
x You can cascade menus up to 10 deep by nesting MENUs below other
MENUs. You can include as many buttons in a menu as you want, although
you should not create more than will fit on your screen.
x label is the text that appears in the 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) format file. In Windows, the icon name is
the name of a bitmap (.bmp) format file.
268 Menus
Using Communds to Add Menus
If you want to modify the ADAMS/View main menu, it is highly recommended to do this using
commands instead of the Menu Builder, or .mnu file.
Menus 269
This workshop takes about one hour to complete.
ProbIem stutement
In this workshop you will learn how to create new menu buttons on the main menu bar, as well
as your own menu bar. You will become familiar with the ADAMS/View command language
for creating these interface (GUI) objects and will become comfortable with using the Menu
Builder.
9etting sturted
To get sturted:
s Start ADAMS/View from the directory, mod_13_menus, and then select Create a New
Model.
Demonstrate the menu editor by setting the following menu accelerators for macro record/replay:
Record Start : : F10
Record End : : F11
Execute : : F12
XII I
II
III
IV
V VI VII
X
XI
VIII
IX
Workshop 13-Creuting Custom Menu uttons
270 Menus
Adding new menu buttons to the muin menu bur
You can add your own menus and push buttons onto the main menu. How you do this will
depend on the extent of the changes you want to make. Sometimes, if you are making several
menu modifications, youre better off creating your own interface window and a separate menu
structure on that window. Thats how the Arc Toolkit from Workshop 12Macros and
Parameter Syntax on page 241 was done, for example.
If youre just making a few minor changes to a menu, the easiest way to do that is with the Menu
Editor. In other instances, you may prefer to write the command language in a command file
that you can import.
Modifying the muin menu using the Menu uiIder
If creating a marker using the Main Toolbox doesnt give you all the versatility you want, you
can access the Command Navigator and use the Marker Create and Marker Modify dialog boxes
instead. Lets make those features more convenient by creating a Marker New and Marker
Modify push button on the Build Menu as shown next:
To modify the muin menu:
1 From the Tools menu, point to Menu, and then select Modify.
The Menu Builder appears.
Move it aside slightly so it will be visible even if it were to go behind the main window.
Workshop 13-Creuting Custom Menu uttons,,,
Menus 271
2 Scroll about half-way down to where you see this portion of the menu text outline.
3 Place your cursor at the end of the last line of the highlighted text shown above.
Place your cursor here
Workshop 13-Creuting Custom Menu uttons,,,
272 Menus
4 Press Enter, and then type in the following text outline:
MENU2 Mar&ker
NAME=marker
BUTTON3 &New...
CMD=int com com="marker create"
HELP=Create a marker by using a dialog box
BUTTON3 &Modify...::Ctrl+M
NAME=modify_button
CMD=int dia dis dia=.gui.mar_mod
HELP=Modify an existing marker
Your window should look as shown next:
Tip: Placing an & in the label identifies that the next character will be used as the
mnemonic (for example, enter &New to have the resulting menu command be New.)
If the students are short on time they can cut/paste the text from the file misc/shortcuts.txt
Workshop 13-Creuting Custom Menu uttons,,,
Menus 273
5 To execute the changes to the menu, from the Menu Builder window, select the Menu Bar
menu, and then select Apply.
6 In your ADAMS/View window, look in the Build menu to verify that your new buttons
are in the Build menu. Test them out. Notice that the status bar displays the help text that
you entered for each push button.
Suving the chunges to u menu
To suve chunges:
1 Display the Menu Builder again.
2 From the Menu Bar menu, select Export Text.
3 Save the file as main.mnu.
The menu text outline has been saved to your local directory.
4 In the Menu Builder, from the Menu Bar menu, select Exit.
Restoring the customized menu
To restore the menu:
1 Open a new database (without saving changes), and create a new model.
2 Select the Build menu and look at the menu buttons.
3 Are your customizations there? ____ Yes ____No
4 To load your customized menu into the database, from the Tools menu, point to Menu, and
then select Read Local Main Menu.
5 Check the Build menu again, this time you will see the custom buttons.
Tip: Try executing the marker modify with the keyboard accelerator shortcut, Ctrl-m.
Note: The file must be named main.mnu in order for it to be loaded by the Read Local
Main Menu button. Also, ADAMS/View will only look in the local directory (the
directory where you started ADAMS/View, or the current directory as set by File -
Select Directory).
6 If you want to load a menu file that has a different name, from the Tools menu, point to
Menu, and then select Read.
Workshop 13-Creuting Custom Menu uttons,,,
274 Menus
Other feutures of the menu buiIder
Experiment with the Menu Builder features to get a feel for what they do. Then, complete the
quiz below.
Quiz:
Draw a line to match items in the left column with choices in the right column:
1 Repopulates the text Menu Builder
with the state of the current menu.
2 Writes the text outline for the menu to
a text file.
3 Imports text from a file into the
current position of the cursor.
4 Takes the text outline and applies it,
thus modifying the menu structure
5 Exits the Menu Builder
6 Take a menu existing in the database
and load it into the Menu Builder.
Load
Apply
Reload
Import Text
Export Text
Exit
Workshop 13-Creuting Custom Menu uttons,,,
Menus 275
Modifying the muin menu bur by writing commund Iunguuge
In Workshop 6Performing a Design Study on page 121, you used a custom menu button (and
macro) to sweep the value of a design variable. You would probably agree that using a button
on the menu is often simpler than traversing through the multitude of commands available in
the Command Navigator. Here you will learn how to create a menu button by writing the
command language directly. This alternate approach is helpful because it gives you an
organized way to reconstruct a customized menu structure.
To modify the muin menu bur:
1 Start a new database and import the file, load_the_sweep_macro.cmd.
ADAMS/View loads the sweep macro into the database where it will be stored with the
name, .var_swe.
Notice that ADAMS/View does not have a model in the database, as indicated by the title
text in the upper left corner of the view window. Since you will be modifying the interface,
it is not necessary to have a model open.
2 What is the command prefix for this macro? ____________________________________
Hint: Look in the Command text box in the macro editor.
ADAMS/View can auto generate a dialog box for this macro when you supply it with the
command prefix you wrote above.
3 Execute the following command from the Command Window and it will auto generate
and display the dialog box for the sweep macro.
interface command_builder command_prefix = "variable sweep"
This is the command you should put behind the button, to display the dialog when you click
the button.
4 Now compare the following commands:
interface command_builder command_prefix = "variable sweep"
interface dialog_box display dialog_box_name = .gui.var_swe
Workshop 13-Creuting Custom Menu uttons,,,
276 Menus
5 We had you type the first command instead of the second one for a reason. See if you can
identify the best reason from the choices below: (check one)
____ They are equivalent and you need to learn all the different ways of displaying a dialog
box.
____ The first command has fewer parameters and would be easier to type.
____ The dialog box .gui.var_swe doesnt yet exist. You cant ask the code to display a
dialog box if it hasnt been created first.
____ They have the same number of characters so the reason for choosing one command
over the other is irrelevant.
6 Close the Variable Sweep dialog box.
Workshop 13-Creuting Custom Menu uttons,,,
Menus 277
Reviewing the menu hierurchy
Here youll create a button named Sweep under the Build menu. Let's see the hierarchy of that
menu so we know where to place the new button.
To review menu hierurchy:
1 Use the Database Navigator to see the structure of the menu hierarchy.
s Open the Database Navigator.
s At the bottom, to the right of the Filter text box, choose All from the option menu. This
will allow the GUI objects, like menus, to be shown. The GUI objects are normally
filtered out.
s Expand the gui library and navigate as shown next:
Note: You may have to widen the Database Navigator to see the object type.
2 Select Design_Variable_select.
3 Select OK.
Workshop 13-Creuting Custom Menu uttons,,,
278 Menus
4 In the Information window, ADAMS/View displays information about that GUI object,
.gui.main.mbar.build.Design_Variable.Design_Variable_select.
5 Review the text in the window and circle the best answer, True or False:
T F The object is a menu.
T F The parent of the object is a Graphic_Interface_Menu.
T F A menu button cannot execute more than one command with a single click.
T F The parent of the object has two children. (Hint: use the Parent and Children
buttons in the info_window).
T F You will soon create a Graphic_Interface_Push_Button that will be a sibling of
Design_Variable_New and Design_Variable_select.
Workshop 13-Creuting Custom Menu uttons,,,
Menus 279
Workshop 13-Creuting Custom Menu uttons,,,
Creuting your own button
To creute your own Sweep button:
1 Open the file load_the_sweep_macro.cmd in a text editor.
2 Scroll down to the section of comments shown here:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! INSERT YOUR COMMANDS FOR CREATING PUSH BUTTON BELOW
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3 Modify the file so it can create the menu push button by entering the following command
language in the space provided.
Here, the backslash is used as an escape character, allowing the quotation mark characters
to be seen as literal characters, instead of as the closing quotation mark of the interface
command.
4 Save the file as load_the_sweep_macro_and_button.cmd.
Now youre ready to test the command file to see if it loads the macro and creates the menu
push button.
interface push create &
push_button_name=.gui.main.mbar.build.design_variable.Design_Variable_Sweep &
label = "Sweep..." &
help_text = "Sweeps the value of a design variable through its absolute range" &
command = "interface command_builder command_prefix = \"variable sweep\" "
280 Menus
5 Import the command file you just created.
6 Import the hood model from Workshop 8Optimization on page 158 that has been
parameterized with design variables.
7 Find the new menu button and select Sweep.
The Variable Sweep dialog box should open.
8 Sweep the D1 variable.
You have learned the two different ways of creating customized menu buttons. For more
practice, if time permits, complete the following section.
Understunding the structure of menu bur on u customized window
In Workshop 12Macros and Parameter Syntax on page 241 you used the Arc Tools custom
menu. Lets briefly review how it was created.
To eumine the structure of u menu bur:
s Open the file, custom_window.cmd. Briefly note the following items listed in sequential
order:
a The tk_tools environment variable is set to the appropriate path to the macro files.
b A custom library named my_cust is created.
c Several macros are imported and stored in the .my_cust library.
d An interface window named arc_toolkit is created in the .my_cust library.
e A menubar, menus, and push buttons are created. The push buttons issue the
macro commands for the macros that were imported.
f An icon is created on the standard toolbar.
Workshop 13-Creuting Custom Menu uttons,,,
Menus 281
Adding u push button to u custom window menu
To udd u push button:
You need to add two buttons to the Arc Tools menu, Simple Arc, and Swap Parent.
1 Start ADAMS/View and import the file custom_window.cmd.
2 Display the standard toolbar:
s From the View menu, point to Toolbox and Toolbars, and then select Standard Toolbar.
s Close the Tool Settings dialog box.
3 Select the Arc Toolkit tool .
The Arc Toolkit window opens:
4 Select the Create Arc menu, and notice that there are four push buttons listed.
You need to add another one named Simple Arc.
5 Use the Menu Editor to add the following button to the top of the Create Arc menu.
The procedure is similar to the one you used to modify the main menu in Modifying the
main menu using the Menu Builder on page 270.
Hint: Use Load and browse the menu in .my_cust.
BUTTON2 S&imple Arc
NAME=Simple_Arc
CMD=interface window undisplay window_name = .my_cust.arc_toolkit
CMD=interface command_builder command_prefix = "geometry create curve arc"
CMD=interface window display window_name = .my_cust.arc_toolkit
6 Test your button. Is the proper dialog box displayed?
7 Save the menu as arc_toolkit.mnu.
Consider the repercussions of using both the menu file and the custom_window.cmd file that
built the Arc Toolkit.
Perhaps the command file to build the Arc Toolkit could be rewritten so it just imports the
.mnu file. Do you think it's possible to write a command like that?
8 See if you can find a command that would do that, and write it here:
______________________________________________________________
Mention in passing that there has been an 'Easter Egg' hidden in the Arc Toolkit. If you double-click the
arc head icon a certain number of times you may see something special happen.
Workshop 13-Creuting Custom Menu uttons,,,
282 Menus
Chunging the hierurchy of un eisting menu
The Menu Builder lets you insert menus and buttons anywhere you like within the hierarchy.
Conversely, when you make changes to a menu using command language, instead of the Menu
Builder, there is a small downside: your changes will always be added to the bottom of an
existing menu. This is because the order of creation dictates the placement on the menu. That
explains why the Design Variable Sweep button was listed under New and Modify, whereas the
Marker custom menu did not end up at the bottom of the Build menu.
Therefore, if youre making small changes in hierarchy using command language, your strategy
might be to delete (or modify) a menu and to replace it with another, which will of course appear
at the bottom of the given menu.
Removing u push button
In this section, you will remove a push button and replace it with a menu and two push buttons.
As you recall from Workshop 8Optimization on page 158, optimizations will create verbose
output in the Command Window and in the file, aview.log. Eventually you may want to clear
out the log file so its not so big.
In this section, you will create a new menu entry that will clear the contents of the file,
aview.log. This will replace the Log File menu button with a new hierarchy:
By the way, kb9046 contains this method of clearing the log file.
After
Push
buttons
Menu
Push
button
Before
Workshop 13-Creuting Custom Menu uttons,,,
Menus 283
To remove u push button:
1 Using a text editor, open the file, test_menu_button_start.cmd.
2 Review the commands for:
s Deleting a push button
s Creating a separator line
s Creating a new menu entry
s Creating two new push buttons
Notice how the last push button just imports a command file named testit. This trick is a
clever way of changing the commands of a push button without manipulating the menu
editor, as you are debugging the logic in the underlying code.
In this case, the testit command file merely issues a message to the screen that the button is
working.
3 Import the file, test_menu_button_start.cmd.
4 Test the menu structure for the log file by selecting the new menu push buttons.
When you clear the log file, youll get the following message:
5 Rename the file testit.cmd to testit_0.cmd.
6 From the Tools menu, select Log File, and then select Clear Log File.
7 Did you get the error shown below? ____ Yes ___ No
ERROR: ADAMS/View could not open Command file testit.cmd for reading.
When you attempt to clear the log file, its trying to read a command file that's no longer
there.
8 Create a new file named testit.cmd by copying the file named testit_clear.cmd.
Workshop 13-Creuting Custom Menu uttons,,,
284 Menus
9 From the Tools menu, point to Log File, and then select Clear Log File.
The button works, and displays the following window:
10 Select one of the buttons.
11 Exit ADAMS/View.
Given this scenario of using a button to import a command file that you are debugging, you
would eventually need to put the commands behind the button. You would need to change
the button command from file command read... to the true set of commands. You can find
the completed button syntax for the above example in the file, clr_log_file_menu.cmd in the
subdirectory, from_kb/clr_log_file_menu.
Workshop 13-Creuting Custom Menu uttons,,,
Menus 285
OptionuI tusks
1 Learn some of the other interface commands by importing the file misc/
other_interface_menu_commands.cmd.
2 As you develop design objectives and design constraints (prior to running an
optimization) you often want to evaluate them for a given analysis. Use the customized
buttons in kb7917 to create the following new menu buttons:
3 Create a menu push button named Preview Parts at the bottom of the View menu. Use any
method you want to create the push button, but make it use the commands contained in
the file misc/preview_parts.cmd.
Continue with the optional tasks on the next page.
If the KB is not accessible, they can use the file, eval_menu_buttons_full_errchk.cmd in the
from_kb/obj_eval_menu subdirectory.
Create these entries
Workshop 13-Creuting Custom Menu uttons,,,
286 Menus
4 Using the Read Command File button on the Tools menu as a guide, create a menu button,
called Run Parameterless Macro on the Tools menu, which can be executed with a keyboard
accelerator (F12 key).
Hint: To learn more about accelerator key syntax review the online documentation about
menus.
BUTTON2 Run Parameterless Macro::F12
NAME=run_paramless_macro
CMD=! Note: F12 shortcut uses this
CMD=var set var=$_self.tmp_mac object=(eval(SELECT_OBJECT(DB_DEFAULT(.System_Defaults, "model").parent, "*" , "Macro" )))
CMD=var set var=$_self.tmp_str string=(eval(EXECUTE_VIEW_COMMAND(STR_DELETE( (my_macro.object_value),1,1))))
CMD=var del var=$_self.*
Test the button by running a recorded macro as well as the parameterless macro,
constraint_DOF_wiggler.cmd. For more information on parameterless macros, see Writing a
parameterless macro on page 230.
5 Create a menu button that will revolve a model about the screens y-axis in 100
increments, 3.6 degrees each. Use the file, revolve_the_model.cmd in the directory,
misc/revolve as the source for your commands.
Workshop 13-Creuting Custom Menu uttons,,,
287
J4
DIALO9 OXS
Create a dialog box that modifies the x and y coordinate locations of points 1,
2, and 4 of the disk transfer linkage.
Whut's in this moduIe:
s GUI Overview, 288
s Terminology, 289
s Working with Dialog Boxes, 290
s Dialog Box Builder Overview, 294
s Dialog Box Commands, 297
s Dialog Box Database Storage, 298
s Workshop 14Working with Dialog Boxes, 299
x Module review, 316
Show the Design Evaluation Tools dialog box as an example of a customized dialog box.
288 Dialog Boxes
9UI Overview
Dutubuse hierurchy for gruphicuI user interfuce {9UI} obgects
Window Dialog box
Container
Button stack
Label
Field
Button
Toggle button
Separator
Slider
Option menu
Radio box
Menu
Menu bar
Library
Sub-menu
Button
Toggle button
Separator
Pop-up
menu
Toolbar
All default objects stored
in .gui library.
Dialog Boxes 289
TerminoIogy
DiuIog o und its chiIdren obgect terminoIogy-
Weve been saying dialog box a lot during this course. Lets look at the examples here to make sure were
using the same terminology.
Label
Field
Option
menu
Radio
button
Button
stack
Dialog box
Button
Separator
Slider
Toggle button
Container
290 Dialog Boxes
Working with DiuIog oes
Modifying eisting pre-buiIt diuIog boes
Modifying diuIog boes thut were uuto generuted using mucros
Creuting diuIog boes from scrutch using the DiuIog o uiIder
Dialog Boxes 291
Working with DiuIog oes,,,
Modifying eisting pre-buiIt diuIog boes
Modifying diuIog boes thut were uuto generuted using mucros
Creuting diuIog boes from scrutch using the DiuIog o uiIder
Pre-built dialog box is:
.gui.geometric_panel
New dialog box is:
.gui.geometric_panel (not recommended)
or
.my_cust.geometric_panel
custom
button
292 Dialog Boxes
Working with DiuIog oes
Modifying eisting pre-buiIt diuIog boes
Modifying diuIog boes thut were uuto generuted using mucros
Creuting diuIog boes from scrutch using the DiuIog o uiIder
Dialog Boxes 293
Working with DiuIog oes
Modifying eisting pre-buiIt diuIog boes
Modifying diuIog boes thut were uuto generuted using mucros
Creuting diuIog boes from scrutch using the DiuIog o uiIder
294 Dialog Boxes
DiuIog o uiIder Overview-
Accessing the DiuIog o uiIder-
OperutionuI modes for renuming reshuping und modifying
Open obgect in DiuIog o uiIder
diting open obgect
diting chiIdren obgects of open obgects
The Title is special. It indicates the open object.
The object shown in the attributes indicator area is not necessarily the same as (a) the open object, or (b)
the selected object. An instructor demo here is necessary.
Title
Attributes type
selector
Dimensioning
and positioning
toolbar
Attributes
indicator
Attributes
area
Dialog Boxes 295
DiuIog o uiIder Overview,,,
Accessing the DiuIog o uiIder
You can access the Dialog Box Builder in one of two ways:
s From the Tools menu, point to Dialog Box, and then select Create or Modify.
s Double-click on a dialog box.
x For security reasons, this method is disabled by default.
x You can enable this feature by either:
x Modifying or creating a dialog box for the first time
x Setting the environment variable MDI_AVIEW_CUSTOMIZE=enabled
OperutionuI modes for renuming reshuping und modifying
296 Dialog Boxes
DiuIog o uiIder Overview,,,
Accessing the DiuIog o uiIder
OperutionuI modes for renuming reshuping und modifying-
Open obgect in DiuIog o uiIder
s Name of open object is displayed in title.
s You can only modify characteristics (size, name, attribute) of the open object and/or a
direct child object. In other words, you cannot modify a grandchild directly.
s Limited to dialog boxes, containers, and windows.
s Open objects using Dialog Box Open menus.
diting open obgect
s Use the Dialog Box menu to rename, fit, or edit its attributes.
diting chiIdren obgects of open obgects-
s Double-click the object with the left mouse button (notice that the attributes indicator
changes).
OR
s Select the object you want to modify:
x Single-click on an object with the left mouse button, or
x From the Edit menu, point to Select, and then browse for the object in the
Database Navigator.
THEN
s Use the Edit menu to rename, resize, or edit its attributes.
Emphasize that this is tricky, and that you need their full attention.
Consider showing a tree structure to describe the editing children objects concept.
Dialog Boxes 297
DiuIog o Communds
Sturt
s Commands are executed when object is displayed.
s Useful in initializing settings and putting default values into fields when object is
displayed.
ecution
s Commands are executed by the dialog box when the user clicks OK or Apply.
Finish
s Commands are executed when object is not displayed.
s Allows you to clean up work when object is not displayed.
298 Dialog Boxes
DiuIog o Dutubuse Storuge
isting 9UI obgects
Mew 9UI obgects
s It is highly recommended that you place all new objects in a user-created library.
s Objects placed in the .gui library will not be upward compatible!
All dialog boxes are placed in
this library, by default.
Dialog Boxes 299
This workshop takes about one hour to complete.
ProbIem stutement
Create a dialog box that modifies the x and y coordinate locations of points 1, 2, and 4 of the
disk transfer linkage.
9etting sturted
To import the modeI:
1 Start ADAMS/View from the mod_14_dboxes_I directory.
2 Import the model, disk_start_2.cmd.
XII I
II
III
IV
V VI VII
X
XI
VIII
IX
Workshop 14-Working with DiuIog oes
300 Dialog Boxes
Creuting u Iibrury
We recommend that you store all of your customized objects (macros and dialog boxes) in a
user-created library at the top level in the database. This will allow you to more easily access
these objects for future use. Also, the database will be more organized regarding your
customization objects versus what is included in the standard ADAMS/View database.
To creute u Iibrury:
1 From the Command Navigator, select library, and then select create.
2 From the Library Create dialog box, create a library named .my_cust.
Be sure to include the period (.) in .my_cust when entering the name of the library. If you
omit it, the library is stored as .materials.my_cust in the database (by default).
If you want to verify that the library was created, search the database using the Database
Navigator. Be sure that the filter is set to All.
Creuting u mucro
Here you will create a macro that modifies the point locations, which are currently defined using
ADAMS/View variables.
To creute u mucro:
1 From the Tools menu, point to Macro, point to Edit, and then select New.
The Create/View Macro dialog box opens.
2 In the Macro Name text box, enter .my_cust.modify_locations.
3 Enter modify_locations in the Command text box using one of the following methods:
s Uncheck the Use Macro Name checkbox and enter modify_location directly in the
Command text box.
s Clear the Use Macro Name checkbox, and then select it again so that the read-only text
in the Command text box is indicative of what it will really use.
When Use Macro Name is toggled on, which is the default, the ADAMS/View
command will be the short (not absolute) name of the macro, which is
modify_locations.
Workshop 14-Working with DiuIog oes,,,
Dialog Boxes 301
4 Set Wrap in undo to Yes.
This means that a subsequent Undo will undo all commands in the macro, instead of just
the last one in the macro.
5 In the Commands area, enter the following:
s Parameters:
x Names: P1_X, P1_Y, P2_X, P2_Y, P4_X, P4_Y
x Type: real
x Defaults: Use constant default values based on the current values of these
coordinates, currently defined via ADAMS/View design variables.
x Count: 1
s ADAMS/View Commands used:
variable modify variable_name=DV_p1_x real_value=$p1_x
variable modify variable_name=DV_p1_y real_value=$p1_y
You might want to create the body of the macro in a text file using a text editor, and
then paste the information into the Create/View Macro dialog box when you're ready.
This may help you with debugging.
Tip: If you are having difficulties, see the macro commands in Macro for Workshop 14
on page 352.
6 Select OK.
If the students are short on time, have them copy the macro commands from misc/shortcuts.txt.
Workshop 14-Working with DiuIog oes,,,
302 Dialog Boxes
DispIuying uuto-generuted diuIog bo und test the mucro
Here you will display the dialog box generated by the macro you just created. You will then test
the macro.
To test the mucro:
1 From the Command Navigator, find the user-entered macro command called
modify_locations and double-click to display an auto-generated dialog box based on the
macro. It should look like this:
2 Test the macro through this dialog box by choosing different values for the point
coordinates.
3 Revert back to the original values by closing and then redisplaying dialog box, at which
time the predefined field values will be the original default values of the macro.
(Remember that during parameter declaration in the macro, the default values were
specified as constant, as opposed to updated.)
4 Select OK to revert back to the original values.
If the students get errors like:
ERROR: invalid input. Enter an object, qualifier, or action
The command was not executed
>>20.7
it means that theyve forgotten the ! character when declaring parameters at the top of the file.
Workshop 14-Working with DiuIog oes,,,
Dialog Boxes 303
Chunging the dutubuse Iocution of the diuIog bo
First, you will determine the database location of the dialog box, then you will change it to
.my_cust.modify_locations_dbox.
To determine the Iocution:
1 Display the Database Navigator.
2 Set Filter Type to Browse.
Hint: Scroll all the way down to the bottom of the pull-down list.
The Database Types dialog box appears.
3 Select Graphic_Interface_Dialog_Box.
4 Select OK.
The Database Navigator lists all applicable objects.
5 Find the dialog box you modified.
6 What is the name of this dialog box in the database? _____________________________
As you can see, ADAMS/View automatically placed it in a library called .gui and its name
is the name of the macro that generated it.
7 Did this exist prior to double-clicking on the user-entered command in the Command
navigator for the first time? ____ Yes ____ No
To chunge the nume und Iocution of the diuIog bo to
,my_cust,modify_Iocutions_dbo:
1 From the ADAMS/View Edit menu, select Rename.
2 Select the dialog box you want to rename.
3 Enter .my_cust.modify_locations_dbox.
4 Select OK.
Workshop 14-Working with DiuIog oes,,,
304 Dialog Boxes
Working with the DiuIog o uiIder
The ADAMS/View Dialog Box Builder is a very powerful tool that facilitates customizing the
interface.
To use the DiuIog o uiIder:
1 From the Tools menu, point to Dialog Box, and then select Modify.
The Database Navigator opens.
2 Select .my_cust.modify_locations_dbox.
Both the Modify Locations and Dialog Box Builder windows appear.
The modify_locations_dbox dialog box should look like this:
3 What is displayed in the title of the Dialog Box Builder window at this time?
________________________________________________________________
Workshop 14-Working with DiuIog oes,,,
Dialog Boxes 305
4 Look at the attributes indicator. What does it say?
____________________________________________________________________
5 What are the different attribute categories for the current selected object?
______________, ______________, ______________, ______________
Attributes
Indicator
Workshop 14-Working with DiuIog oes,,,
306 Dialog Boxes
Working with uttributes
To work with uttributes:
1 Display the layout attributes of the modify_locations dialog box. What are the following
values?
s Left = __________
s Top = __________
s Width = __________
s Height = __________
2 Move the Modify Locations dialog box to the upper right corner of your screen by
clicking and dragging on the title bar.
Watch the Left and Top parameter values change as you move the dialog box around on the
desktop.
3 Resize the Modify Locations dialog box so that there is not a lot of open space for the
fields.
At this time, the modify_locations dialog box should look like this:
Workshop 14-Working with DiuIog oes,,,
Dialog Boxes 307
4 Under the layout attribute, now what are the following values?
s Left = __________
s Top = __________
s Width = __________
s Height = __________
5 Display the appearance attributes of the modify_locations dialog box and change the
following parameter values:
s Title Text: Disk Transfer Linkage Locations
s Can Be Iconified: No
s Can Be Resized: No
s Has Decorations: Yes
Once the above parameters are entered, you must select Apply for the changes to take affect.
6 Test the dialog box appearance by, from the Options menu in the Dialog Box Builder,
selecting Test Box .
The dialog box should look like this:
7 Revert back to modifying the dialog box by clearing the selection of Test Box from the
Options menu.
8 Display the command attributes of the modify_locations dialog box.
9 Display the dialog box Start commands.
Workshop 14-Working with DiuIog oes,,,
308 Dialog Boxes
10 What is the first command in this group of commands?
_____________________________________________________________________
11 What does it do? _______________________________________________________
12 What are the full keyword names and parameter names?
_____________________________________________________________________
Tip: Use the Command Navigator for assistance with this.
13 If the macro that automatically created this dialog box had a default qualifier of updated
default (U=...) instead of constant default (D=...), would these start commands exist?
____ Yes ____ No
14 Would any Start commands exist? _____ Yes _____ No
15 Display the dialog box Execution commands.
16 In the command area, right-click and point to References.
17 What are the first six reference options?
__________, __________, __________, __________, __________, __________
18 Match the reference options with the value you think they represent. One has been done
for you.
Tip: You can verify this by adding these commands to your execution commands,
selecting Apply, choosing Test Box, and then selecting Apply again:
info empty
var set var = .my_cust.temp_var string=<reference to be tested>
list ent ent = .my_cust.temp_var
var del var = .my_cust.temp_var
Reference options:
1. $_value
2. $_self
3. $_parent
4. $_topgui
5. $f_pl_x
6. $f_pl_y
VuIue:
-68.4
.my_cust.modify_locations_dbox
53.7
Error -- does not apply in this case
.my_cust
.my_cust.modify_locations_dbox
Workshop 14-Working with DiuIog oes,,,
Dialog Boxes 309
19 Display the help attributes and change the following parameter value:
Tip Text: Modify key locations of the disk transfer mechanism
Again, once the parameters are entered, be sure that you select Apply on the Dialog Box
Builder.
20 Test the appearance of the dialog box by, from the Options menu, selecting Test Box.
Notice that the tip text appears in the status bar at the bottom of the main window.
21 Revert back to modifying the dialog box by clearing Test Box.
22 From the Dialog Box menu, point to Export, and then select Command File.
A command file with the name of the dialog box, modify_locations_dbox (with a .cmd
extension), is now saved in your current working directory.
23 Rename the modify_locations_dbox.cmd to modify_locations_dbox1.cmd in your current
working directory.
Viewing informution ubout IubeIs
Here you will view information about the label.
To determine the nume of the IubeI whose uppeurunce tet is P1 X:
1 Select the label by doing one of the following:
s Single-click on the object itself.
s Browse for the object using the Database Navigator (from the Dialog Box Builder Edit
menu, select Select).
Notice the label turns blue.
2 What is currently displayed in the title of the Dialog Box Builder window?
__________________________________________________________________
3 What is displayed in the attributes indicator area? _____________________________
4 From the Dialog Box Builder Edit menu, select Attributes.
Floating tip box will only appear if cursor is not on a dialog box object (that is, in the teal-colored back-
ground area).
You dont have to check and uncheck Test Box. It will update after you select Apply.
Workshop 14-Working with DiuIog oes,,,
310 Dialog Boxes
5 Now what is displayed in the attributes indicator area? _________________________.
Note: An object can be selected in the dialog box itself (that is, its color is blue), but not
necessarily be listed in the attributes indicator area of the Dialog Box Builder.
You must ensure that the object whose attributes you are modifying is indeed
shown in this area. Ask the instructor for clarification if needed.
If you double-click on an object, note that the object itself turns purple, has
reshaping handles around it, and is shown in the attributes indicator area of the
Dialog Box Builder.
6 What are the different attribute categories for the label object?
______________, ______________, ______________, ______________
7 What is the full database name of this label object? ______________________________
You can determine or confirm this using the Database Navigator.
Modifying IubeIs
Here you will delete and rename the labels as shown below:
Rename these
Delete
these
FOR
AFTR
Workshop 14-Working with DiuIog oes,,,
Dialog Boxes 311
To modify the IubeI:
1 Delete labels whose appearance text is P1 Y, P2 Y, and P4 Y.
From the Dialog Box Builder Edit menu, point to Select, and then select Delete. This ensures
that the label is the selected object.
2 Rename the label to l_p1.
To ensure that the label is the selected object, from the Edit menu, select Rename.
3 Modify the l_p1 labels layout attribute based on the following parameter values:
s Left = leave existing value
s Top = leave existing value
s Width = 50
s Height = 25
s Fit Width = no
s Fit Height = no
s Units = Pixel
Remember to select Apply when youre finished making your changes.
4 Modify the l_p1 labels appearance attribute based on the following attributes:
s Label Text = Point 1
s Icon File = <blank>
s Justified = Left
Remember to select Apply when youre finished making your changes.
Verify the l_p1 labels resizing attribute is Attach Top and Attach Left.
5 Repeat Steps 2 through 4 above for the label whose appearance text is P2 X, with the
following differences:
s Label Name = l_p2
s Label Text = Point 2
6 Repeat Steps 2 through 4 above for the label whose appearance text is P4 X, with the
following differences:
s Label Name = l_p4
s Label Text = Point 4
Workshop 14-Working with DiuIog oes,,,
312 Dialog Boxes
7 Create a label called x_label whose appearance text is X and whose label size (width and
height) is the same as the other labels on the dialog box.
s From the Dialog Box Builder Create menu, select Label.
s Click-and-drag the area on the modify_locations_dbox dialog box where you want to
add the label.
Do not worry about the placement (left and top) of this label at this time. Ensure that
the label text is centered in the width of the label.
s Modify the appropriate attributes.
8 Repeat Step 7, creating a label called y_label and use appearance text of Y.
The modify_locations_dbox dialog box should now look like the following, with the
exception of the placement of the X and Y labels:
Suving the diuIog bo
To suve the eisting diuIog bo:
1 From the Dialog Box menu, point to Export, and then select Command File.
A command file with the name of the dialog box, modify_locations_dbox (with a .cmd
extension), is now saved in your current working directory.
2 Rename the modify_locations_dbox.cmd to modify_locations_dbox2.cmd in your current
working directory.
Workshop 14-Working with DiuIog oes,,,
Dialog Boxes 313
Working with fieIds
Now that youve had time working with dialog box objects (selecting, editing attributes,
renaming, and so on), you should be able to answer the following questions:
1 What are the names of the six fields in the dialog box?
s _______________
s _______________
s _______________
s _______________
s _______________
s _______________
2 What are the six different attributes for the field object?
3 What are the different field attribute value types?
_____________, _____________, _____________, _____________
4 Sketch the database structure of this dialog box and its contents.
______ Width
______ Layout
______ Help
______ Commands
______ ICON_File
______ Height
______ Appearance
______ Value
______ Resizing
______ OFF
Workshop 14-Working with DiuIog oes,,,
314 Dialog Boxes
To chunge fieId sizes:
1 Using the Dialog Box Builder, and the procedures described earlier, modify the f_p1_x
field width to 50 pixels.
2 Modify all remaining field widths by doing the following:
s Select the fields by clicking and dragging from point A to point B (on the figure
shown below).
Notice that as the fields are selected, they turn blue.
s In the Dialog Box Builder, select the Align Width tool to set the remaining
widths to that of the first field.
In Test Box mode, the modify_locations_dbox dialog box should now look like the
following, with the exception of the placement of the X and Y labels:
A
B
Workshop 14-Working with DiuIog oes,,,
Dialog Boxes 315
Moving diuIog bo obgects
To move diuIog bo obgects:
1 Move the objects around in the dialog box so that it looks like the following:
Because you will not need to resize any of the objects, the only buttons you would need to
use on the Dialog Box Builder toolbar are the following:
To select multiple objects on the dialog box, simply click and drag your mouse across the
objects you want to include, starting from the background of the dialog box.
2 Save the existing dialog box:
Workshop 14-Working with DiuIog oes,,,
316 Dialog Boxes
porting u diuIog bo
To eport u diuIog bo:
1 From the Dialog Box menu, point to Export, and then select Command File.
A command file with the name of the dialog box, modify_locations_dbox (with a .cmd
extension), is now saved in your current working directory.
2 Rename the modify_locations_dbox.cmd to modify_locations_dbox3.cmd in your current
working directory.
ModuIe review
1 What are the top-level libraries that are supplied with the standard ADAMS/View
database (not including models)?
________________________________________________________________________
2 What is the difference between single-clicking and double-clicking on a dialog box object
when modifying a dialog box?
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
3 Would an auto-generated dialog box get updated if the macro that generated it was
modified with a new parameter?
________________________________________________________________________
________________________________________________________________________
4 Can you slam, or move, multiple objects in a dialog box by using the move icons on the
Dialog Box Builder?
________________________________________________________________________
________________________________________________________________________
Workshop 14-Working with DiuIog oes,,,
317
JS
DIALO9 OX UILDR
Create a custom interface that modifies the x and y coordinate locations of points
1, 2, and 4 of the disk transfer linkage, simulates the new design, and allows easy
review of results.
Whut's in this moduIe:
s Substituting Text into Commands, 318
s Working with Dialog Box Objects, 320
s Saving Dialog Boxes, 326
s Workshop 15Working with the Dialog Box
Builder, 327
318 Dialog Box Builder
Substituting Tet into Communds
Holding down the right mouse button over the Commands area of the Dialog Box Builder
displays a pop-up menu with several options for editing the commands. When you select
References, you can display and insert the available $xxx references.
Identifier: Substitutes the:
$_value Current value of the object that contains the command.
$_self Full database name of the object executing the com-
mand.
$_parent Full database name of the objects immediate parent.
$_topgui Full database name of the parent dialog box.
$object_name Current value of the object being referenced.
Dialog Box Builder 319
Substituting Tet into Communds,,,
Obgects thut contuin vuIues
umpIe
The object: Has the value:
Field Contents of field.
Option_menu Value for current selection.
Radio_box Value for current selection.
Toggle button Specified on/off value.
Slider Integer slider value.
Identifier: Substitutes the following text:
$_value 20.7
$_self .my_cust.design_layout.cont_P2.field_y
$_parent .my_cust.design_layout.cont_P2
$_topgui .my_cust.design_layout
$field_x -66.2
.my_cust.design_layout.cont_p2.field_y
library dialog box container field
320 Dialog Box Builder
Working with DiuIog o Obgects
uttons
Rudio boes
SIiders
Contuiners
Option menu
Dialog Box Builder 321
Working with DiuIog o Obgects,,,
uttons
s Buttons do not contain values. They simply execute commands upon single- or
double-click.
Rudio boes
SIiders
Contuiners
Option menu
Button
Buttons
322 Dialog Box Builder
Working with DiuIog o Obgects,,,
uttons
Rudio boes
Set states or modes.
SIiders
Contuiners
Option Menu
Radio boxes
Text appearance
Values
Dialog Box Builder 323
Working with DiuIog o Obgects,,,
uttons
Rudio boes
SIiders
s Sets value of an object without having to type it in.
s Currently limited to integer values.
Contuiners
Option menu
As you move the slider to
the right, notice that the
value changes.
324 Dialog Box Builder
Working with DiuIog o Obgects,,,
uttons
Rudio boes
SIiders
Contuiners
s Sub-region inside dialog box, window, or toolbar.
s Can hold other objects.
Option menu
Container for the
Link tool
Container for
Design Study
Dialog Box Builder 325
Working with DiuIog o Obgects,,,
uttons
Rudio boes
SIiders
Contuiners
Option menu
s Allows one of many selections
s Contains a push graphic that displays the entire list, like a menu.
s Displays only one column of options.
When you pull down the arrow
here...
you get the menu of available
selections here.
326 Dialog Box Builder
Suving DiuIog oes
s On the Dialog Box menu, point to Export, and then select Command File.
x The dialog box is saved in the current working directory.
x The file name will be the dialog box name.
x You probably want to rename the file so that subsequent saves do not
overwrite the file.
s You can also save your dialog box by saving your modeling database as a binary file.
All of your changes are saved if you save a binary file.
Dialog Box Builder 327
This workshop takes about one hour to complete.
ProbIem stutement
Create a custom interface that modifies the x and y coordinate locations of points 1, 2, and 4 of
the disk transfer linkage, simulates the new design, and allows easy review of results.
9etting sturted
To import the modeI:
1 Start ADAMS/View from the mod_15_dboxes_II directory.
2 Import the model, disk_start_3.cmd.
Remind them to look at the tips found throught the workshop documentation. It may save them some time.
As an example, show them the tip on page 331.
XII I
II
III
IV
V VI VII
X
XI
VIII
IX
Workshop 1-Working with the DiuIog o uiIder
328 Dialog Box Builder
Creuting u Iibrury
Here, you will create a library as a database storage area for easy access to all of your
customization objects.
To creute u Iibrury:
1 Display the Command Navigator.
2 Select library, and then select create to open the Library Create dialog box.
3 Create a library called .my_cust
Creuting the design Iuyout diuIog bo
You must first create a baseline dialog box that modifies the design layout of the disk transfer
mechanism. Once created, you will work on the objects that will be placed on them.
To creute the design Iuyout diuIog bo:
1 From the Tools menu, point to Dialog Box, and then select Create.
This opens the Dialog Box Builder.
2 Create a dialog box called .my_cust.design_layout:
s From the Dialog Box menu, select New to display the New Dialog Box dialog box.
s In the Library text box enter my_cust.
Note: Do not include the period (.) in the Library text box. This dialog box assumes that
all libraries created will be at the root level. Including the period will put the
dialog box in the .gui directory (currently a known issue with ADAMS/View).
s In the Name text box enter design_layout.
s Select Close.
s Select OK.
3 Modify the .my_cust.design_layout dialog box as follows:
s Attributes - Layout: 335 pixels (width) by 181 pixels (height)
Do not worry about placement at this time.
Workshop 1-Working with the DiuIog o uiIder,,,
Dialog Box Builder 329
Adding buttons
You are now going to add buttons so that selecting them will modify the x and y coordinates of
Point 1 of the disk transfer mechanism in increments of 2 millimeters. Here you will create a
button that subtracts 2mm from the existing x coordinate value of point 1, controlled through
the design variable DV_p1_x.
To udd buttons:
1 In the Dialog Box Builder, from the Create menu, select Button.
2 Click and drag the area on the design_layout dialog box where you would like to add the
label.
3 Use the following parameter values for the button:
s Name:
x .my_cust.button_x_neg
s Attributes - Layout:
x 25 pixels (width) by 25 pixels (length)
Do not worry about placement at this time.
s Attributes - Appearance:
x -
s Attributes - Commands:
x Enter the following to modify the design variable by subtracting 2 mm from its current
value:
variable modify &
variable_name=.model_1.DV_P1_X &
real_value=(eval(DV_P1_X-2))
Button you
will add
Workshop 1-Working with the DiuIog o uiIder,,,
330 Dialog Box Builder
Testing the button
Test the button to verify that clicking on it will indeed modify the current x coordinate of point
1 by -2 millimeters.
To test the button:
1 In the Dialog Box Builder, from the Options menu, select Test Box.
2 When done testing, revert back to modifying the dialog box by selecting Test Box again.
Creuting udditionuI buttons
Create additional buttons that will control the x and y locations of point 1 in increments of
positive and negative 2 mm, as well as one to reset to default values, as shown below.
To creute udditionuI buttons:
3 Use the following parameter values for these buttons:
s Names:
x .my_cust.button_x_pos
x .my_cust.button_y_neg
x .my_cust.button_y_pos
x .my_cust.button_reset
s Attributes - Layout:
x 25 pixels (width) by 25 pixels (length) for all
Do not worry about placement at this time.
Workshop 1-Working with the DiuIog o uiIder,,,
Dialog Box Builder 331
s Attributes - Appearance:
x + (for .my_cust.button_x_pos and .my_cust.button_y_pos)
x - (for .my_cust.button_y_neg)
x R (for .my_cust.button_reset)
s Attributes - Commands:
x variable modify variable_name= real_value=
Note: The following default values are used to reset the design variables:
Tip: You may want to use the copy and paste feature of the Dialog Box Builder to make
creating these other button objects easier. To do this, first select the button you want
to copy by single clicking on it. Next, in the Dialog Box Builder, from the Edit
menu, select Copy immediately followed by Paste for each additional button.
Use the dialog box toolbar icons to move the button into the clean, neat configuration as
shown in the figure on page page 330.
4 Test the button to verify that selecting on the buttons do indeed modify the x and y
coordinates of point 1 properly:
s In the Dialog Box Builder, from the Options menu, select Test Box.
s When done testing, revert back to modifying the dialog box by selecting Test Box
again.
.model_1.DV_P1_X -68.4
.model_1.DV_P1_Y 53.7
Workshop 1-Working with the DiuIog o uiIder,,,
332 Dialog Box Builder
Adding fieIds
In this section you will add fields that only display the x and y coordinates of point 1. Therefore,
as you are selecting the up and down buttons to move point 1 in increments of 2 mm, you can
immediately see what the coordinate values are in the same dialog box. These fields will,
therefore be non-editable.
To udd fieIds:
1 Add fields and labels using the following parameter values:
x Names:
x .my_cust.design_layout.field_x
x .my_cust.design_layout.field_y
Accept the default names for the 2 labels.
x Attributes - Layout:
x 75 pixels (width) by 25 pixels (length) for all
Do not worry about placement at this time.
x Attributes - Value:
x Field Type = Real
x Preload String = -68.4 for field_x and 53.7 for field_y
x Editable = No
2 Use the toolbar on the Dialog Box Builder to move the fields into the configuration
shown in the figure above.
Fields and
labels to
be added
Workshop 1-Working with the DiuIog o uiIder,,,
Dialog Box Builder 333
3 Add commands to the buttons so that they update the field values.
s Commands to be added to all buttons:
interface field set field_name=$_parent.field_x database=".model_1.DV_P1_X"
interface field set field_name=$_parent.field_y database=".model_1.DV_P1_Y"
4 Test the buttons to verify that they do indeed modify the x and y coordinates of point 1
and update the fields properly.
Adding u rudio bo und contuiner
In this section, you will add the capability to control both points 1 and point 2. You will use a
radio box to choose the point you want to control, at which time it will display the appropriate
container.
To udd u rudio bo:
1 In the Dialog Box Builder, from the Create menu, select Radio Box.
2 Click and drag the area on the design_layout dialog box where you would like to add the
radio box. (This should be roughly across the top of the dialog box.)
Workshop 1-Working with the DiuIog o uiIder,,,
334 Dialog Box Builder
3 Use the following parameter values for the radio box:
s Name: .my_cust.design_layout.radio_points
s Attributes - Layout: 30 pixel height
s Attributes - Value:
Point 1 | 1
Point 2 | 2
Every line entry means there will be another option to choose from on the radio box.
The text to the left of the pipe (the |) will be the text displayed next to the button, while
the value to the right is the value returned by the radio box for that selection while the
dialog box is in use.
4 Modify the appearance of the radio box so that it located at the top of the dialog box and
spans the entire width of the dialog box.
Select the radio box, and then select the following icons on the Dialog Box Builder toolbar
in the order indicated:
1
2
3
Workshop 1-Working with the DiuIog o uiIder,,,
Dialog Box Builder 335
To creute u contuiner:
1 From the Create menu, select Container.
2 Click and drag the area on the design_layouts dialog box where you would like to add the
container.
This should be in the middle of the dialog box, on top of all custom fields and buttons of
the dialog box, as shown below:
3 Use the following parameter values for this container:
s Name:
x .my_cust.design_layout.cont_p1
4 Modify the appearance of the container so that it spans the entire length and width of the
middle area of the dialog box.
Select the container, and then click on the last four icons on the Dialog Box Builder toolbar
to expand the container left, right, down, and up.
The dialog box should now look similar to the following:
Workshop 1-Working with the DiuIog o uiIder,,,
336 Dialog Box Builder
Moving buttons und fieIds onto the contuiner
In this section you will add the capability to control both points 1 and 2. You will move the
buttons and fields (except for the Close button) so that they belong to the container, instead of
being direct children objects of the dialog box.
The quickest way to do this is by cutting the objects onto the clipboard, and then pasting them
onto the container. To select the objects necessary for the cutting, you must first undisplay the
container that is currently on top of them.
To undispIuy the contuiner:
1 Select it in the design_layout dialog box.
2 In the Dialog Box Builder, from the Edit menu, select Undisplay.
Note that undisplaying a dialog box object does not delete or modify it. All it does is
undisplay it from the dialog box to which it belongs.
To copy und cut the buttons:
1 Select the buttons and fields you want to cut.
Do this by clicking and dragging on the dialog box to make a rectangular area that either
touch or surround all objects, as shown in the following:
Notice that all of the fields change colors to indicate that they are selected, except for
buttons (currently a known issue in ADAMS/View).
2 In the Dialog Box Builder, from the Edit menu, select Cut to place all objects onto the
ADAMS/View clipboard.
Click and drag
here
Workshop 1-Working with the DiuIog o uiIder,,,
Dialog Box Builder 337
3 Open the container called .my_cust.design_layout.cont_p1:
s From the Dialog Box menu, point to Open, and then select Container.
s Browse for the object in the Database Navigator.
Notice the container is now once again visible and also selected.
4 What is in the title of the Dialog Box Builder at this time? _________________________
5 What is in the attributes area of the Dialog Box Builder at this time? ________________
6 Ensuring that the container is open (based on the Dialog Box Builder title), from the Edit
menu, select Paste to paste the objects previously placed on the ADAMS/View clipboard
onto the container.
Notice that they are all placed onto the container and are still selected.
7 Move this selected group of objects into the center of the container by clicking and
dragging on one of the selected objects.
8 Can you move objects that belong to a container outside of the boundary of that
container? ______ Yes ______ No
The dialog box should look like the following:
Workshop 1-Working with the DiuIog o uiIder,,,
338 Dialog Box Builder
tending diuIog bo cupubiIity to controI point Z
In this section, you will copy the container and its buttons and fields that control point 1 so that
you can extend this capability to point 2.
To etend the diuIog bo to controI point Z:
1 Open the dialog box and select the container.
2 Copy and paste the container to create a duplicate one.
3 Name this container .my_cust.design_layout.cont_p2.
4 Slam the new container down against the Close button by clicking the down arrow on the
Dialog Box Builder toolbar.
The new container should have the same placement as the original one.
5 Modify the objects on the new container to control the x and y coordinate locations of
point 2 instead of point 1.
The default x and y values for point 2 are (-66.2, 20.7).
Tip: To work with objects that belong to a container, you must first open the container by
selecting the Dialog Box menu, point to Open, and then select Container.
Be sure to test this new functionality before moving on to the next section.
Workshop 1-Working with the DiuIog o uiIder,,,
Dialog Box Builder 339
Adding progrumming to the rudio bo
Here you will add programming to the radio box to display the appropriate container.
To udd progrumming:
1 Add the following commands to the radio box:
if cond=( $radio_points == 1 )
interface container undisplay container=$_parent.cont_p2
interface container display container=$_parent.cont_p1
elseif cond=( $radio_points == 2 )
interface container undisplay container=$_parent.cont_p1
interface container display container=$_parent.cont_p2
These commands simply ensure that the appropriate container is displayed based on the
current radio button choice.
Be sure to test this new functionality before moving on to the next step.
2 Save the existing dialog box:
s From the Dialog Box menu, point to Export, and then select Command File.
A command file with the name of the dialog box, design_layout (with a .cmd extension),
is now saved in your current working directory.
Workshop 1-Working with the DiuIog o uiIder,,,
340 Dialog Box Builder
Creuting u diuIog bo to simuIute the system
In this section, you will create a simple dialog box that simulates the system to 1 second with
50 output steps, with the choice of the model display updating at every output step, at simulation
end, or never.
To creute u diuIog bo to simuIute the system:
1 Create a dialog box called .my_cust.Simulate.
s The only buttons that should exist on this dialog box when initially created are Apply
and Close.
s The size of the dialog box should be 335 pixels (width) by 178 pixels (height).
s Do not worry about placement at this time.
2 Add the following objects to the dialog box:
You should now be comfortable working with general Dialog Box Builder functions, as
well as label, field, and button objects.
The options menu attributes value should be the following:
At Every Output Step | output_step
At Simulation End | end
Never | none
The dialog box execute commands should be the following:
simulation single_run set update= <option menu value>
simulation single scripted &
sim_script_name = .model_1.disk_script &
reset_before_and_after = yes
The option menu value is only executed when they click Apply. If they want the Model Display Update
to be modified immediately, they need to use commands. Show them the command that was used in
Workshop 1Introduction on page 17, or in the Settings dialog box.
Label
Label
Option
menu
Workshop 1-Working with the DiuIog o uiIder,,,
Dialog Box Builder 341
3 Save the existing dialog box by exporting the command file.
A command file with the name of the dialog box, Simulate (with a .cmd extension), is now
saved in your current working directory.
Creuting u diuIog bo to review the system
In this section, you will create a dialog box that allows others to review the results. The results
are presented in two ways:
s Animation with point-traces, allowing you to visually inspect the motion.
s Drop angle computed from the last design simulated.
To creute u diuIog bo to review the system:
1 Create a dialog box called .my_cust.review.
s The only button that should exist on this dialog box when initially created is the
Close button.
s The size of the dialog box should be 335 pixels (width) by 90 pixels (height).
s Do not worry about placement at this time.
2 Add the following objects to the dialog box:
The Animate button commands should be the following:
graphic_results animate &
point_trace_marker = .model_1.DISK_1.MARKER_lower, &
.model_1.DISK_1.MARKER_upper
The Actual Angle button commands should be the following:
variable set variable_name=.model_1.actual_angle &
real=(eval(MIN(.model_1.Last_Run.ANGLE_MEA_DROP_ERROR.Q)+desired_angle))
info empty
list entity entity=.model_1.actual_angle
3 Save the existing dialog box by exporting the command file.
A command file with the name of the dialog box, review (with a .cmd extension), is now
saved in your current working directory.
Button
Button
Workshop 1-Working with the DiuIog o uiIder,,,
342 Dialog Box Builder
ModuIe review
1 What are the valid parameters types that can be returned based on a selection in radio
boxes and options menus?
________________________________________________________________
2 What would the following return in the commands section of the Dialog Box Builder for
the customization work performed in this workshop?
Open: .my_cust.design_layout dialog box
Edit object: .my_cust.design_layout dialog box
$_value _______________________________
$_self _______________________________
$_parent _______________________________
$_topgui _______________________________
Open: .my_cust.design_layout.cont_p1 container
Edit object: .my_cust.design_layout.cont_p1.field_x
$_value _______________________________
$_self _______________________________
$_parent _______________________________
$_topgui _______________________________
Workshop 1-Working with the DiuIog o uiIder,,,
343
J6
WRAP-UP
Package the files that build the new interface so that they are organized and
upwardly compatible.
Whut's in this moduIe:
s Build Files, 344
s Workshop 16Wrap-up, 345
344 Wrap-up
uiId FiIes-
s Files that read in (or create) the various components of a customized interface are
typically called build files.
s It is highly recommended that you organize all types of GUI customization objects in
subdirectories for organization and easy access.
s Sample build file:
Tell the students that vertical applications use different naming conventions and build procedures. Refer
them to the guide, Customizing ADAMS/Car.
Wrap-up 345
This workshop takes about one hour to complete.
ProbIem stutement
Package the files that build the new interface so that they are organized and upwardly
compatible.
XII I
II
III
IV
V VI VII
X
XI
VIII
IX
Workshop 1-Wrup-up
346 Wrap-up
Orgunizing the fiIe system structure
In this section, you will organize your file system structure such that all files necessary to build
the custom interface are easily accessible.
To orgunize the fiIe system structure:
1 From the mod_16_disk directory, create the following directories:
s dboxes
s menus
s model
See the instructor if you need help with this.
2 Copy files from Workshop 15Working with the Dialog Box Builder on page 327 to the
new directory structure.
Ensure that the command files representing the three dialog boxes (design_layout,
Simulate, and review) are placed in the new dboxes directory, and that the command file
representing the model is placed in the new model directory.
3 Rename the model file from disk_start_3.cmd to disk_final.cmd.
For now, the menus directory will be empty.
Workshop 1-Wrup-up,,,
Wrap-up 347
Creuting u buiId fiIe
You will now create a build text file that essentially builds the custom interface and reads in the
model. Remember that the dialog boxes were stored and saved in a user-created library. If the
library does not exist, reading in the command files that build the dialog boxes will not work.
To creute u buiId fiIe:
1 Create a text file called build.cmd in the mod_16_disk directory that builds the
ADAMS/View interface to contain the model and the three dialog boxes.
!--- Read in the command file
file command read file=
!--- Create the library
library create library_name=
!--- Import the dialog boxes
file command read file=
2 Start ADAMS/View from the mod_16_disk directory.
3 Import the file called build.cmd from the mod_16_disk directory to build the custom
interface.
If errors are generated, debug the build command file until you no longer get errors when
reading this file into a fresh session of ADAMS/View.
4 Update the build command file so that it also displays the dialog boxes.
You should be able to do this on your own. If you need help with the command syntax,
display one of the dialog boxes. (From the Tools menu, point to Dialog Box, select Display,
and then review the command used behind the scenes by displaying the ADAMS/View
Command Window.)
5 Test the new build file from a fresh ADAMS/View session.
Workshop 1-Wrup-up,,,
348 Wrap-up
Creuting menus
In this section, you will create a command file that builds menus to easily display the custom
dialog boxes.
To creute menus:
1 Create a command file called disk_menus.cmd in the mod_16_disk/menus directory that
creates menus to display the dialog boxes.
!--- Create custom menus for the disk transfer mechanism
interface menu create &
menu_name = &
label =
interface push create &
push_button_name = &
label = &
command =(use the command to display a dialog box)
2 Update the build command file so that it reads in this command file that will build menus.
Because you will now have custom menus that will display these dialog boxes, you can
comment out or delete the commands that display the custom dialog boxes.
3 Test the new build file from a fresh ADAMS/View session.
Workshop 1-Wrup-up,,,
Wrap-up 349
Swupping u diuIog bo
In this section, you will learn how to swap one dialog box for another one using a build
command file.
To swup u diuIog bo:
1 Copy the design_layout dialog box command file that was used in Workshop 1
Introduction (module_01_intro/dboxes/design_layout_dbox.cmd) to the module_16_disk/
dboxes directory.
2 Rename this file to design_layout_advanced.cmd.
This dialog box is slightly more advanced because it allows the user to also control point
4, instead of just points 1 and 2.
3 Update the build file so that it replaces the existing design_layout dialog box with the new
one.
You have now learned how to put together a custom interface containing models, dialog boxes,
menus, libraries, and potentially macros into a clean and organized structure. This method will
also ensure that your customization work is upwardly compatible with future versions of
ADAMS/View.
Workshop 1-Wrup-up,,,
350 Wrap-up
ModuIe review
1 If dialog boxes were created in the .gui library and the session was saved in binary file
format in ADAMS/View version 10.1, would they exist in version 11.0?
____________________________________________________________________
What if they were created in a user-created library?
____________________________________________________________________
2 If your custom interface included a macro stored in a subdirectory called macros, what
build file command(s) would you use to read in the macro?
____________________________________________________________________
____________________________________________________________________
Workshop 1-Wrup-up,,,
351
A
MACRO
This appendix contains the sample macro that is provided with this training
course.
Whut's in this uppendi:
s Macro for Workshop 14, 352
352 Macro
Mucro for Workshop 14
Mucro for Step 2 on puge 300
! This macro modifies the x and y locations of Points 1, 2, and 4 in the disk transfer
mechanism.
!$P1_X: t=real: D=-68.4: C=1
!$P1_Y: t=real: D=53.7: C=1
!$P2_X: t=real: D=-66.2: C=1
!$P2_Y: t=real: D=20.7: C=1
!$P4_X: t=real: D=-47.9: C=1
!$P4_Y: t=real: D=9.3: C=1
variable modify variable_name=.model_1.DV_P1_X real_value=$P1_X
variable modify variable_name=.model_1.DV_P1_Y real_value=$P1_Y
variable modify variable_name=.model_1.DV_P2_X real_value=$P2_X
variable modify variable_name=.model_1.DV_P2_Y real_value=$P2_Y
variable modify variable_name=.model_1.DV_P4_X real_value=$P4_X
variable modify variable_name=.model_1.DV_P4_Y real_value=$P4_Y
353
B
AMSWR KY
Whut's in this uppendi:
s Answer Key for Workshop 1, 354
s Answer Key for Workshop 2, 355
s Answer Key for Workshop 3, 356
s Answer Key for Workshop 4, 357
s Answer Key for Workshop 5, 358
s Answer Key for Workshop 6, 359
s Answer Key for Workshop 7, 360
s Answer Key for Workshop 8, 361
s Answer Key for Workshop 9, 362
s Answer Key for Workshop 10, 363
s Answer Key for Workshop 11, 364
s Answer Key for Workshop 13, 365
s Answer Key for Workshop 14, 366
s Answer Key for Workshop 15, 368
s Answer Key for Workshop 16, 369
354 Answer Key
Answer Key for Workshop 1
Step 2, page 21: 6.797
Step 2, page 21: No
Step 2, page 22: DV_p4_x (+2.99%)
Step 3, page 22: DV_p2_y (+0.293%)
Step 4, page 22:
Step 7, page 22: Yes
Step 3, page 23:
X Y
Point 1 -66.6071 53.0906
Point 2 -65.213 20.7607
Point 4 -49.3324 9.25845
-1 mm (degrees)
Nominal
(degrees)
+1 mm
(degrees)
DV_p4_x -3.034 0 2.8393
DV_p2_y .95208 0 -1.0869
Answer Key 355
Answer Key for Workshop Z
Quiz:, page 38:1=Integer, 2=Object, 3=String, 4=String, 5=Real, 6=Object, 7=Matrix (Array of
reals)
Step 1, page 47: .express_test.steel - database object
Step 2, page 47: This variable is only referenced by the left wing, not the right; data type is
character string.
Step 3, page 47: .express_test.rt_pillar.MARKER_22 - database object
Step 4, page 47: 300.0, -100.0, 203.0 - array of real numbers
Step 5, page 47: 6.83 - real value
Step 6, page 47: jt_rt_pillar - character string
Step 7, page 47: 7-integer number
356 Answer Key
Answer Key for Workshop 3
Step 2, page 59: .cyl_mod.PART.MARKER_1
Step 1, page 67: By default the center of mass (CM) location for a part is derived from the
geometry and material type. A change in cylinder length automatically results in ADAMS/View
updating the CM location. Therefore, parameterizing the CM location yourself would be in
conflict with what ADAMS/View is trying to do. If you want to parameterize a CM location you
must define the mass and inertia using User Input instead.
Step 2, page 67: No, it cannot. You can only use design-time functions to define the model
configuration. The only geometry types that change shape during run-time are outline, spring-
damper, and force graphics.
Step 3, page 67: Yes, the cylinder length can be dependent on the design-time STEP function.
This would allow you to control the length based on conditional logic. This might be something
youd want to do in a design study, DOE, or optimization. If you have internet access, see KB
Article 8464 for an example.
Answer Key 357
Answer Key for Workshop 4
Step 2, page 77:
Step 1, page 78: .sla.tierod.tierod_geo_base
Step 5, page 79: (LOC_RELATIVE_TO({0,0,0},.sla.ground.pnt7_ref))
Step 3, page 79: (ORI_ALONG_AXIS(.sla.ground.pnt7_ref, .sla.ground.pnt8_ref, z))
Step 5, page 79: No
Step 3, page 80: Yes
Step 3, page 82: 3
Step 5, page 84: No
Step 6, page 84: The center_marker location parametrics were incorrectly defined for the short
cylinders. This occurred during the attach-near operation in Step 1 on page 81. You need to
locate the center_marker along the line-of-sight from pnt3_ref to pnt4_ref.
Step 3, page 87: The markers for the spherical joint were parameterized to the design point.
Step 4, page 87: No
Step 5, page 87: A warning message would be issued saying that you were breaking a
parametric relationship.
pnt5_ref
pnt7_ref
pnt2_ref
pnt1_ref
pnt4_ref
pnt3_ref
pnt11_ref
pnt10_ref
pnt6_ref
pnt9_ref
pnt8_ref
UCA
LCA
TIEROD
SPINDLE
GROUND
358 Answer Key
Answer Key for Workshop
Step 4, page 102: Yes
Step 3, page 103: No
Step 3, page 104: No
Answer Key 359
Answer Key for Workshop
Step 3, page 126: 4
Step 4, page 126: 3
Step 5, page 126: No
Step 4, page 128: Yes
Step 6, page 129: Trial 1 and perhaps trial 2
Step 7, page 130: -25
Step 4, page 130: Yes
Step 5, page 130: Yes, the range of A1 seems well-bounded when all other variables are held
fixed. However, its possible that using other combinations of design variables may result in
unexpected motion or unforeseen linkage configurations.
Step 6, page 130: Trials 1,2
Step 1, page 131: New analyses will be created: Run_006 through Run_010 and
Multi_Run_002.
Step 2, page 131: Yes. Analyses can be deleted using the Delete Simulation Results tool or by
selecting the Tools menu, pointing to Command Navigator, pointing Analysis, and then
selecting Delete.
Step 3, page 131: Yes
Step 4, page 132: Yes, the list of values was used. Yes, it ignored the list of values.
Step 5, page 132: No, you cannot study more than one measure at a time. Yes, you can study
more than one objective at a time.
360 Answer Key
Answer Key for Workshop 7
Step 8, page 141: No, it hops in place.
Step 2, page 143: pt4_z, w1
Step 5, page 143: Trial #5, value=150
Step 3, page 144: Straight line, 45
o
left of path to zone.
Step 5, page 145: 15
Step 6, page 145: 0.333, 0.272
Step 6, page 146: 5
Step 7, page 146: 100.0, -316.51
Step 12, page 147: Right-hooking arc towards zone.
Step 13, page 147: Nearly, if not completely.
Step 14, page 147: Yes
Answer Key 361
Answer Key for Workshop
Step 8, page 162: A and B, because theyre greater than zero.
Step 6, page 164: $11.86, 55 - 6.4E-2 = 54.94
o
Step 7, page 164: No. 65 calls.
Step 9, page 164: Variable L1 was driven to its lower limit.
Step 4, page 165: Yes
Step 5, page 165: $11.60
Step 5, page 166: $11.29, 55 - 4.3E-3 = 54.996 55
o
Step 6, page 166: Yes, cost savings were gained by loosening the tolerance on hood angle.
362 Answer Key
Answer Key for Workshop 9
Step 4, page 175: model verify
Step 6, page 175: Yes
Step 5, page 176: info empty
Step 10, page 181: No
Step 11, page 181: Write the command file more generically so that its not model-name
dependent.
Step 3, page 183: Link, Cylinder, Extrusion, Ellipsoid
Step 6, page 184: CsgSolid (and/or plate)
Step 4, page 184: Yes
Step 3, page 185: Yes
Step 3, page 186: Yes
Answer Key 363
Answer Key for Workshop 10
Step 5, page 197: Yes
Step 7, page 197: No
Step 8, page 197: The commands are being executed properly, but the screen isnt being
updated.
Step 3, page 200: Yes
Step 3, page 201: Yes
Step 5, page 203: Yes
Step 6, page 203: Yes
Step 3, page 206: 0
364 Answer Key
Answer Key for Workshop 11
Step 4, page 228: All of the above.
Step 3, page 228: No, probably not.
Step 5, page 228: Yes
Step 6, page 229: Yes. Recording the new one didnt overwrite the one you renamed to
.my_zoomed_view. You may have more than one macro in the database at a time; each must
have a unique name.
Step 7, page 229: F, T, T
Step 2, page 230: C (.MACRO_1)
Answer Key 365
Answer Key for Workshop 13
Step 3, page 273: No
Quiz:, page 274: 1-Reload, 2-Export, 3-Import, 4-Apply, 5-Exits, 6-Load.
Step 2, page 275: variable sweep
Step 5, page 276: Choice #3
Step 5, page 278: F, T, F, T, T
Step 8, page 281: interface menubar read menubar=.my_cust.arc_toolkit.mbar
file="arc_toolkit.mnu
Step 7, page 283: Yes
366 Answer Key
Answer Key for Workshop 14
Step 6, page 303: .gui.modify_locations
Step 7, page 303: No
Step 3, page 304: Dialog-Box Builder: Modifying modify_locations_dbox
Step 4, page 305: Dialog Box modify_locations_dbox
Step 5, page 305: Layout, Appearance, Commands, Help
Step 1, page 306: Left=738, Top=22, Width=404, Height=203
Step 4, page 307: Left=1093, Top=50, Width=275, Height=203
Step 10, page 308: int fie set fie=$_self.f_p1_x str=-68.4
Step 11, page 308: It always sets the field values to the constant default value of 68.4. This is
the value specified for the p1_x parameter in the macro that auto generated the dialog box.
Step 12, page 308: interface field set Field_name= Strings= Action= Execute=
Step 13, page 308: No
Step 14, page 308: No
Step 17, page 308: $_value, $_self, $_parent, $_topgui, $f_pl_x, $f_pl_y
Step 18, page 308: $_value=error, $_self=.my_cust.modify_locations_dbox,
$_parent=.my_cust, $_topgui=.my_cust.modify_locations_dbox, $f_pl_x=-68.4, $f_pl_y=53.7
Step 2, page 309: Dialog-Box Builder: Modifying modify_location_dbox
Step 3, page 309: Dialog Box modify_locations_dbox
Step 5, page 310: Label l_p1_x
Step 6, page 310: Layout, Appearance, Resizing, Help
Step 7, page 310: .my_cust.modify_locations_dbox.l_p1_x
Step 1, page 313: f_p1_x, f_p1_y, f_p2_x, f_p2_y, f_p4_x, f_p4_y
Step 2, page 313: Layout, Appearance, Resizing, Value, Commands, Help
Step 3, page 313: String, Object, Numeric, File
Answer Key 367
Answer Key for Workshop 14,,,
Step 4, page 313:
Step 1, page 316: .gui, .colors, .icons, .MDI, .materials, .plot_1
Step 2, page 316: Single-clicking simply selects an object. To rename it, reshape it, or change
its attributes, you would have to click Edit => Rename/Reshape/Attributes in the Dialog Box
Builder. Double-clicking not only selects the object, but also puts it directly in the mode where
you can reshape the object or change its attributes without clicking the Edit menu.
Step 3, page 316: No. Every time a macro was modified that would change the appearance of
the auto generated macro, the dialog box needs to be deleted and recreated by clicking on the
user-entered command in the Command Navigator.
Step 4, page 316: Yes
.my_cust
.modify_locations_dbox
l_p1
l_p2
l_p4
f_p4_x
f_p4_y
f_pl_x
f_pl_y
f_p2_x
f_p2_y
x_label
y_label
OK
Apply
Cancel
368 Answer Key
Answer Key for Workshop 1
Step 4, page 337: Dialog-Box Builder: Modifying cont_p1
Step 5, page 337: Container cont_p1
Step 8, page 337: No
Step 1, page 342: real, integer, string
Step 2, page 342: First scenario: $_value=none, $_self=.my_cust.design_layout,
$_parent=.my_cust, $_topgui=.my_cust.design_layout. Second scenario: $_value=-68.4 (by
default, but will vary), $_self=.my_cust.design_layout.cont_p1.field_x,
$_parent=.my_cust.design_layout.cont_p1, $_topgui=.my_cust.design_layout
Answer Key 369
Answer Key for Workshop 1
Step 1, page 350: No; yes.
Step 2, page 350: Macro read macro_name= file_name= user_entered_command=
370 Answer Key
Motes