Sie sind auf Seite 1von 20

Chapter 2: The HyperWorks

Innovation
Desktop Environment
Intelligence®

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

HyperWorks Desktop Environment - Overview

•  Framework Overview

•  Command Layer

•  Sample Session

•  Object Hierarchy

•  Documentation

•  Command Window

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

HyperWorks Desktop Environment - Framework Overview

HyperWorks Desktop framework contains:


•  HyperView
•  MotionView
•  HyperGraph
•  HyperGraph 3D
•  TextView
•  MediaView
•  FE Model

Other HyperWorks applications that can be accessed through the


HyperWorks Desktop:
•  HyperMesh
•  Manufactoring Solutions
•  Data Manager
•  ProcessManager
•  HyperStudy
•  OptiStruct

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

HyperWorks Desktop Environment - Framework Overview

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

HyperWorks Desktop Environment - Framework Overview

•  Tcl/Tk is the scripting language used to customize the HyperWorks


Desktop Environment.

•  Upon launching, the Tcl/Tk interpreter is automatically initialized and a set


of commands are created to form the command layer inside the
framework.

•  Every client in the HyperWorks Desktop framework has a command


associated with it. Each of these commands is created when the
respective client is loaded.

•  “post” à Animation client


•  “hwplot” à HyperGraph 2D client
•  “plot3d” à HyperGraph 3D client
•  “texteditor”à TextView client
•  “video” à MediaView client
•  “model” à MotionView client

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

HyperWorks Desktop Environment - Framework Overview

•  What is a macro?
•  Tool, utility, or a set of functions that perform a particular action – or a set of
actions

•  Tcl scripts that are created using Tcl must have a name with “.tcl”
extension.

•  To activate a particular Macro, the user must use the source command.
•  For example, a Macro named my_macro.tcl, use the following command:

source my_macro.tcl

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

HyperWorks Desktop Environment – Command Layer

•  The Command Layer is formed from native Tcl/Tk commands and a set
of HyperWorks Desktop specific commands
•  Accessible and available to all clients available inside the HyperWorks
Desktop framework.
•  Follow a simple and consistent syntax.

•  The command layer can basically be broken into two main levels
•  common level
•  client specific level

•  The same commands are used to get to the client level and after that, a
separate set commands exist for each client.

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

HyperWorks Desktop Environment – Command Layer

•  All commands are object-centric, meaning that you must have an object
to which a command can be applied.

•  The basic command syntax is:


{object_name} {command} {command parameter(s)}

•  These commands fall into four categories


•  Handle Commands
•  Operation Commands
•  Property Commands
•  List Commands

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

HyperWorks Desktop Environment – Command Layer

•  The HyperWorks database consists of a hierarchy of objects

•  The foundation is the hwi (HyperWorks Interface) object


•  Automatically created.
•  The hwi command provides access to the hwISession object and a few high
level utilities.

•  HyperWorks supports only one session per run and one project per
session.

•  The session object can be retrieved by using the following command

hwi GetSessionHandle session1

•  NOTE: session1 is the handle name which is an arbitrary name chosen


by the user

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

HyperWorks Desktop Environment – Sample Session

Sample session with 2 pages:

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

HyperWorks Desktop Environment – Sample Session


•  Example: Get to “Page 2” and set its title to “My page”
session1 GetProjectHandle project1
project1 GetPageHandle page2 2
page2 SetTitle “My page”

•  Client type is assigned to a window


•  A window's client type cannot be changed after the client handle has been
retrieved.
•  The client handle must be released and retrieved again if the window's client
type is changed.

•  Example: Get to window 1 in page 1 and set the client type to animation
project1 GetPageHandle page1 1
page1 GetWindowHandle win1 1
win1 SetClientType "Animation"

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

HyperWorks Desktop Environment – Object Hierarchy

The first level is common to all clients and applies at the framework level

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

HyperWorks Desktop Environment – Object Hierarchy

•  The second level is unique to each client inside HyperWorks Desktop.

•  Commands may have the same syntax, it doesn’t mean that they are
common to other clients.

•  Efforts have been made to keep consistency for similar command


•  keep things simple
•  easier to learn

•  An example:
•  SetColor or SetLabel command
•  Find them available in more than one object and in different clients.

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

HyperWorks Desktop Environment – Object Hierarchy

•  Animation Client
Object Hierarchy

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

HyperWorks Desktop Environment – Object Hierarchy

•  Plot 2D Client
Object Hierarchy

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

HyperWorks Desktop Environment – Documentation

•  Documentation in
Online Help

•  Programming with Tcl/


Tk Commands

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

HyperWorks Desktop Environment – Command Window

•  To access Tcl/Tk and the command layer inside HyperWorks Desktop,


launch the Command Window

•  Click on Views menu item and then choose Command Window

•  Provides an interactive environment and it also allows users to load and


save file TCL files, also known and scripts, as well as saving a history of
recent commands or scripts.

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

HyperWorks Desktop Environment – Command Window

Working with Command Window:


•  To load a script (TCL file), use Fileà Load File menu item, or you
can simply type “source filename.tcl” in the console.
•  When typing a handle, you can use the tab key for auto-complete
feature.
•  Text highlighting is supported. All global commands are highlighted
in green and error code is highlighted in red.
•  You can click on an error (red text) to launch a new window
displaying the stack trace; this is very useful feature for debugging
purposes.
•  Use the Up/Down arrow keys to go through commands in the history
•  All menu items are accessible via pop up menu using the right
mouse button
•  Copy and paste is supported via menu items, but also available by
highlighting any text and then using the middle mouse button to
paste (similar to UNIX functionality)
•  Use clear command to clear all text form the console

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

Exercise 2.1

Changing the Client Type using the Command Window

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

HyperWorks Desktop Environment – Exercise

Exercise 2a

Description:

Start HyperWorks Desktop and launch the command window. By typing


commands inside the console, set the page title to “my first page”.
Change the client type to Plot 2D. Save a history file and then load the
history file to re-run the same commands.

Handles used

session, project, page, window

TCL/TK commands used

set

Hints

No hints are necessary.

20

Das könnte Ihnen auch gefallen