• No results found

CST STUDIO SUITE Introduction in VBA Macro usage and programming

N/A
N/A
Protected

Academic year: 2021

Share "CST STUDIO SUITE Introduction in VBA Macro usage and programming"

Copied!
28
0
0

Loading.... (view fulltext now)

Full text

(1)

CST STUDIO SUITE™

Introduction in VBA

Macro usage and programming

M. Balk

Existing Macros Different Macro Types Templates

Structure of a Macro Example

(2)

Outline

Why macro programming? Existing macros

Different types of macros

Creating and testing new macros Getting more information

(3)

Outline

Why macro programming? Existing macros

Different types of macros

Creating and testing new macros Getting more information

(4)

Why Macro Programming?

 Automate common tasks, save time, increase productivity

 Extend the program‘s capabilities, e.g. post processing, optimization

 Customize the program for particular applications

 Make advanced functionality available to less experienced users

CST STUDIO SUITE‘s macro language:

Compatible to the widely used VBA (Visual Basic for Applications)

(5)

Integration Into Workflow

CST Studios can be both: OLE client and server

MS Windows

Scripting

Host

Excel, Word,

Matlab, AutoCad,

etc...

CST Software

(MWS, DS)

e.g. bidirectional Excel link

COM

DCOM

reports

e.g. ppt-Reports

(6)

Integration Into Workflow

! "C:\Program Files\CST STUDIO SUITE 2006B\CST DESIGN ENVIRONMENT.exe" –m D:\MBK\Start_CST_5.bas

Matlab

CST Software

(CST MWS,

CST DS)

Call via command line option

Call:

Execute command in Matlab CST MWS is called

within the CST DESIGN ENVIRONMENT

Path of the VBA script

Sub Main

OpenFile("D:\MBK\test1\test1.mod") Solver.Start

Opens an existing CST MWS file Start of Transient Solver

(7)

Project Templates

File -> New...

File -> Select Template...

or later: At the beginning:

Customize the default settings for particular types of applications.

(8)

Input some commands you often use for your MWS structures, e.g.:

Frequency range, units, Background-mat + boundaries

Definition of materials (parameters, favorite colours ...)

Working plane settings (especially snapping !)

Monitors at favorite frequencies, ... Open the history list

Mark the commands, press „Macro“

Give a name to your macro, e.g. „File / My defaults“

Click „Make globally available“, then „OK“

(9)

Postprocessing

 Import and compare with measured data

 Special postprocessing (e.g. TDR)

 Store Views and Animations in different formats

 Userdefined goal-functions (e.g. antenna goal)

 Creating a Powerpoint Presentation

Customize CST MWS

exactly to your needs

(10)

Outline

Why macro programming? Existing macros

Different types of macros

Creating and testing new macros Getting more information

(11)
(12)
(13)
(14)
(15)

Outline

Why macro programming? Existing macros

Different types of macros

Creating and testing new macros Getting more information

(16)

Structure Macros and Control Macros

Structure macros

Modify the structure

Stored in the history listfor parametric model definition

Name: ... . mcs

Example: Creation of advanced geometry, e.g. spirals,…c

(17)

Control macros

Do not modify the structure

Do not need to be stored in the history list Name: ... . mcr

Examples: Postprocessing, Calculation of analytical line impedance, etc.

Structure Macros and Control Macros

Macros -> Calculate -> Calculate Analytical Line Impedance

(18)

Project macros

 Can be either command macros or structure macros  Specific for a particular project

 Stored with the project.

Not available for other projects as well

Global macros

 Can be either command macros or structure macros  Generally useful

(19)

Result Templates

Performs an action

Purpose: Customized and automized postprocessing

Store in <installationpath>/Library/Result Templates/my_template.rtp

Will be evaluated after each solver run.

(20)

Result Templates

Returns a value

Purpose: Customized and automized postprocessing

Store in <installationpath>/Library/Result Templates/my_template.rtp

Will be evaluated after each solver run.

(21)

Outline

Why macro programming? Existing macros

Different types of macros

Creating and testing new macros Getting more information

(22)

The Integrated Development Environment

(23)

Edit macro code here (syntax highlighting)

Run the macro Debug the macro

(24)

The Integrated Development Environment

Macro Debugger:

Set breakpoints

(25)

The Integrated Development Environment

Graphical GUI builder

Source code for the dialog box is automatically created and Inserted at the caret‘s position

(26)

There exist different ways to create a macro

Copy and modify an existing macro

Go to the history list, select lines and press „Macro“

Use Macro -> Make VBA Control Macro and start from Scratch Let MWS create the macro‘s framework by pressing „Edit“ for

User defined excitation function

User defined parameter sweep watch

User defined optimizer goal function

(27)

Outline

Why macro programming? Existing macros

Different types of macros

Creating and testing new macros Getting more information

(28)

Advanced Topics Manual

Check the VBA online manual (Help -> VBA Macro Language)

Have a look at the pre-loaded macro examples

Visit a special training class on macro programming

Learning by doing….

References

Related documents

Structure of the World Wide Web is a typical example of a graph where the web pages are “nodes,” and the hyperlinks are “edges.” One of the best ways to describe a web site

In this activity, students will work in groups to extract both macro- and meso-fauna, using Berlese funnels, from three different soil types: potting soil, soil from a lawn, and

For example ,the same hardware and operating software can be used for a new or existing building control by using different programs to match the application1. An

These examples should show the communication per- formance of different network types, but also that the ping-pong values are not enough for a comparison. The ring based

While existing systems, such as Documentum ® -based document management systems or Oracle ® -based LIMS and clinical data management systems, may handle some types of data consumed

What is Inheritance, Explain different types of inheritance supported by Java with an example.. Explain Abstract classes and Dynamic binding with an

There are different types of bank card in use, ranging from cards which can only be used to access someone’s account through an Automatic Teller Machine (ATM), for

The first example in this paper showed how to use %LET to create a macro variable that was used to change the name of a data set in a title statement and two PROCs (CONTENTS and