Innovation Intelligence ® 1 Chapter 4: The Animation Client.

23
Innovation Intelligence ® 1 Chapter 4: The Animation Client

description

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved. 33 The Animation Client – Animation Window In any window, you can set the client type to Animation This creates the post object Sometimes both terms, Post and Animation, are used interchangeably It’s important to understand that Animation is just a client type while post is an actual TCL command created inside the Animation client Example: hwi OpenStack hwi GetSessionHandle session1 session1 GetProjectHandle project1 project1 GetPageHandle page1 1 page1 GetWindowHandle win1 1 win1 SetClientType Animation hwi CloseStack

Transcript of Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Page 1: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Innovation Intelligence®

1

Chapter 4: The Animation Client

Page 2: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

22

The Animation Client – Overview

• Animation Window

• Animation Client Handle

• Loading a Model

• Attaching Results

• Model Object

• Result Control

• Query Control

• Selection Sets

• Groups

Page 3: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

33

The Animation Client – Animation Window

• In any window, you can set the client type to Animation

• This creates the post object

• Sometimes both terms, Post and Animation, are used interchangeably

• It’s important to understand that Animation is just a client type while post is an actual TCL command created inside the Animation client

Example:hwi OpenStack

hwi GetSessionHandle session1session1 GetProjectHandle project1project1 GetPageHandle page1 1page1 GetWindowHandle win1 1win1 SetClientType Animation

hwi CloseStack

Page 4: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

44

The Animation Client – Animation Client Handle

• After setting the client type, you can access the animation client and get full access to its functionality using the GetClientHandle command

page1 GetWindowHandle win1 1win1 GetClientHandle anim

• Object Hierarchy for poIPost (or animation client)• The prefix “poI” is used internally for naming the classes within the animation

client. • It stands for “post Interface”.

Page 5: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

55

The Animation Client – Loading a Model

• Remember when working with the client handle, you always have to add an object first using the appropriate Add command

• (i.e. AddModel, AddMeasure, AddNote and AddSectionCut).

• The Add command returns an ID that you should use to get the proper handle

• Load a model with the AddModel command

page1 GetWindowHandle win1 1win1 GetClientHandle animanim AddModel bumper.h3d

Page 6: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

66

The Animation Client – Loading a Model

• Overlaying multiple models in the same window• Default behavior for AddModel command• Example overlaying 2 models bumper.h3d and bumper_foam.h3d

anim AddModel bumper.h3danim AddModel bumper_foam.h3danim Draw

• if you have a model loaded in the window and you need to load a new model (not overlay), then you can use the Clear command.

anim Clearanim AddModel bumper_foam.h3danim Draw

• “anim Draw” is needed to update the graphics

Page 7: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

77

The Animation Client – Attaching Results

• To attach results to the loaded model, you first need to get a model handle using the GetModelHandle command available in the post object.

• The GetModelHandle requires two arguments • handle name – can be any arbitrary name• model id – needs to be a valid id

• We can get a valid id form the AddModel command, which returns a model id.

set id [anim AddModel bumper.h3d]anim GetModelHandle my_model $id

Page 8: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

88

The Animation Client – Attaching Results

• Now that there is a valid model handle (my_model), results can be attached using the SetResult command.

my_model SetResult bumper.h3d

• At this point, we have a model and its results loaded. We can animate and/or view results such as contour, tensor, and vector plots.

Page 9: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

99

Exercise 4.1

Loading a Model and Result File

Page 10: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

1010

The Animation Client – Attaching Results

• Therefore, to load a model and attach results, here’s a set of commands that are needed:

hwi OpenStackhwi GetSessionHandle session1session1 GetProjectHandle project1project1 GetPageHandle page1 1page1 GetWindowHandle win1 1win1 GetClientHandle animanim Clearset id [anim AddModel bumper.h3d]anim GetModelHandle my_model $idmy_model SetResult bumper.h3danim Draw

hwi CloseStack

Page 11: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

1111

The Animation Client – Model Object• The Model Object allows access to:

• Result Control (provides access to Contour, Tensor, Vector, etc)• Query Control• Selection Sets

Page 12: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

1212

The Animation Client – Model Handle• When working within the HyperView GUI, there is only one active model

within a session at any given time.

• However, when working with the command layer, you can work with any model that’s loaded in the session.

• You are not restricted to the active model only – as long as you get the proper model handle.

Page 13: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

1313

The Animation Client – Result Control• Need to get result handle to gain access to the loaded results.

• The result control handle allows you to query information such as:• load cases• simulation steps• data types

• It also allows you to apply results such contour, tensor and vector plots and other features.

• Example: Get a list of data types for the current load case (also referred to as subcase).

anim GetModelHandle my_model [anim GetActiveModel]my_model GetResultCtrlHandle my_resultset current [my_result GetCurrentSubcase]set data_types [my_result GetDataTypeList $current]

