+ All Categories
Home > Documents > Using the Femap API to Improve the Analysis Process · 2017-12-22 · Using the Femap API to...

Using the Femap API to Improve the Analysis Process · 2017-12-22 · Using the Femap API to...

Date post: 17-May-2019
Category:
Upload: buinhan
View: 238 times
Download: 2 times
Share this document with a friend
22
Unrestricted © Siemens AG 2015 Femap Symposium Series 2015 Femap Symposium Series 2015 February 24, San Diego, CA, USA Using the Femap API to Improve the Analysis Process Kurt Knutson / Manager of Software Services Femap Symposium 2015 [San Diego] Co-Hosted with [ATA Engineering]
Transcript

Unrestricted © Siemens AG 2015

Femap Symposium Series 2015 Femap Symposium Series 2015

February 24, San Diego, CA, USA

Using the Femap API to Improve the Analysis Process Kurt Knutson / Manager of Software Services

Femap Symposium 2015 [San Diego] – Co-Hosted with [ATA Engineering]

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

FEMAP API Can Benefit Users with

Simple to Advanced Needs

Benefits of the API Include:

• Automate repetitive tasks

• Augment or customize existing modeling and post-

processing functionality

• Program complexity can range from simple utilities up to

entire toolboxes to provide new capabilities

• Ability to interface with external software – Office tools

Presentation Outline:

• Introduction to the API – what is it?

• How to get started

• ATA examples

2

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

ATA Uses Femap’s API to Create New Tools

for General & Industry-Specific Workflows

Femap’s Application Program Interface (API) allows users to

customize and combine existing Femap tools for their specific needs

• The API is an OLE/COM-based programming interface to FEMAP with

hundreds of functions

• Codes calling these functions are written in programming languages

such as Visual Basic, C++, or even Python

• Can automate manual and tedious processes in Femap

• Can interact with other software such as Excel or Matlab

View FEMAP as a development platform where the out of the box

functionality fits 95% of the users 95% of the way

• But different companies have different FEA needs & methods of doing

analysis or specialized interests and requirements

• The API provides users with the flexibility to automate both routine and

complex tasks and tailor the software to their specific needs

3

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

Introduction To The Femap API

4

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

Terminology, Definitions, &

Common Questions

What is an API? – Application Programming Interface

• In Femap, we often call programs we create using the Femap API,

API programs, API macros or just APIs for short.

• The Femap API Programming is the most common way we

automate tasks in Femap.

What is OLE/COM?

• OLE, Object Linking and Embedding: Microsoft's framework for a

compound document technology.

• COM, Component Object Model: Microsoft's framework for

developing and supporting program component objects.

• These frameworks allow programs to talk with each other and use

each other’s functions and capabilities.

– For example, we can use an Excel Visual Basic Macro to load data from

Femap using the Femap API.

5

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

Terminology, Definitions, &

Common Questions

6

API can be accessed through the

API Programming Pane within

Femap – great for writing

programs quickly

You can also write programs in

Visual Studio – lots of debugging

tools and easy GUI construction

You can do this with Visual Studio

Express

Where can I use the API?

• Use the API within Femap or through visual studio

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

Terminology, Definitions, &

Common Questions

7

What kind of programming is the API?

• API Programs are most often written in Visual Basic, not a

proprietary command language

• The FEMAP API is object oriented, meaning interactions with the

API are performed by querying and manipulating a series of objects

– Objects have properties and methods

– Properties describe things about the object,

– Car.color = red

– Element.topology = CQUAD4

– Methods provide a way of interacting with an object

– Car.drive( 50, “grocery store” )

– Surface.mesh()

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

Terminology, Definitions, &

Common Questions

How can the API and FEMAP interact?

8

FEMAP

API

1 – Use API as an add-in

FEMAP API

2 – Run as two separate applications

FEMAP API

3 – Run FEMAP as an invisible server

4 – Embed FEMAP components in API

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

Visual Basic for Applications (VBA) allows us to directly access

Femap from Excel, Word or other Microsoft Office tools since they

they can work with OLE and COM.

Terminology, Definitions, &

Common Questions

• Use EXCEL to Control FEMAP Renumber Entities: Nodes, Elements, Properties, Materials, etc. by layer, color, group, etc.

Extract Model Information: Mass, Volume, CG, Layer/Group/Color Name, etc., to spreadsheets

• Output Model Information All Information Displayed in a Formatted Table

Can Be Easily Transferred to a Stress Report

9

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

How To Get Started

10

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

Femap Help Has Full Documentation

of Objects and Functions

11

The FEMAP Help can

be accessed in the

top border menu bar,

HELP --> Help Topics

Can also access pdf

version in the Femap

installation directory:

{install}\pdf\api.pdf

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

The Femap API Has Some Basic Objects and

Syntax to Learn – More Resources for Details…

12

Go to the Femap User Community

Search posts for:

“Introduction to the Femap API”

For an entire presentation with syntax basics and details…

Three main types of objects:

Application Object - Provides access to Femap GUI

as well as all entity and tool objects

Entity Objects – Anything created and stored in the

Femap database, elements, nodes, analysis sets,

etc.

Tool Objects – A special class that provide

functionality and are not stored in the database,

Data Table, File Reader, Sets, Beam Calculator, etc.

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

Femap Has a Wide Variety of Example

API programs in “Custom Tools”…

13

These tools are frequently API programs

with examples and source located at:

{femap install}\api\

Study, try or debug and examples from here…

Place your own tools in this folder and they will

Show up in your Femap session…

Add your own custom tools or tools

directory here…Add tools copies your tool

to the Femap installation directory, Tools

Directory lets you specify your own

folder…

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

Femap Has a Built In “API Programming Pane”

Which Can Be Used to Edit or Debug Programs

14

Beginning of the Program…

Create and Set a Femap

Application Object

End of the Program…

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

Make, Toolbars, Shortcuts or Icons to

Execute API Commands You Like

15

Create a new toolbar

Add a user command

And then go to

add Keyboard

Shortcut if you like

Drop and Drag

Commands to toolbar Right click on the tool bar to customize change buttons

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

ATA Examples

These are available at:

www.ata-plmsoftware.com

16

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

Example API #1: Save and Load Element,

Material, Property Colors Across Similar Models

18

save_elem_color.bas

load_elem_color.bas

.col

(color file)

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

Example API #2: Freebody Loads

for Many Groups and Load Cases

20

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

Example API #3: Automate PPT

Documentation

22

PPT of

Accelerometer

Data

(optional)

FEM with Many CSYS User Inputs PPT with

Pictures of

Accelerometer

Locations

Femap API

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

Example API #4: Reflect Element Properties,

Materials, and Coordinate Systems

24

FEM with Multiple

Properties and Specific

Material Orientations

Reflected Model

Femap API – User Inputs

Filter on Element Types?

Filter on Material Types?

Reflect CS?

Choose Reflection Plane

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

Example API #5: Write Groups to

Nastran Files

26

FEM with Many Groups Femap API - User Inputs

.bdf Include

Files for

Each Group

Example output for group export

in FEMAP message window

13290 Evening Creek Drive South, Suite 250, San Diego, CA 92128 | T 858.480.2000 | F 858.792.8932 | www.ata-e.com

Final Thoughts About the Femap

API

• The easiest way to get started is to pick a simple task

• Formulate the path with manual operations

• Identify corresponding Femap API functions and methods

• Everything you need is in the documentation or examples

• Femap API code can be written within Femap or with external

interfaces – learning visual basic syntax is helpful to get started.

• Don’t forget about debugging and test models

• Enjoy!

27


Recommended