Page 14: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

1414

The Animation Client – Query Control• The query control allows you to query or get information for all entity

types in the model. Aside form basic information you can also query results, such as stress values, displacements, etc…

• First need to get a query control handle and then perform the desired query.

• When working with the query control you have to remember the following:• Choose the entity type (i.e. node, element, component or system)• Specify the request (i.e. “node.id”, “contour.value” etc…)• Specify a set of entities that you need information for (i.e. all nodes, or IDs

100-200, or all entities above/below a certain contour value, etc…)• Output the data to a file or any other channel

Page 15: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

1515

The Animation Client – Query Control• Example: Assume that we have bumper.h3d loaded and a model handle

named my_model. We will get the coordinates for a set of nodes ranging from 1 to 100; we will output the data to a file named “out.txt”.

my_model GetQueryCtrlHandle my_query# create a node set and add ids 1-100set set_id [my_model AddSelectionSet node]my_model GetSelectionSetHandle node_set $set_idnode_set Add "id <= 100"my_query SetSelectionSet $set_id# ask for ids and coordinates my_query SetQuery "node.id node.coords"my_query WriteData out.txt# clean upmy_model RemoveSelectionSet $set_id

Page 16: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

1616

The Animation Client – Selection Sets• A Selection Set defined as a place-holder for entities that are supported

inside HyperView;

• These entities are nodes, elements, parts/components and systems.

• Selection sets are used extensively and are needed by many objects/commands in the command layer.

• Almost all result related objects (contour, tensor, vector, fld, etc…) as well as other controls, such as the exploded view and query, require a selection set.

• There are a few basic rules to remember:• Create the needed set of the right type• Add/Remove entities and use it based on your needs• Remove it when it is not needed

• It is very important to remove the selection set after it is not needed.

Page 17: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

1717

The Animation Client – Selection Sets• AddSelectionSet command – requires valid entity type (node,

element, etc) and it returns a set ID• The set ID should be used to get a selection set handle

• The following example illustrates that selection set offers a lot of methods to help you build the needed set of entities to work with.

• In addition, you can reverse the selection and even add by contour value for example.

• The online help offers a comprehensive example showing all available methods.

Page 18: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

1818

The Animation Client – Selection Sets• Example: Assume that there is a valid model handle named my_model.

# create an element setset set_id [my_model AddSelectionSet element]my_model GetSelectionSetHandle elem_set

$set_id

• Add element ID (10 20 30 40 50 60 70 80 90 100)

set id_list { 10 20 30 40 50 60 70 80 90 100}foreach id $id_list {

elem_set Add "id $id"}

• Now let’s subtract all IDs below 50

elem_set Subtract "id < 50“

Page 19: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

1919

The Animation Client – Selection Sets• Example (continued): So now we are left with a selection set that has

the following IDs: 50 60 70 80 90 and 100.

• Let’s add all elements that are adjacent to the elements in the set.

elem_set Add adjacent

• And finally, let’s subtract any TRIAS that are selected.

elem_set Subtract "config 103"

Page 20: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

2020

The Animation Client – Groups• Selection sets can be used to create groups

• To create a group you need to:• Add a selection set• Set its label

• Example: Create a group of all elements that have a contour value above 1200. Assume that bumper.h3d loaded and a contour plot of stress:

set set_id [my_model AddSelectionSet element]my_model GetSelectionSetHandle elem_set $set_idelem_set Add "contour > 1200"elem_set SetLabel "Stress > 1200"elem_set SetIDVisibility trueelem_set SetVisibility trueelem_set SetColor yellow

• After creating this group, you can go to the Groups Panel and turn the display on/off or change other options.

Page 21: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

2121

Exercise 4.2

Working with the Model Object

Page 22: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

2222

The Animation Client - Exercise

Exercise 4a

Description:

Load two models (bezel.h3d and bezel_iter2.h3d) in two separate windows. Both of these files are located in C:/Altair/hw10.0/tutorials/mv_hv_hg/animation. First, capture the screen to a file name screen.jpg and then capture each window separately to two separate files, window1.jpg and window2.jpg

Handles used

session, project, page, window, client

TCL/TK commands used

AddModel, CaptureScreen, SetActiveWindow, CaptureActiveWindow

Hints

Use the session to capture screen and then set the active window to capture the individual windows.

Page 23: Innovation Intelligence ® 1 Chapter 4: The Animation Client.

Copyright © 2012 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

2323

The Animation Client - Exercise

Exercise 4b

Description:

Load bezel.h3d. Get the following information: number of nodes, elements and parts. Create a note displaying the information you have acquired.

Handles used

session, project, page, window, client, model, selection set, note

TCL/TK commands used

GetSize, AddNote, SetText

Hints

Use the GetSize command on the selection set handle to get the number of elements in the selection set.