Sunteți pe pagina 1din 234

INTEGRATED ENGINEERING SOFTWARE

Integrated API Guide

Version 9.2

Users Guide and Technical Manual


2 INTEGRATED API Guide

*This document is your guide to the common aspects of IES 2D analysis


programs. It is the companion to the specific guides for individual analysis
modules. These modules are either individual programs, or modes
accessed in multiphysics programs via the menu Utilities > Mode >
{physics type}.

Information in this document is subject to change without notice and does


not represent a commitment on the part of INTEGRATED ENGINEERING
SOFTWARE SALES Inc. The software described in this document is
furnished under a license agreement or nondisclosure agreement. The
software may be used or copied only in accordance with the terms of the
agreement. It is against the law to copy any part of the software onto
cassette tape, disk or any other medium for any purpose other than the
licensee’s use.

This document contains proprietary information that is protected by


copyright. All rights are reserved.

Integrated Engineering Software Sales Inc.


220 – 1821 Wellington Avenue
Winnipeg, Manitoba, Canada
R3H 0G4
Telephone: (204) 632-5636
Facsimile: (204) 633-7780
E-mail: info@integratedsoft.com
Home Page: http://www.integratedsoft.com

Copyright ENGINIA RESEARCH Inc., 2011

March 2012
Table of Contents 3

Table of Contents
CHAPTER 1 ............................................................................................ 21
INTRODUCTION TO SCRIPTING/PROGRAMMING .............................. 21

WHAT IS AN API? WHAT WOULD I USE IT FOR? ......................................... 21

GETTING STARTED .................................................................................. 21

ORGANIZATION OF THIS MANUAL .............................................................. 22

MANUAL CONVENTIONS ........................................................................... 22

Symbols used in the manual........................................................... 22

PRODUCT SUPPORT ................................................................................ 22

CHAPTER 2 EXPLANATION OF THE INTEGRATED API ................... 25

OVERVIEW OF THE INTEGRATED API? WHAT IS IT? ............................... 25

ESSENTIAL SETUP FOR USING THE API ..................................................... 27

FUNCTION HIERARCHY/NAMING IN THE INTEGRATED API ....................... 28

Name Structure: ............................................................................... 28

Case: ................................................................................................. 30

Abbreviations: .................................................................................. 30

CATEGORY ............................................................................................. 30

Categories used by the API............................................................. 31

ACTION .................................................................................................. 31

Prefixes for Properties of Objects .................................................. 31

Prefixes for Defining/Deleting Actions ........................................... 32

SELECTIONTYPE / DATAFORM.................................................................. 32
4 INTEGRATED API Guide

CHAPTER 3 ............................................................................................. 33
THE INTEGRATED API FUNCTION LIST............................................... 33

FILE ....................................................................................................... 33

ExportImage_AsBMP ....................................................................... 33

ExportImage_AsGIF ......................................................................... 33

ExportImage_AsJPG ........................................................................ 34

ExportImage_AsPNG ....................................................................... 34

Open .................................................................................................. 35

Save ................................................................................................... 35

Save2DElectricStreamlines ............................................................. 35

SaveStreamlines .............................................................................. 36

GEOMETRY ............................................................................................. 37

AngularCopy..................................................................................... 37

AngularCopy_AboutXaxis ............................................................... 38

AngularCopy_AboutYaxis ............................................................... 39

AngularCopy_AboutZaxis ............................................................... 39

CreateLine......................................................................................... 40

CreateArc_By3points ....................................................................... 40

CreateCube ....................................................................................... 41

CreateSphere_ByCenterRadius ...................................................... 41

CreateSpline ..................................................................................... 42

DefinePlanarSurface_FromSegments ............................................ 42

Define3SidedSurface ....................................................................... 43
Table of Contents 5

Define4SidedSurface ....................................................................... 43

DefineVolume_FromSurfaces ......................................................... 44

Delete_All ......................................................................................... 44

Displace ............................................................................................ 45

Displace_ByVolume ......................................................................... 45

GetNumberOfRegions ..................................................................... 46

GetnumberofSegments ................................................................... 46

GetnumberofSurfaces ..................................................................... 46

GetnumberofVolumes ..................................................................... 47

GetSegment_FromPoint .................................................................. 47

GetSurface_FromPoint .................................................................... 48

GetVolume_FromPoint .................................................................... 48

LinearCopy ....................................................................................... 49

Rotate ................................................................................................ 49

Rotate_AboutX ................................................................................. 50

Rotate_AboutY ................................................................................. 50

Rotate_AboutZ ................................................................................. 51

SetConstantXPlane .......................................................................... 51

SetConstantYPlane .......................................................................... 51

SetConstantZPlane .......................................................................... 52

SweepSegment_AboutX .................................................................. 52

SweepSegment_AboutY .................................................................. 53
6 INTEGRATED API Guide

SweepSegment_AboutZ .................................................................. 53

SweepSegment_AlongX .................................................................. 54

SweepSegment_AlongY .................................................................. 54

SweepSegment_AlongZ .................................................................. 55

SweepSegment_Linear .................................................................... 55

SweepSurface_AboutX .................................................................... 56

SweepSurface_AboutY .................................................................... 57

SweepSurface_AboutZ .................................................................... 57

SweepSurface_AlongX .................................................................... 58

SweepSurface_AlongY .................................................................... 58

SweepSurface_AlongZ .................................................................... 59

SweepSurface_Linear ...................................................................... 59

HealOverlappingPlanarSurfaces_All .............................................. 60

GEOMETRY2D ......................................................................................... 60

AngularCopy..................................................................................... 61

Create2DSpline ................................................................................. 61

CreateArc_ByCenterRadiusAngles ................................................ 62

CreateArc_By3Points....................................................................... 63

CreateArc_ByStartEndCenterPoints .............................................. 63

CreateLine......................................................................................... 64

2D_Displace ...................................................................................... 64

GetLinePointCoordinates ................................................................ 65
Table of Contents 7

GetArcPointCoordinates ................................................................. 66

GetSegment_FromPoint .................................................................. 66

GetRegion_FromPoint ..................................................................... 67

GetRegionID_FromSegments ......................................................... 67

GetRegionOnLeft_FromSegment ................................................... 68

GetRegionOnRight_FromSegment................................................. 68

LinearCopy ....................................................................................... 69

Rotate ................................................................................................ 69

PHYSICS ................................................................................................. 70

AddCollectorsurface_ByNumber .................................................... 70

AddEmissionPoint ........................................................................... 70

AddEmittersurface_ByNumber ....................................................... 71

AddParticle_ToLibrary .................................................................... 72

CreatePointCharges ........................................................................ 72

CreatePointEmitter .......................................................................... 73

CreateSurfaceCollector ................................................................... 73

CreateSurfaceEmitter ...................................................................... 74

CreateWaveGuideSource ................................................................ 74

Delete2DBoundaryCondition .......................................................... 75

Delete2DBoundaryCondition_BySegment..................................... 75

Delete2DMagnetization .................................................................... 76

Delete2DMagnetization_ByRegion ................................................. 76
8 INTEGRATED API Guide

Delete2DVoltage ............................................................................... 76

Delete2DVoltage_BySegment ......................................................... 77

Delete2DVolumeCurrent .................................................................. 77

Delete2DVolumeCurrent_ByRegion ............................................... 77

DeleteMagnetization......................................................................... 78

DeleteMagnetization_ByVolume ..................................................... 78

DeletePointCharges ......................................................................... 79

DeleteVoltage ................................................................................... 79

DeleteVolatge_BySurface ................................................................ 79

DeleteBoundaryCondition ............................................................... 80

DeleteBoundaryCondition_BySurface ........................................... 80

EditEmissionPoint............................................................................ 80

Get2DModelType .............................................................................. 81

Get2DVoltage_BySegment .............................................................. 82

GetBackgroundPermittivity ............................................................. 82

GetMaterialByIndex .......................................................................... 83

GetMaterialConductivity .................................................................. 83

GetMaterialList ................................................................................. 84

GetMaterialList2 ............................................................................... 84

GetMaterialPermeability .................................................................. 85

GetMaterialPermittivity .................................................................... 85

GetMaterialThermalConductivity .................................................... 86
Table of Contents 9

MovePointCharges .......................................................................... 86

Set2DFloating ................................................................................... 86

Set2DFloating_BySegment ............................................................. 87

Set2DLinearVoltage_BySegment ................................................... 87

Set2DMagnetizationAngle ............................................................... 88

Set2DMagnetizationAngle_ByRegion ............................................ 88

Set2DModelType .............................................................................. 89

Set2DTemperature ........................................................................... 89

Set2DTemperature_BySegment ..................................................... 90

Set2DVoltage .................................................................................... 90

Set2DVoltage_BySegment .............................................................. 91

Set2DVoltageMagnitudePhase ....................................................... 91

Set2DVoltageMagnitudePhase_BySegment .................................. 92

Set2DVolumeCurrent ....................................................................... 92

Set2DVolumeCurrent_ByRegion .................................................... 93

Set2DVolumeCurrentMagnitudePhase .......................................... 93

Set2DVolumeCurrentMagnitudePhase_ByRegion ........................ 94

Set2DVolumeHeat ............................................................................ 94

Set2DVolumeHeat_ByRegion ......................................................... 95

SetFloating ....................................................................................... 95

SetFloating_BySurface .................................................................... 96

SetBackgroundPermittivity ............................................................. 96
10 INTEGRATED API Guide

SetBalanced...................................................................................... 97

SetCongruentMagnet_ByVolume ................................................... 97

SetEmissionRegimeTo_EnhancedFowlerNordheim ..................... 98

SetEmissionRegimeToExtendedSchottky ..................................... 98

SetEmissionRegimeToFowlerNordheim ........................................ 99

SetEmissionRegimeTo_I ................................................................. 99

SetEmissionRegimeTo_J .............................................................. 100

SetEmissionRegimeTo_RichardsonDushman ............................ 100

SetEmissionRegimeTo_Schottky ................................................. 101

SetEmissionRegimeTo_ChildsLaw .............................................. 102

SetEmitterColor .............................................................................. 102

SetEmitterParticle .......................................................................... 103

SetLineCurrent_BySegment.......................................................... 103

SetLineCurrentMagnitudePhase_BySegment ............................. 104

SetMagnetizationDirection ............................................................ 105

SetMagnetizationDirection_ByVolume ......................................... 105

SetMaterial ...................................................................................... 106

SetMaterial_ByRegion ................................................................... 106

SetMaterial_ByVolume................................................................... 106

SetMaterialConductivity ................................................................ 107

SetMaterialPermeability ................................................................. 107

SetMaterialPermittivity................................................................... 108
Table of Contents 11

SetMaterialThermalConductivity .................................................. 108

SetNumberEmissionPoints ........................................................... 109

SetPerfectLineConductor_BySegment ........................................ 109

SetPerfectSurfaceConductor_BySurface .................................... 110

SetPerfectVolumeConductor_ByVolume ..................................... 110

SetPhasorMode .............................................................................. 111

SetPointChargeSize ....................................................................... 111

SetRectangularWaveGuideSource ............................................... 111

SetStaticMode ................................................................................ 112

SetUnbalanced ............................................................................... 112

SetVoltage ...................................................................................... 113

SetVoltageBysurface ..................................................................... 113

SetVoltageMagnitudePhase .......................................................... 114

SetVoltageMagnitudePhase_BySurface ...................................... 114

SetVolumeCharge .......................................................................... 115

SetVolumeCharge_ByVolume ....................................................... 115

SetVolumeCurrent_ByVolume ...................................................... 116

SetVolumeCurrentMagnitudePhase_ByVolume .......................... 116

SOLUTION ............................................................................................. 117

RunSolver ....................................................................................... 117

RefineSolution................................................................................ 117

DeleteSolution ................................................................................ 118


12 INTEGRATED API Guide

SetODE_ToRK4 .............................................................................. 118

SetODE_ToRK5 .............................................................................. 118

SetODE_ToRK853 .......................................................................... 119

SetODE_ToBulirschStoer .............................................................. 120

SetMeshSegmentWeight ............................................................... 121

MESH ................................................................................................... 121

AssignTriangular_AutomaticAll .................................................... 121

AssignTriangular_AutomaticLocal ............................................... 122

AssignTetrahedral_AutomaticAll .................................................. 122

AssignTetrahedral_AutomaticLocal ............................................. 122

AssignQuadrilateral_AutomaticAll ............................................... 123

AssignQuadrilateral_AutomaticLocal .......................................... 123

AssignTriangular_BySurface ........................................................ 124

DeleteVolume_MeshAll .................................................................. 124

SetMinimumVolumeMesh_OFF ..................................................... 124

SetMinimumVolumeMesh_ON ...................................................... 125

SetSegmentWeight......................................................................... 125

SetSurfaceWeight .......................................................................... 125

SetVolumeWeight ........................................................................... 126

2D_SetRegionWeight ..................................................................... 126

ANALYSIS ............................................................................................. 127

Create2DElectricStreamlines ........................................................ 127


Table of Contents 13

Create2DElectricStreamlines_FromPoint .................................... 127

Create2DElectricStreamlines_FromSegments ............................ 128

Create2DStreamlines ..................................................................... 128

Create2DStreamlines_FromPoint ................................................. 129

CreateStreamlines_FromPoint...................................................... 129

CreateStreamlines_FromSegments ............................................. 130

CreateStreamlines_FromSurface ................................................. 130

DeleteStreamlines_All ................................................................... 131

Get2DElectricField ......................................................................... 131

Get2DElectricFields ....................................................................... 132

Get2DElectricField_FromSegment ............................................... 133

Get2DElectricFieldSummary_FromSegment ............................... 134

Get2DFloatingVoltage_BySegment .............................................. 135

Get2DFluxLinkage ......................................................................... 136

Get2DFluxLinkage_ByRegion ....................................................... 136

Get2DForce..................................................................................... 137

Get2DForce_ByRegion .................................................................. 137

Get2DMagneticField ...................................................................... 138

Get2DMagneticFields .................................................................... 138

GetBeamCenterAndDiameter........................................................ 139

Get2DTemperature ......................................................................... 141

Get2DTorque .................................................................................. 141


14 INTEGRATED API Guide

Get2DTorque_ByRegion ................................................................ 142

Get2DVoltage.................................................................................. 143

GetElectricField .............................................................................. 143

GetElectricFields ............................................................................ 144

GetElectricField_FromFile_ToFile ................................................ 145

GetFloatingVoltage ........................................................................ 146

GetForce ......................................................................................... 146

GetForce_ByVolume ...................................................................... 147

GetForceOnPointCharge_Perturbed ............................................ 147

GetForceOnPointCharges ............................................................. 148

GetMagneticField ........................................................................... 148

GetMagneticFields ......................................................................... 149

GetMagneticField_FromFile_ToFile .............................................. 151

GetNumberOfBeams ...................................................................... 151

GetNumberOfEmissions ................................................................ 152

GetNumberOfPoints ....................................................................... 152

GetNumberOfPoints_OnStreamlines............................................ 153

GetNumberOfRayIntersectionsWithPlane.................................... 153

GetNumberOfRays ......................................................................... 154

GetNumberOfStreamlines ............................................................. 154

GetCoordinateTimeDistance_OnRay............................................ 154

GetField_OnRay ............................................................................. 155


Table of Contents 15

GetKinematics_OnRay .................................................................. 156

GetRayRadiusandCurrent ............................................................. 157

GetStreamlineData ......................................................................... 158

GetTemperature ............................................................................. 158

GetTemperature_Fromfile_ToFile ................................................. 159

GetTorque ....................................................................................... 159

GetTorque_ByVolume ................................................................... 160

GetVoltage ...................................................................................... 160

GetVoltages .................................................................................... 161

GetVoltage_FromFile_ToFile ........................................................ 162

SetBeamAxis_AlongSegments ..................................................... 163

SetBeamAxis_AlongX ................................................................... 163

SetBeamAxis_AlongY ................................................................... 164

SetBeamAxis_AlongZ .................................................................... 164

SetElectricStreamlinesDirection................................................... 164

SetElectricStreamlinesMaxLength ............................................... 165

SetElectricStreamlinesPrecision .................................................. 165

SetElectricStreamlinesStepSize ................................................... 166

SetStreamlinesDirection ............................................................... 167

SetStreamlinesMaxLength ............................................................ 167

SetStreamlinesPrecision ............................................................... 167

SetStreamlinesStepSize ................................................................ 168


16 INTEGRATED API Guide

UnsetElectricStreamlinesMaxLength ........................................... 168

UnsetElectricStreamlinesStepSize ............................................... 168

UnsetStreamLineMaxLength ......................................................... 169

UnsetStreamLineStepSize ............................................................. 169

OBJECT ................................................................................................ 169

AddRegion ...................................................................................... 169

AddSegment ................................................................................... 170

AddSurface ..................................................................................... 170

AddVolume ..................................................................................... 170

Create .............................................................................................. 171

Create_FromArray .......................................................................... 171

Delete .............................................................................................. 172

GetObjectID .................................................................................... 172

RemoveAll Geometry ..................................................................... 173

RemoveRegion ............................................................................... 173

RemoveSegment ............................................................................ 173

RemoveSurface .............................................................................. 174

RemoveVolume .............................................................................. 174

MODEL ................................................................................................. 175

Delete_All ........................................................................................ 175

GetAllAvailableAnalysisModes ..................................................... 175

GetCurrentAnalysisMode .............................................................. 175


Table of Contents 17

GetUnit ............................................................................................ 176

SetAnalysis..................................................................................... 176

SetUnit ............................................................................................ 176

VIEW .................................................................................................... 177

Set2DLimits .................................................................................... 177

GetZoomCenterRadius .................................................................. 178

Set2DLimits .................................................................................... 178

Setdirection .................................................................................... 179

SetLimits ......................................................................................... 179

SetLookatPoint............................................................................... 180

SetTypeHiddenLine ....................................................................... 180

SetTypeSolid .................................................................................. 180

SetTypeSolidColorEdges .............................................................. 181

SetTypeSolidEdges ....................................................................... 181

SetTypeSolidTranslucent .............................................................. 181

SetTypeTranslucent ....................................................................... 181

SetTypeWireFrame ........................................................................ 182

SetUpAxisX..................................................................................... 182

SetUpAxisY..................................................................................... 182

SetUpAxisZ ..................................................................................... 183

SetZoomAllGeometry .................................................................... 183

SetZoomCenterRadius .................................................................. 183


18 INTEGRATED API Guide

WINDOW ............................................................................................... 184

CheckInitialization .......................................................................... 184

Close ............................................................................................... 185

PopupMessage ............................................................................... 185

Refresh ............................................................................................ 185

Show................................................................................................ 185

ERROR CODES ...................................................................................... 185

CHAPTER 4 ........................................................................................... 189


DATA TYPES AND ARRAY EXAMPLES ............................................. 189

PARAMETER TYPES IN DIFFERENT ENVIRONMENTS .................................. 189

ARRAY EXAMPLES ................................................................................. 190

Excel (VBA) ..................................................................................... 190

Matlab .............................................................................................. 191

CHAPTER 5 ........................................................................................... 193


SCRIPTING WITH EXCEL MACROS .................................................... 193

WHY USE EXCEL? ................................................................................. 193

SETTING UP EXCEL FOR THE INTEGRATED API .................................... 193

Setting up IES.exe for the API ....................................................... 193

Enabling the Development Tools in Excel ................................... 193

How Excel Macros Work ................................................................ 195

A Simple Example .......................................................................... 196

Potential Trouble – References ..................................................... 200

Adding to the Test Example .......................................................... 202


Table of Contents 19

Included Samples .......................................................................... 204

CHAPTER 6 .......................................................................................... 211


PROGRAMMING FOR THE API WITH VISUALSTUDIO .................... 211

WHY WRITE FULL PROGRAMS FOR THE API? ......................................... 211

VISUALSTUDIO 2010 TEST EXAMPLE...................................................... 212

Creating the Project ....................................................................... 212

Setting up IES.exe for the API ....................................................... 215

Referencing the INTEGRATED API ............................................... 216

Making a Simple Program ............................................................. 218

OTHER EXAMPLES ................................................................................ 224

CHAPTER 7 SCRIPTING FOR THE API WITH MATLAB ................. 227

INTRODUCTION ...................................................................................... 227

Invoking API Commands ............................................................... 227

Initial Setup..................................................................................... 228

Quick API Function List ................................................................ 229

EXAMPLE PROJECT – HALBACH WIGGLER .............................................. 229

OTHER EXAMPLES ................................................................................ 233


Chapter 1 - Introduction 21

CHAPTER 1

INTRODUCTION TO
SCRIPTING/PROGRAMMING

WHAT IS AN API? WHAT WOULD I USE IT FOR?


API – “Application Programming Interface”

Your INTEGRATED program is very powerful when run interactively and


is even more powerful when automation tools such as parametrics and
batch are used. However, there are times when you may still be looking
for a lot more power. In those cases, what you may need is to take direct
control of the program’s functions with a utility script (e.g. an Excel batch)
or with a custom program of your own design. For an individual task this
is more work than using the program interactively or with the interactive
automation of parametrics/batch, but the degree of automation available
opens up a lot of capabilities not readily available interactively.

The INTEGRATED API is a COM interface enabling you to access


internal functions of your INTEGRATED program from outside
programs/scripts. This Guide is your manual for the API.

GETTING STARTED
Even if you are expecting to exclusively program your INTEGRATED
software you should make sure you understand the interface. The API
and interface are based on the same INTEGRATED approach to
simulation – the same model hierarchy and workflow. If you are a first
time user, we strongly recommended that you complete the Sample
Sessions in the Quick Start Guide before proceeding to your own
designs or reading the bulk of this manual for the API.
22 INTEGRATED API Guide

After completing the Quick Start Guide samples you should understand
the interface, workflow and built-in aids of your INTEGRATED program.
This manual then serves as a reference for how the same approach
translates into an API.

ORGANIZATION OF THIS MANUAL


This manual contains a chapter explaining the API, a chapter listing and
describing the functions in the API and chapters summarizing the standard
API examples that are included with your program.

MANUAL CONVENTIONS
Periodically, the manual uses tips, notes or important messages to help
you efficiently create and solve your models. These messages have the
following format:

Symbols used in the manual


This manual uses a number of symbols to highlight specific parts of the
text. The meaning of these symbols is as follows:

The pencil and paper marks a note about how a function


works, or explains a screen display.

The light bulb marks a tip about how to use the program more
efficiently. For example, a tip might give you a keyboard
shortcut for a commonly used command.

The exclamation mark marks an important comment about


using a function or creating the model. These instructions are
crucial for obtaining an accurate solution.

PRODUCT SUPPORT
While evaluating a program, if you have any questions, please do not
hesitate to contact our Technical Support staff at +1 (204) 632-5636 in
Canada or by e-mail at support@integratedsoft.com

INTEGRATED ENGINEERING SOFTWARE


Chapter 1 - Introduction 23

After purchasing a program you have one year of support automatically


available. This can be renewed annually for ongoing program updates
and technical support.

INTEGRATED ENGINEERING SOFTWARE


Chapter 2 – Explanation of the INTEGRATED API 25

CHAPTER 2

EXPLANATION OF THE
INTEGRATED API

OVERVIEW OF THE INTEGRATED API? WHAT IS IT?


The INTEGRATED API is a COM dual interface, the type strongly
suggested by Microsoft for automation. It enables you to access internal
functions of your INTEGRATED program from outside programs/scripts.
This structure enables you to select your preferred language and
development environment and to call INTEGRATED from within it.

The general method of a script/program accessing the INTEGRATED API


is demonstrated by these two lines (in red below) of this VisualBasic:

 Set IES = CreateObject("IES.Document")


this line instructs windows to open your INTEGRATED program
and to pass a handle to your script. In this case the handle will
be called “IES” within the script
 After opening the program with a handle, any time your script
needs to access an INTEGRATED API function it will do so in a
format such as this:
Ret = IES.APIFunctionName(“parameters”)
This line shows how the API function is accessed via the handle
given when the INTEGRATED program is opened.
 The “parameters” are passed in both directions – both for
sending information to your INTEGRATED program and
receiving information from it. The types of the variables used for
parameters must be declared before they are included in a
function call.

A good development environment will greatly reduce the amount you need
to memorize or type to use the API. For example, below is an example in

INTEGRATED ENGINEERING SOFTWARE


26 INTEGRATED API Guide

VisualStudio where the Integrated API has been called with the handle
_Document. Then when you start typing _D, you are immediately
presented with the option:

Next press the <Enter> key and the word _Document fills in for you.
Type the period and a list of functions available in _Document appears:

You can scroll down the list, or keep typing to narrow down the selection:

Once you have the entire function name selected, typing the bracket will
present the format of the variables to be passed:

As shown above, the name of the object to be assigned a voltage is the


next thing to be entered, hence the instruction to pass a string is in bold.
After entering a string, the instruction to pass a double precision number
for the voltage is highlighted in bold:

INTEGRATED ENGINEERING SOFTWARE


Chapter 2 – Explanation of the INTEGRATED API 27

Most INTEGRATED API functions end with a short integer


error code that you can choose to use for validation while
running.

Hence, what is most useful, and what will be the focus of this chapter is to
understand the conventions used to name the functions so that with your
development tool’s help, you can write with minimal typing and minimal
memorization of the function names.

ESSENTIAL SETUP FOR USING THE API


In version 9.2 the API is accessed by invoking the registry entry
IES.Document from a program. This contains the information that lets the
other program access the INTEGRATED program. There can only be one
such registry association at a time. The first time you wish to run a
program from the API you need to:

1) Locate the program’s executable file. This will be IES.exe in the


program folder. For example, below is shown the standard location
for ELECTRO 9.1:

INTEGRATED ENGINEERING SOFTWARE


28 INTEGRATED API Guide

2) Right-click on the file and select “Run As Administrator”:

3) The program will open and setup the registry in the process.
Note: this is NOT the same as running in an account with
Administrator rights. This is a special mode which sets up the
registry. It may be that your system will setup the registry
automatically if you have administrator rights, but if that fails you
will need to follow this procedure.

4) Close the program. Until you run another IES.exe program “As
Administrator” this will be the program associated with
IES.Document.

FUNCTION HIERARCHY/NAMING IN THE INTEGRATED API


INTEGRATED API functions are named using English words and English-
like phrases to describe their type, function, selection method and the data
to be exchanged. The naming of functions in the INTEGRATED API is
designed to be compatible with the same workflow as when the program is
used interactively. This does not necessarily mean the words used or the
order of the words is identical to the menu structure. The API and
interface must work with the same data structure and toward the same
modeling goal as the interface, but they are two distinct ways of working
and this means the most natural or useful way of choosing and ordering
the words will be different. For the API there are the additional
considerations of standards found in general programming and making
use of common tools in development environments such as VisualStudio.

Name Structure:
Category_Action_SelectionType(parameters)

All functions will have a Category and Action. That is, a type of function
and what the function does.

INTEGRATED ENGINEERING SOFTWARE


Chapter 2 – Explanation of the INTEGRATED API 29

As necessary a SelectionType is also used. It is expected that names


will normally be used so there are no selection types such as _FromName
as that is assumed when no type is given. However, to select a segment
by its number would require the type _BySegment.

As an example, in KELVIN you can assign Temperature to one or more


segments by the name of the object the segments belong to:
Physics_Set2DTemperature(string sName, double dBC, ref short iErr)
Or by giving the ID number of an individual segment:
Physics_Set2DTemperature_BySegment(int iSegment, double dBC, ref short iErr)
Note the first function invokes the string sName for the name of the
object, the second function invokes integer iSegment for the ID of the
segment.

It is possible that additional functions will require further categories such


as _DataFormat to indicate the format of the data exchanged by the
function. However, for the API functions as of the version 9.1 release this
has not been necessary.

Example:

In many INTEGRATED programs the Analysis menu has a Streamlines


option. Hence the natural associated API function for making new
streamlines is:

Analysis_CreateStreamlines

However, the same API can be used for any INTEGRATED program
including multiphysics programs. Hence streamlines could be electric or
magnetic, 2D or 3D. The naming convention assumes 3D as the default
but no default field type. Hence to invoke a 2D electric streamline function
the name must begin:

Analysis_Create2DElectricStreamlines

However, Streamlines can be launched from points, segments or


surfaces. So to indicate launching from segments a SelectionType is
used:

Analysis_Create2DElectricStreamlines_FromSegments

INTEGRATED ENGINEERING SOFTWARE


30 INTEGRATED API Guide

A subtle distinction here is that _FromSegments is plural, hence it


suggests many segments will be passed. This would be done via an array
of segment ID numbers. A function which worked on only a single
segment identified by ID number would be _FromSegment (singular). If a
name was used to identify segments that are part of an object, there
would be no _SelectionType given.

Hence the overall structure of the function names is:

Category_Action_SelectionType

Case:
Uppercase is used to visually show the break between attached words in
a function name.

Uppercase is used when it is a standard for a selected abbreviation (e.g.


2D rather than 2d).

Abbreviations:
Abbreviations are only used when they are in common use in English
speech for the given word. For example:

 Used:
In normal English speech “2D” is commonly used instead of “two
dimensional”, “3D” instead of “three dimensional”, etc. In those
cases the same abbreviations are used by the INTEGRATED API.

 Not Used:
Even seemingly obvious abbreviations such as “geo” for “geometry”
are not used in the INTEGRATED API. Creating abbreviations
simply to shorten function names would make the code more
difficult to read.

CATEGORY
This is mostly the same as the name of the menu where the command is
found in the interface (or would be found for commands that are API-only).

Exceptions:

INTEGRATED ENGINEERING SOFTWARE


Chapter 2 – Explanation of the INTEGRATED API 31

 For the API, Modify menu commands are considered as Geometry


commands.

 Model and Window are introduced as classifications even though


they do not exist as menus.

Categories used by the API


 File

 Geometry

 Geometry2D

 Physics

 Solution

 Analysis

 View

 Object

 Model

 Window

ACTION
Action names are chosen to follow an English-like structure such as “set
the voltage” becomes SetVoltage.

Prefixes for Properties of Objects


In the interface, commands may use Display or Inquire for returning the
length, area, voltage etc. of an object in the model and Assign to change
these properties. For consistency with common API’s and ease of editing,
these are Get and Set prefixes in an action name. Hence the general
structure of such function actions is GetProperty and SetProperty. In
general, get function has a corresponding set function, with exceptions

INTEGRATED ENGINEERING SOFTWARE


32 INTEGRATED API Guide

such as read-only properties. Hence in coding one can copy/paste and


change one letter in many cases.

Prefixes for Defining/Deleting Actions


In the INTEGRATED interface, the words “define”, “undefine”, “create”,
and “delete” are used for various similar purposes. For clarity in the API
such actions are prefixed as Create and Delete.

SELECTIONTYPE / DATAFORM
The type of selection is assumed to be a named object using its name.
Where another method of selection is used, it will appear with a prefix of
From or By for getting data and To for assigning data.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 33

CHAPTER 3

THE INTEGRATED API


FUNCTION LIST

This chapter lists the functions available as of the version 9.2 release
according to their category. The list begins with those categories that
correspond to program top level menus, in the order (left to right) they
appear in the program.

FILE
ExportImage_AsBMP
File_ExportImage_AsBMP(string sFullPath, ref short iErr)
Applies to: All Programs
This function exports the image as a BMP file in the INTEGRATED
program.

sFullPath a string provided from your script providing the full


path and name of the file

Error code*.
iErr

ExportImage_AsGIF
File_ExportImage_AsGIF(string sFullPath, ref short iErr)
Applies to: All Programs

INTEGRATED ENGINEERING SOFTWARE


34 INTEGRATED API Guide

This function exports the image as a GIF file in the INTEGRATED


program.

sFullPath a string provided from your script providing the full


path and name of the file.

iErr Error code*.

ExportImage_AsJPG
File_ExportImage_AsJPG(string sFullPath, ref short iErr)
Applies to: All Programs
This function exports the image as a JPG file in the INTEGRATED
program.

sFullPath a string provided from your script providing the full


path and name of the file.

iErr Error code*.

ExportImage_AsPNG
File_ExportImage_AsPNG(string sFullPath, ref short iErr)
Applies to: All Programs
This function exports the image as a PNG file in the INTEGRATED
program.

sFullPath a string provided from your script providing the full


path and name of the file

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 35

Open
File_Open(string sFullPath, ref short iErr)

Applies to: All programs

This function opens (loads) a specified model file into the INTEGRATED
program.

sFullPath a string provided from your script providing the full


path and name of the file

iErr Error code*.

Save
File_Save(string sFullPath, ref short iErr)

Applies to: All programs

This function saves the active model file in the INTEGRATED program
into a specified name and location.

sFullPath a string provided from your script providing the full


path and name of the file

iErr Error code*.

Save2DElectricStreamlines
File_Save2DElectricStreamlines(string sFilePath, int
FormatVersion, ref short iErr)

INTEGRATED ENGINEERING SOFTWARE


36 INTEGRATED API Guide

Applies to: 2D Electric Programs

This function saves the displayed 2D electric streamline data in the


INTEGRATED program into a specified name and location.

sFilePath a string provided from your script providing the full


path and name of the file

FormatVersion The Streamlines format version (1 - old, 2 – new)


as set in Utilities>Settings.

iErr Error code*.

SaveStreamlines
File_SaveStreamlines(string sFilePath, int FormatVersion, ref short
iErr)

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 37

Applies to: All Programs

This function saves the active model file in the INTEGRATED program
into a specified name and location.

sFilePath a string provided from your script providing the full


path and name of the file

FormatVersion The Streamlines format version (1 - old, 2 – new)


as set in Utilities>Settings.

iErr Error code*.

GEOMETRY
AngularCopy
Geometry_AngularCopy(string sName, double x1, double y1,
double z1, double x2, double y2, double z2, double Angle, int
NumberOfCopies, ref short iErr)

INTEGRATED ENGINEERING SOFTWARE


38 INTEGRATED API Guide

Applies to: 3D programs

This functions creates an angular copy about an Axis from (x1, y1, z1) to
(x2, y2, z2).

x1, x2, y1, y2, z1, z2 The coordinates of the start and end points of
the axis.

Angle The rotation angle

NumberofCopies The number of copies.

iErr Error code*.

AngularCopy_AboutXaxis
Geometry_AngularCopy_AboutX(string sName, double Angle, int
NumberOfCopies, ref short iErr)

Applies to: 3D programs

This functions creates an angular copy about X Axis from (sName, Angle,
NumberofCopies)

sName Name of the object

Angle The rotation angle

NumberofCopies The number of copies.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 39

AngularCopy_AboutYaxis
Geometry_AngularCopy_AboutY(string sName, double Angle, int
NumberOfCopies, ref short iErr)

Applies to: 3D programs

This functions creates an angular copy about Y Axis from (sName, Angle,
NumberofCopies)

sName Name of the object

Angle The rotation angle

NumberofCopies The number of copies.

iErr Error code*.

AngularCopy_AboutZaxis
Geometry_AngularCopy_AboutZ(string sName, double Angle, int
NumberOfCopies, ref short iErr)

Applies to: 3D programs

This functions creates an angular copy about Z Axis from (sName, Angle,
NumberofCopies)

INTEGRATED ENGINEERING SOFTWARE


40 INTEGRATED API Guide

sName Name of the object

Angle The rotation angle

NumberofCopies The number of copies.

iErr Error code*.

CreateLine
Geometry_CreateLine(double x1, double y1, double z1, double
x2, double y2, double z2, ref int SegNumber, ref short iErr)

Applies to: 3D programs

This function draws a straight line segment from (x1, y1, z1) to (x2, y2,
z2).

x1, x2, y1, y2, z1, z2 The coordinates of the end points.

SegNumber The number of the created line segment.

iErr Error code*.

CreateArc_By3points
Geometry_CreateArc_By3Points(double StX, double StY, double
StZ, double MidX, double MidY, double MidZ, double EndX,
double EndY, double EndZ, ref int SegNumber, ref short iErr)

Applies to: 3D programs

This function draws an arc from (StX, StY, StZ) to (MidX, MidY, MidZ) to
(EndX, EndY, EndZ).

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 41

StX, StY, StZ, MidX, MidY, MidZ, EndX, The coordinates of the
EndY, EndZ. start, middle and end points.

SegNumber The number of the created


line segment.

iErr Error code*.

CreateCube
Geometry_CreateCube_ByCenterLength(double cX, double cY,
double cZ, double length, ref int VolNumber, ref short iErr)

Applies to: 3D programs

This function draws a cube from (cX, cY, cZ)

cX,cY,cZ The displacement coordinates

VolNumber The Volume ID number.

iErr Error code*.

CreateSphere_ByCenterRadius
Geometry_CreateSphere_ByCenterRadius(double cX, double cY,
double cZ, double Radius, ref int VolNumber, ref short iErr)

Applies to: 3D programs

This function draws a sphere from (cX,cY,cZ)

INTEGRATED ENGINEERING SOFTWARE


42 INTEGRATED API Guide

Radius The radius.

cX,cY,cZ The coordinates of the start, middle and end points.

VolNumber The Volume ID number.

iErr Error code*.

CreateSpline
Geometry_CreateSpline(object saXArr, object saYArr, object
saZArr, ref int SegNumber, ref short iErr)

Applies to: 3D programs

This function creates a spline froma point array (saXArr, saYArr, saZArr).

saXArr,saYArr,saZArr The arrays of points X,Y,Z coordinates.

SegNumber The number of the created line segment.

iErr Error code*.

DefinePlanarSurface_FromSegments
Geometry_DefinePlanarSurface_FromSegments(object
saArrOfSegments, int SrfNumber, ref short iErr)

Applies to: 3D programs

saArrOfSegments An integer array of the ID number of segments.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 43

This
SrfNumber The number of created surface.

iErr Error code*.

function defines a planar surface from a set of segments.

Define3SidedSurface
Geometry_Define3SidedSurface(int iSeg1, int iSeg2, int iSeg3, ref
int SrfNumber, ref short iErr)

Applies to: 3D programs

This function creates a surface from three connected line segments.

iSeg1, iSeg2, iSeg3 The ID numbers of the three segments.

SrfNumber The number of the created surface.

iErr Error code*.

Define4SidedSurface
Geometry_Define4SidedSurface(int iSeg1, int iSeg2, int iSeg3, int
iSeg4, ref int SrfNumber, ref short iErr)

INTEGRATED ENGINEERING SOFTWARE


44 INTEGRATED API Guide

Applies to: 3D programs

This function defines a surface from 4 connected line segments.

iSeg1, iSeg2, iSeg3, iSeg4 The ID numbers of the four


segments.

SrfNumber The number of the created surface.

iErr Error code*.

DefineVolume_FromSurfaces
Geometry_DefineVolume_FromSurfaces(object saArrOfSurfaces,
ref int VolNumber, ref short iErr)

Applies to: 3D programs

This function defines a volume bounded by the specified surfaces. It is


not necessary to include all surfaces bounding the volume, but a sufficient
set of surface IDs to make a unique definition needs to be passed in the
array variable.

saArrOfSurfaces An integer array of the ID numbers surfaces


bounding the volume.

VolNumber The number of the created volume.

iErr Error code*.

Delete_All
Geometry_Delete_All()

Applies to: All programs

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 45

This function deletes all the geometry, but not the object definitions.

Displace
Geometry_Displace(string sName, double xDisplacement, double
yDisplacement, double zDisplacement, ref short iErr)

Applies to: 3D programs

This function displaces all the geometry.

sName Name of the object

xDisplacement, ydisplacement, The displacement x,y,z


zDisplacement coordinates.

iErr Error code*.

Displace_ByVolume
Geometry_Displace_ByVolume(int iVolume, double
xDisplacement, double yDisplacement, double zDisplacement, ref
short iErr)

Applies to: 3D programs

This function displaces all the geometry by volume.

iVolume The volume ID.

xDisplacement, ydisplacement, The displacement x,y,z coordinates.


zDisplacement

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


46 INTEGRATED API Guide

GetNumberOfRegions
Geometry_GetNumberOfRegions(ref int iNumberOfRegions, ref
short iErr)

Applies to: 3D programs

This function gets the number of regions.

iNumberOfRegions Name of the regions

iErr Error code*.

GetnumberofSegments
Geometry_GetNumberOfSegments(ref int iNumberOfSegments,
ref short iErr)

Applies to: 3D programs

This function gets the number of segments.

iNumberOfSegments Name of the segments.

iErr Error code*.

GetnumberofSurfaces
Geometry_GetNumberOfSurfaces(ref int iNumberOfSurfaces, ref
short iErr)

Applies to: 3D programs

This function gets the number of surfaces.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 47

iNumberOfSurfaces Name of the surfaces

iErr Error code*.

GetnumberofVolumes
Geometry_GetNumberOfVolumes(ref int iNumberOfVolumes, ref
short iErr)

Applies to: 3D programs

This function gets the number of Volumes.

iNumberOfVolumes Name of the volumes.

iErr Error code*.

GetSegment_FromPoint
Geometry_GetSegment_FromPoint(double x, double y, double z, int
iSegment, ref short iErr)

Applies to: 3D programs

Get point from line segment.

x, y, z Numbers giving the x, y, z coordinates of the


point.

isegment The reference ID number of the segment.

SrfNumber The number of created surface.

INTEGRATED ENGINEERING SOFTWARE


48 INTEGRATED API Guide

iErr Error code*.

GetSurface_FromPoint
Geometry_GetSurface_FromPoint(double x, double y, double z,
ref int iSurfaceNumber, ref short iErr)

Applies to: 3D programs

This function gets the Surface ID from point. Returns the surface number
that is closest to the point

x,y,z The x,y,z coordinates of the point.

iSurfaceNumber The SurfaceNumber number.

iErr Error code*.

GetVolume_FromPoint
Geometry_GetVolume_FromPoint(double x, double y, double z,
ref int iVolumeNumber, ref short iErr)

Applies to: 3D programs

This function gets the volume ID from point. Returns the volume number
that contains the point

x,y,z The x,y,z coordinates of the point.

iVolumeNumber The VolumeNumber number.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 49

LinearCopy
Geometry_LinearCopy(string sName, double xDisplacement,
double yDisplacement, double zDisplacement, int
NumberOfCopies, ref short iErr)

Applies to: 3D programs

This function gets the linear copy of the geometry.

sName The name of the object

xDisplacement, ydisplacement, The x,y,z displacement coordinates


zDisplacement of the point.

NumberOfCopies The number of copies.

iErr Error code*.

Rotate
Geometry_Rotate(string sName, double x1, double y1, double
z1, double x2, double y2, double z2, double Angle, ref short iErr)

Applies to: 3D programs

This function rotates the geometry about an axis from (x1,y2,z1) to


(X2,y2,z2).

sName The name of the object

X1, y1, z1, x2 ,y2, z2 The x,y,z coordinates of the start and
the end point of the axis.

INTEGRATED ENGINEERING SOFTWARE


50 INTEGRATED API Guide

Angle The rotation angle.

iErr Error code*.

Rotate_AboutX
Geometry_Rotate_AboutX(string sName, double Angle, ref short
iErr)

Applies to: 3D programs

This function rotates the geometry about X axis.

sName The name of the object

Angle The rotation angle.

iErr Error code*.

Rotate_AboutY
Geometry_Rotate_AboutY(string sName, double Angle, ref short
iErr)

Applies to: 3D programs

This function rotates the geometry about Y axis.

sName The name of the object

Angle The rotation angle.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 51

Rotate_AboutZ
Geometry_Rotate_AboutZ(string sName, double Angle, ref short
iErr)

Applies to: 3D programs

This function rotates the geometry about Z axis.

sName The name of the object

Angle The rotation angle.

iErr Error code*.

SetConstantXPlane
Geometry_SetConstantXPlane(double depth, ref short iErr)

Applies to: 3D programs

This function sets the geometry mode to 3D Planar using the specified
constant x plane. This will be the plane showing up with the grid in the
program and will be the plane which Geometry2D API commands draw
on.

depth The plane set will be x=depth.

iErr Error code*.

SetConstantYPlane
Geometry_SetConstantYPlane(double depth, ref short iErr)

Applies to: 3D programs

INTEGRATED ENGINEERING SOFTWARE


52 INTEGRATED API Guide

This function sets the geometry mode to 3D Planar using the specified
constant y plane. This will be the plane showing up with the grid in the
program and will be the plane which Geometry2D API commands draw
on.

depth The plane set will be y=depth.

iErr Error code*.

SetConstantZPlane
Geometry_SetConstantZPlane(double depth, ref short iErr)

Applies to: 3D programs

This function sets the geometry mode to 3D Planar using the specified
constant z plane. This will be the plane showing up with the grid in the
program and will be the plane which Geometry2D API commands draw
on.

depth The plane set will be z=depth.

iErr Error code*.

SweepSegment_AboutX
Geometry_SweepSegment_AboutX(int iSegment, double Angle,
ref int SrfNumber, ref short iErr)

Applies to: 3D programs

This function creates a surface by a circular sweep of a segment about the


x-axis.

iSegment The ID number of the segment

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 53

Angle Angle of the sweep.

SrfNumber The number of the created surface.

iErr Error code*.

SweepSegment_AboutY
Geometry_SweepSegment_AboutY(int iSegment, double Angle,
ref int SrfNumber, ref short iErr)

Applies to: 3D programs

This function creates a surface by a circular sweep of a segment about the


y-axis.

iSegment The ID number of the segment

Angle Angle of the sweep.

SrfNumber The number of the created surface.

iErr Error code*.

SweepSegment_AboutZ
Geometry_SweepSegment_AboutZ(int iSegment, double Angle,
ref int SrfNumber, ref short iErr)

Applies to: 3D programs

This function creates a surface by a circular sweep of a segment about the


z-axis.

INTEGRATED ENGINEERING SOFTWARE


54 INTEGRATED API Guide

iSegment The ID number of the segment

Angle Angle of the sweep.

SrfNumber The number of the created surface.

iErr Error code*.

SweepSegment_AlongX
Geometry_SweepSegment_AlongX(int iSegment, double length,
ref int SrfNumber, ref short iErr)

Applies to: 3D programs

This function creates a surface by a linear sweep of a segment parallel to


the x-axis.

iSegment The ID number of the segment

length Length of the sweep.

SrfNumber The number of the created surface.

iErr Error code*.

SweepSegment_AlongY
Geometry_SweepSegment_AlongY(int iSegment, double length,
ref int SrfNumber, ref short iErr)

Applies to: 3D programs

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 55

This function creates a surface by a linear sweep of a segment parallel to


the y-axis.

iSegment The ID number of the segment

Length Length of the sweep.

SrfNumber The number of the created surface.

iErr Error code*.

SweepSegment_AlongZ
Geometry_SweepSegment_AlongZ(int iSegment, double length,
ref int SrfNumber, ref short iErr)

Applies to: 3D programs

This function creates a surface by a linear sweep of a segment parallel to


the z-axis.

iSegment The ID number of the segment

Length Length of the sweep.

SrfNumber The number of the created surface.

iErr Error code*.

SweepSegment_Linear
Geometry_SweepSegment_Linear(int iSegment, double x1, double y1,
double z1, double x2, double y2, double z2, int SrfNumber, ref short iErr)

INTEGRATED ENGINEERING SOFTWARE


56 INTEGRATED API Guide

Applies to: 3D programs

This function creates a surface by sweeping a segment about a defined


axis.

isegment The reference ID number of the segment.

x1, y1, z1 Numbers giving the x, y, z coordinates of the axis


starting point.

x2, y2, z2 Numbers giving the x, y, z coordinates of the axis


endpoint.

SrfNumber The number of created surface.

iErr Error code*.

SweepSurface_AboutX
Geometry_SweepSurface_AboutX(int iSurface, double Angle, ref
int VolNumber, ref short iErr)

Applies to: 3D programs

This function creates a volume by a circular sweep of a surface about the


x-axis.

iSurface The ID number of the swept surface.

Angle Angle of the sweep.

VolNumber The ID number of the created volume.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 57

iErr Error code*.

SweepSurface_AboutY
Geometry_SweepSurface_AboutY(int iSurface, double Angle, ref
int VolNumber, ref short iErr)

Applies to: 3D programs

This function creates a volume by a circular sweep of a surface about the


y-axis.

iSurface The ID number of the swept surface.

Angle Angle of the sweep.

VolNumber The ID number of the created volume.

iErr Error code*.

SweepSurface_AboutZ
Geometry_SweepSurface_AboutZ(int iSurface, double Angle, ref
int VolNumber, ref short iErr)

Applies to: 3D programs

This function creates a volume by a circular sweep of a surface about the


z-axis.

iSurface The ID number of the swept surface.

Angle Angle of the sweep.

INTEGRATED ENGINEERING SOFTWARE


58 INTEGRATED API Guide

VolNumber The ID number of the created volume.

iErr Error code*.

SweepSurface_AlongX
Geometry_SweepSurface_AlongX(int iSurface, double length, ref
int VolNumber, ref short iErr)

Applies to: 3D programs

This function creates a volume by a linear sweep of a surface parallel to


the x-axis.

iSurface The ID number of the swept surface

Length Length of the sweep.

VolNumber The ID number of the created volume.

iErr Error code*.

SweepSurface_AlongY
Geometry_SweepSurface_AlongY(int iSurface, double length, ref
int VolNumber, ref short iErr)

Applies to: 3D programs

This function creates a volume by a linear sweep of a surface parallel to


the y-axis.

iSurface The ID number of the swept surface

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 59

Length Length of the sweep.

VolNumber The ID number of the created volume.

iErr Error code*.

SweepSurface_AlongZ
Geometry_SweepSurface_AlongZ(int iSurface, double length, ref
int VolNumber, ref short iErr)

Applies to: 3D programs

This function creates a volume by a linear sweep of a surface parallel to


the z-axis.

iSurface The ID number of the swept surface

Length Length of the sweep.

VolNumber The ID number of the created volume.

iErr Error code*.

SweepSurface_Linear
Geometry_SweepSurface_Linear(int isurface, double x1, double y1,
double z1, double x2, double y2, double z2, int VolNumber, ref short
iErr)

Applies to: 3D programs

This function creates a volume by sweeping a surface about a defined


axis.

INTEGRATED ENGINEERING SOFTWARE


60 INTEGRATED API Guide

isurface The reference ID number of the surface.

x1, y1, z1 Numbers giving the x, y, z coordinates of the axis


starting point.

x2, y2, z2 Numbers giving the x, y, z coordinates of the axis


endpoint.

VolNumber The ID number of the created volume.

iErr Error code*.

HealOverlappingPlanarSurfaces_All
Geometry_HealOverlappingPlanarSurfaces_All(ref short iErr)

Applies to: 3D programs

Heals over lapping Planar Surfaces

iErr Error code*.

GEOMETRY2D
The documentation for this section is written for 2D programs.
When using Geometry2D functions in a 3D program you can
choose to be in 2D mode or 3D planar mode. On the
appropriate plane, the x-values documented below become u-
values and the y-values become v-values for the selected
working plane.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 61

AngularCopy
Geometry2D_AngularCopy(string sName, double xCenterAxis,
double yCenterAxis, double Angle, int NumberOfCopies, ref short
iErr)

Applies to: 2D Programs, 2D Mode, or 3D Planar Mode

This function creates copy of the named object rotated about an axis.

sName Name of the object to copy.

xCenterAxis x-coordinate of the axis of rotation.

yCenterAxis y-coordinate of the axis of rotation.

Angle Rotation angle to place the copy.

NumberOfCopies Number of times to rotate and make a copy.

iErr Error code*.

Create2DSpline
Geometry2D_Create2DSpline(object saXArr, object saYArr, ref int
SegNumber, ref short iErr)

Applies to: 2D Programs, 2D Mode, or 3D Planar Mode

This function creates an arc on a plane from the given center, radius, start
angle and end angle.

saXArr Array of x-coordinates of the spline, in the order


the points need to be drawn.

INTEGRATED ENGINEERING SOFTWARE


62 INTEGRATED API Guide

saYArr Array of y-coordinates of the spline, in the order


the points need to be drawn.

SegNumber ID number of the segment created.

iErr Error code*.

CreateArc_ByCenterRadiusAngles
Geometry2D_CreateArc_ByCenterRadiusAngles(double CntrX,
double CntrY, double Radius, double AngStart, double AngEnd,
ref int SegNumber, ref short iErr)

Applies to: 2D Programs, 2D Mode, or 3D Planar Mode

This function creates an arc on a plane from the given center, radius, start
angle and end angle.

CntrX Number giving the x-location of the arc center

CntrY Number giving the y-location of the arc center

Radius Number giving the radius of the arc

AngStart Number giving the start angle of the arc (standard


angle reference: counterclockwise from the x-axis)

AngEnd Number giving the end angle of the arc (standard


angle reference: counterclockwise from the x-axis)

SegNumber The reference ID number of the segment created

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 63

iErr Error code*.

CreateArc_By3Points
Geometry2D_CreateArc_By3Points(double StX, double StY,
double MidX, double MidY, double EndX, double EndY, ref int
SegNumber, ref short iErr)

Applies to: 2D Programs, 2D Mode, or 3D Planar Mode

This function creates an arc by 3 points.

StX, StY, StZ, MidX, MidY, MidZ, The coordinates of the start,
EndX, EndY, EndZ. middle and end points.

SegNumber The reference ID number of


the segment created

iErr Error code*.

CreateArc_ByStartEndCenterPoints
Geometry2D_CreateArc_ByStartEndCenterPoints(double StX,
double StY, double EndX, double EndY, double CntrX, double
CntrY, ref int SegNumber, ref short iErr)

Applies to: 2D Programs, 2D Mode, or 3D Planar Mode

This function creates an arc by start/center/end points.

StX, StY, StZ, CntrX, CntrY, The coordinates of the start,


CntrZ, EndX, EndY, EndZ. center and end points.

INTEGRATED ENGINEERING SOFTWARE


64 INTEGRATED API Guide

SegNumber The reference ID number of the


segment created

iErr Error code*.

CreateLine
Geometry2D_CreateLine(double x1, double y1, double x2,
double y2, ref int SegNumber, ref short iErr)

Applies to: 2D Programs, 2D Mode, or 3D Planar Mode

This function creates a straight line segment connecting two points.

x1 Number giving the x-location of the starting point

y1 Number giving the y-location of the starting point

x2 Number giving the x-location of the end point

y2 Number giving the y-location of the end point

SegNumber The reference ID number of the segment created

iErr Error code*.

2D_Displace
Geometry2D_Displace(string sName, double xDisplacement,
double yDisplacement, ref short iErr)

Applies to: 2D Programs, 2D Mode, or 3D Planar Mode

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 65

Displaces the named object by a specified amount in the x- and y-


directions.

sName Name of the object to displace.

xDisplacement Amount to displace in the x-direction.

yDisplacement Amount to displace in the y-direction.

iErr Error code*.

GetLinePointCoordinates
Geometry2D_GetLinePointCoordinates(int iSegment, double x1, double
y1, double x2, double y2, ref short iErr)

Applies to: 2D programs, 2D Mode, or 3D Planar Mode

Get the coordinates of the starting and end point.

isegment The reference ID number of the segment created.

x1, y1 Numbers giving the x and y coordinates of the


starting point.

x2, y2 Numbers giving the x and y coordinates of the end


point.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


66 INTEGRATED API Guide

GetArcPointCoordinates
Geometry2D_GetArcPointCoordinates(int iSegment, double x1, double
y1, double x2, double y2, double x3, double y3, ref short iErr)

Applies to: 2D programs, 2D Mode, or 3D Planar Mode

Get the coordinates of the starting, middle and end point.

isegment The reference ID number of the segment created.

x1, y1 Numbers giving the x and y coordinates of the


starting point.

x2, y2 Numbers giving the x and y coordinates of the


midpoint.

x3, y3 Numbers giving the x and y coordinates of the end


point.

iErr Error code*.

GetSegment_FromPoint
Geometry2D_GetSegment_FromPoint(double x, double y, int iSegment,
ref short iErr)

Applies to: 2D programs

Get point from line segment.

x, y Numbers giving the x, y coordinates of the point,

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 67

isegment The reference ID number of the segment.

iErr Error code*.

GetRegion_FromPoint
Geometry2D_GetRegionID_FromPoint(double x, double y, ref int
iRegionNumber)

Applies to: 2D Programs, 2D Mode

This function returns the ID number of the region around a point in 2D.

X Number giving the x-location of the starting point

Y Number giving the y-location of the starting point

iRegionNumber A string provided from your script providing the full


path and name of the file

iErr Error code*.

GetRegionID_FromSegments
Geometry2D_GetRegionID_FromSegments(Object
saArrOfSegments, ref int iRegionNumber, ref short iErr)

Applies to: 2D Programs, 2D Mode

This function returns the ID number of the region bounded by the set of
segments listed in the array. Not all bounding segments are needed, but
they need to uniquely define one region.

saArrOfSegments An array of segment numbers.

INTEGRATED ENGINEERING SOFTWARE


68 INTEGRATED API Guide

iRegionNumber The ID number of the identified region bounded by


the segment numbers.

iErr Error code*.

GetRegionOnLeft_FromSegment
Geometry2D_GetRegionOnLeft_FromSegment(int iSegment, ref
int iRegionNumber)

Applies to: 2D Programs, 2D Mode

This function returns the ID number of the region on the left side of a
segment specified by its ID number. The left side is specified according to
the direction in which the segment was drawn. For example, a vertical
segment drawn from (0, 0) to (0, 1) would have the negative x half-plane
on the left and the positive x half-plane on the right.

iSegment The ID number of the selected segment.

iRegionNumber The ID number of the identified region.

GetRegionOnRight_FromSegment
Geometry2D_GetRegionOnRight_FromSegment(int iSegment, ref
int iRegionNumber)

Applies to: 2D Programs, 2D Mode

This function returns the ID number of the region on the right side of a
segment specified by its ID number. The right side is specified according
to the direction in which the segment was drawn. For example, a vertical
segment drawn from (0, 0) to (0, 1) would have the negative x half-plane
on the left and the positive x half-plane on the right.

iSegment The ID number of the selected segment.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 69

iRegionNumber The ID number of the identified region.

LinearCopy
Geometry2D_LinearCopy(string sName, double xDisplacement,
double yDisplacement, int NumberOfCopies, ref short iErr)

Applies to: 2D Programs, 2D Mode, or 3D Planar Mode

This function creates copy of the named object displaced by a specified


amount in the x- and y-directions.

sName Name of the object to copy.

xDisplacement Amount of x-direction displacement for each copy.

yDisplacement Amount of y-direction displacement for each copy.

NumberOfCopies Number of times to displace and make a copy.

iErr Error code*.

Rotate
Geometry2D_Rotate(string sName, double xCenterAxis, double
yCenterAxis, double Angle, ref short iErr)

Applies to: 2D Programs, 2D Mode, or 3D Planar Mode

This function rotates the named object by an angle about a specified axis.

sName Name of the object to rotate.

xCenterAxis x-coordinate of the axis.

INTEGRATED ENGINEERING SOFTWARE


70 INTEGRATED API Guide

yCenterAxis y-coordinate of the axis.

Angle Angle of rotation.

iErr Error code*.

PHYSICS
AddCollectorsurface_ByNumber
Physics_AddCollectorSurface_ByNumber(string sCollectorName,
int SurfaceIdNumber, ref short iErr)

Applies to: 2D&3D Lorentz programs

Add surface to collector (Lorentz).

sCollectorName Name of the collector.

SurfaceIdNumber Surface ID number.

iErr Error code*.

AddEmissionPoint

Physics_AddEmissionPoint(string sEmitterName, double x, double y,


double z, double dirX, double dirY, double dirZ, double Radius, double
Energy, double Current, double StartTime, double StartDist, string
sParticleName, ref int PointNumber, ref short iErr)

Applies to: Lorentz programs

Add point to Discrete Point Emitter (Lorentz).

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 71

sEmitterName Name of the emitter.

x,y,z X,Y,Z point coordinates

dirX,dirY,dirZ X,Y,Z direction ( (0, 0, 1) etc.)

Energy Energy

startTime Start time

Radius Radius

Current Current

StartDist Start distance

sParticleName Particle Name

PointNumber Point number

iErr Error code*.

AddEmittersurface_ByNumber
Physics_AddEmitterSurface_ByNumber(string sEmitterName, int
SurfaceIdNumber, int SurfaceSideDirection, ref short iErr)

Applies to: 3D Lorentz programs

Add surface to emitter (Lorentz).

INTEGRATED ENGINEERING SOFTWARE


72 INTEGRATED API Guide

sEmitterName Emitter Name

SurfaceIdNumber Surface ID number.

SurfaceSideDirection Surface side direction (-1 or 1)

iErr Error code*.

AddParticle_ToLibrary
Physics_AddParticle_ToLibrary(string sParticleName, double
dCharge, double dMass, double dRadius, ref short iErr)

Applies to: Lorentz programs

Add particle to the Particle library (Lorentz).

sParticleName Name of the particle.

dCharge charge

dMass Mass

dRadius Radius

iErr Error code*.

CreatePointCharges
Physics_CreatePointCharges(object saXArr, object saYArr, object
saZArr, object saChargeArr, ref short iErr)

Applies to: 3D programs

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 73

Create point charges.

saXArr,saYArr,saZArr Arrays of corresponding X,Y,Z point


coordinates.

saChargeArr Array of charge at a point.

iErr Error code*.

CreatePointEmitter
Physics_CreatePointEmitter(string sEmitterName, ref short iErr)

Applies to: Lorentz programs

Create discrete point emitter (Lorentz).

sEmitterName Emitter name.

iErr Error code*.

CreateSurfaceCollector
Physics_CreateSurfaceCollector(string sCollectorName, ref short
iErr)

Applies to: 2D&3D LORENTZ programs

Create surface collector (Lorentz).

sCollectorName collector name.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


74 INTEGRATED API Guide

CreateSurfaceEmitter
Physics_CreateSurfaceEmitter(string sEmitterName, ref short iErr)

Applies to: 3D LORENTZ programs

Create surface emitter (Lorentz).

sEmitterName emitter name.

iErr Error code*.

CreateWaveGuideSource
Physics_CreateWaveGuideSource(int Type, int ModeType, int
ModeNo_m, int ModeNo_n, double VoltR, double VoltI, ref short
iErr)

Applies to: 3D High Frequency programs

Type Type of waveguide source:


1 - Rectangular
2 - circular
3 - coaxial

ModeType TE or TM setting
0 - TE
1 - TM

ModeNo_m & ModeNo_n The two standard mode numbers


(m, n) for the waveguide.

VoltR Real part of the waveguide voltage.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 75

VoltI Imaginary part of the waveguide


voltage.

iErr Error code*.

Delete2DBoundaryCondition
Physics_Delete2DBoundaryCondition(string sName, ref short
iErr)

Applies to: 2D programs

This function deletes any boundary condition assignments from the named
object.

sName Name of the object.

iErr Error code*.

Delete2DBoundaryCondition_BySegment
Physics_Delete2DBoundaryCondition_BySegment(int iSegment,
ref short iErr)

Applies to: 2D programs

This function deletes any boundary condition assignments from a segment


specified by its ID.

iSegment ID number of the segment.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


76 INTEGRATED API Guide

Delete2DMagnetization
Physics_Delete2DMagnetization(string sName, ref short iErr)

Applies to: 2D magnetic programs

This function deletes any magnetization assignments from the named


object.

sName Name of the object.

iErr Error code*.

Delete2DMagnetization_ByRegion
Physics_Delete2DMagnetization_ByRegion(int iRegion, ref short
iErr)

Applies to: 2D magnetic programs

This function deletes any magnetic assignments from the region identified
by its ID.

iRegion ID number of the region.

iErr Error code*.

Delete2DVoltage
Physics_Delete2DVoltage(string sName, ref short iErr)

Applies to: 2D electric programs

This function deletes any voltage assignments from the named object.

sName Name of the object.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 77

iErr Error code*.

Delete2DVoltage_BySegment
Physics_Delete2DVoltage_BySegment(int iSegment, ref short iErr)

Applies to: 2D electric programs

This function deletes any voltage assignments from the segment ID


number given.

iSegment ID number of the segment.

iErr Error code*.

Delete2DVolumeCurrent
Physics_Delete2DVolumeCurrent(string sName, ref short iErr)

Applies to: 2D magnetic programs

This function deletes any volume currents from the named object.

sName Name of the object.

iErr Error code*.

Delete2DVolumeCurrent_ByRegion
Physics_Delete2DVolumeCurrent_ByRegion(int iRegion, ref short
iErr)

Applies to: 2D magnetic programs

This function deletes any volume current from the given region ID.

INTEGRATED ENGINEERING SOFTWARE


78 INTEGRATED API Guide

iRegion Region ID number.

iErr Error code*.

DeleteMagnetization
Physics_DeleteMagnetization(string sName, ref short iErr)

Applies to: Magnetic programs

This function deletes any magnetization direction assignment from the


named object.

sName Object name.

iErr Error code*.

DeleteMagnetization_ByVolume
Physics_DeleteMagnetization_ByVolume(int iVolume, ref short
iErr)

Applies to: 3D magnetic programs

This function deletes any magnetization direction assignment from the


volume identified by ID number.

iVolume Volume ID number.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 79

DeletePointCharges
Physics_DeletePointCharges(ref short iErr)

Applies to: 3D electric programs

This function deletes point charges.

iErr Error code*.

DeleteVoltage
Physics_DeleteVoltage(string sName, ref short iErr)

Applies to: electric programs

This function deletes voltage from the named object.

sName Name of the object.

iErr Error code*.

DeleteVolatge_BySurface
Physics_DeleteVoltage_BySurface(int iSurface, ref short iErr)

Applies to: 3D electric programs

This function deletes voltage by surface.

iSurface Surface ID number.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


80 INTEGRATED API Guide

DeleteBoundaryCondition
Physics_DeleteBoundaryCondition(string sName, ref short iErr)

Applies to: All 3D programs

Deletes the object’s boundary condition.

sname Name of the object.

iErr Error code*.

DeleteBoundaryCondition_BySurface
Physics_DeleteBoundaryCondition_BySurface(int isurface, ref short iErr)

Applies to: All 3D programs

Deletes the surface boundary condition.

isurface The reference ID number of the surface.

iErr Error code*.

EditEmissionPoint
Physics_EditEmissionPoint(string sEmitterName, int PointNumber,
double x, double y, double z, double dirX, double dirY, double dirZ,
double Radius, double Energy, double Current, double StartTime, double
StartDist, string sParticleName, ref short iErr)

Applies to: Lorentz programs

This function Edit point in discrete Point Emitter(Lorentz).

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 81

sEmitterName Name of the emitter.

x,y,z X,Y,Z point coordinates

dirX,dirY,dirZ X,Y,Z direction ( (0, 0, 1) etc.)

Energy Energy

startTime Start time

Radius Radius

Current Current

PointNumber Point number

StartDist Start distance

sParticleName Particle name

iErr Error code*.

Get2DModelType
Physics_Get2DModelType(ref int ModelType2D, ref short iErr)

Applies to: 2D programs

This function returns the physical interpretation of the 2D geometry –


semi-infinite, x-rotational, or y-rotational.

INTEGRATED ENGINEERING SOFTWARE


82 INTEGRATED API Guide

ModelType2D Number giving model type:

0 – 2D (semi-infinite)
1 – x-rotational
2 – y-rotational

(note the same sequence as the settings appear


in the Physics Global Setup dialog)

iErr Error code*.

Get2DVoltage_BySegment
Physics_Get2DVoltage_BySegment(int iSegment, out short
isVoltageDefined, out double dVoltage, ref short iErr)

Applies to: 2D programs

This function gets constant voltage defined on a Segment.

iSegment ID of the segment

isVoltageDefined 1/0 is constant voltage defined on the segment


Yes/no.

dVoltage The static Voltage defined.

iErr Error code*.

GetBackgroundPermittivity
Physics_GetBackgroundPermittivity(ref double dRelPermittRe, ref
double dRelPermittIm, ref short iErr)

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 83

Applies to: All programs

This function returns the value of the relative permittivity of the


Background material.

dRelPermittRe Number giving the real part of the permittivity.

dRelPermittIm Number giving the imaginary part of the


permittivity.

iErr Error code*.

GetMaterialByIndex
Physics_GetMaterialByIndex(int Idx, ref string sMaterialName, ref
int iNumOfMaterials, ref short iErr)

Applies to: All programs

This function gets material by index.

Idx Index

sMaterialName Name of the material.

iNumOfMaterials Number of materials.

iErr Error code*.

GetMaterialConductivity
Physics_GetMaterialConductivity(string sMatName, ref double
dConductivity, ref short iErr)

INTEGRATED ENGINEERING SOFTWARE


84 INTEGRATED API Guide

Applies to: All programs

This function returns the value of the electrical conductivity of the named
material in the model.

sMatName Name of the material.

dConductivity Electrical conductivity of the material.

iErr Error code*.

GetMaterialList
Physics_GetMaterialList(ref System.Array saMaterials)

Applies to: All programs

This function returns an array listing the names of all materials in the
model. Use GetMaterialList for VisualStudio. For Excel and Matlab use
GerMaterialList2

saMaterials A string array of the names of materials in the


model.

GetMaterialList2
Physics_GetMaterialList2(out object saMaterials)

Applies to: All programs

Use GetMaterialList2 for Excel and Matlab. For VisualStudio use


GetMaterialList.

saMaterials A string object of the names of materials in the


model.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 85

GetMaterialPermeability
Physics_GetMaterialPermeability(string sMatName, ref double
dRelPermeabRe, ref double dRelPermeabIm, ref short iErr)

Applies to: All programs

This function returns the permeability of a specified material name.

sMatName The name of the material.

dRelPermeabRe Number giving the real part of the permeability.

dRelPermeabIm Number giving the imaginary part of the


permeability.

iErr Error code*.

GetMaterialPermittivity
Physics_GetMaterialPermittivity(string sMatName, ref double
dRelPermittRe, ref double dRelPermittIm, ref short iErr)

Applies to: All programs

This function returns the permittivity of a specified material name.

sMatName The name of the material.

dRelPermittRe Number giving the real part of the permittivity.

dRelPermittIm Number giving the imaginary part of the


permittivity.

INTEGRATED ENGINEERING SOFTWARE


86 INTEGRATED API Guide

iErr Error code*.

GetMaterialThermalConductivity
Physics_GetMaterialThermalConductivity(string sMatName, ref
double dConductivity, ref short iErr)

Applies to: All programs

This function returns the thermal conductivity of a specified material name.

sMatName The name of the material.

dConductivity Number giving the thermal conductivity.

iErr Error code*.

MovePointCharges
Physics_MovePointCharges(object saXArr, object saYArr, object
saZArr, ref short iErr)

Applies to: 3D Electric programs

This function moves point charges.

saXArr,saYArr,saZArr Array of new X,Y,Z coordinates.

iErr Error code*.

Set2DFloating
Physics_Set2DFloating(string sName, int iFloatingNumber, ref
short iErr)

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 87

Applies to: 2D Electric programs

This function sets a floating reference number to the named object.

sName The name of the object.

iFloatingNumber Floating reference number.

iErr Error code*.

Set2DFloating_BySegment
Physics_Set2DFloating_BySegment(int iSegment, int
iFloatingNumber, ref short iErr)

Applies to: 2D Electric programs

This function sets a floating reference number to the segment specified by


its ID number.

iSegment ID number of the segment.

iFloatingNumber Floating reference number.

iErr Error code*.

Set2DLinearVoltage_BySegment
Physics_Set2DLinearVoltage_BySegment(int iSegment, double
dBC_st, double dBC_fi, ref short iErr)

Applies to: 2D Electric programs

Assigns a linear voltage variation to a segment identified by ID number by


assigning the end voltages to the “start” and “finish” points. These points

INTEGRATED ENGINEERING SOFTWARE


88 INTEGRATED API Guide

are defined by the order in which the points were drawn when the
geometry was created.

iSegment ID number of the segment.

dBC_st Voltage at the starting point.

dBC_fi Voltage at the finish point.

iErr Error code*.

Set2DMagnetizationAngle
Physics_Set2DMagnetizationAngle(string sName, double dAngle,
ref short iErr)

Applies to: 2D magnetic programs

This function sets the magnetization direction for the named object by
specifying an angle relative to the x-axis.

sName Name of the object.

dAngle Angle of the magnetization, counter clockwise


from the x-axis.

iErr Error code*.

Set2DMagnetizationAngle_ByRegion
Physics_Set2DMagnetization_ByRegion (int iRegion, double
dAngle, ref short iErr)

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 89

Applies to: 2D magnetic programs

This function sets the magnetization direction for the object ID by


specifying an angle relative to the x-axis

iRegion ID number of the region.

dAngle Angle of the magnetization, counter clockwise


from the x-axis.

iErr Error code*.

Set2DModelType
Physics_Set2DModelType(int NewModelType2D, ref short iErr)

Applies to: 2D programs

This function sets the physical interpretation of the 2D geometry – semi-


infinite, x-rotational, or y-rotational.

NewModelType2D Number giving model type:

0 – 2D (semi-infinite)
1 – x-rotational
2 – y-rotational

(note the same sequence as the settings appear


in the Physics Global Setup dialog)

iErr Error code*.

Set2DTemperature
Physics_Set2DTemperature(string sName, double dBC, ref short
iErr)

INTEGRATED ENGINEERING SOFTWARE


90 INTEGRATED API Guide

Applies to: 2D thermal programs

This function sets the temperature of the specified object name.

sName The name of the object to be assigned a voltage.

dBC The temperature to assign.

iErr Error code*.

Set2DTemperature_BySegment
Physics_Set2DTemperature_BySegment(int iSegment, double
dBC, ref short iErr)

Applies to: 2D thermal programs

This function sets the temperature of a segment specified by its ID


number.

iSegment Number giving the ID of the object to be assigned


a voltage.

dBC The temperature to assign.

iErr Error code*.

Set2DVoltage
Physics_Set2DVoltage(string sName, double dBC, ref short iErr)

Applies to: 2D electric programs (ELECTRO based)

This function sets the voltage on the specified object name.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 91

sName The name of the object to be assigned a voltage.

dBC The (static) voltage to assign.

iErr Error code*.

Set2DVoltage_BySegment
Physics_Set2DVoltage_BySegment(int iSegment, double dBC, ref
short iErr)

Applies to: 2D electric programs (ELECTRO solver)

This function sets the voltage on a segment specified by its ID number.

iSegment Number giving the ID of the object to be assigned


a voltage.

dBC The (static) voltage to assign.

iErr Error code*.

Set2DVoltageMagnitudePhase
Physics_Set2DVoltageMagnitudePhase(string sName, double
dBC, double dPhase, ref short iErr)

Applies to: 2D electric programs (ELECTRO solver)

This function sets magnitude and phase of voltage for the named object.
In static model the phase is ignored.

INTEGRATED ENGINEERING SOFTWARE


92 INTEGRATED API Guide

sName Name of the object.

dBC Voltage magnitude to assign to the object.

dPhase Phase of the voltage.

iErr Error code*.

Set2DVoltageMagnitudePhase_BySegment
Physics_Set2DVoltageMagnitudePhase_BySegment(int
iSegment, double dBC, double dPhase, ref short iErr)

Applies to: 2D electric programs (ELECTRO solver)

This function sets magnitude and phase of voltage for the referenced
object ID. In static models the phase is ignored.

iSegment Number giving the ID of the object to be assigned


a voltage.

dBC Voltage magnitude to assign to the object.

dPhase Phase of the voltage.

iErr Error code*.

Set2DVolumeCurrent
Physics_Set2DVolumeCurrent(string sName, double dVC, ref
short iErr)

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 93

Applies to: 2D magnetic programs (MAGNETO or OERSTED solver)

This function assigns volume current to the named object.

sName Name of the object.

dVC Value of the current to assign.

iErr Error code*.

Set2DVolumeCurrent_ByRegion
Physics_Set2DVolumeCurrent_ByRegion(int iRegion, double
dVC, ref short iErr)

Applies to: 2D magnetic programs (MAGNETO or OERSTED solver)

This function assigns volume current to the referenced region ID.

iRegion Number giving the ID of the region to be assigned


the current.

dVC Value of the current to assign.

iErr Error code*.

Set2DVolumeCurrentMagnitudePhase
Physics_Set2DVolumeCurrentMagnitudePhase(string sName,
double dVC, double dPhase, ref short iErr)

Applies to: 2D magnetic programs (MAGNETO or OERSTED solver)

This function assigns volume current magnitude and phase to the named
object. In static models the phase is ignored.

INTEGRATED ENGINEERING SOFTWARE


94 INTEGRATED API Guide

sName Number giving the ID of the object to be assigned


a voltage.

dVC Magnitude of the current to assign.

dPhase Phase of the current to assign.

iErr Error code*.

Set2DVolumeCurrentMagnitudePhase_ByRegion
Physics_Set2DVolumeCurrentMagnitudePhase_ByRegion(int
iRegion, double dVC, double dPhase, ref short iErr)

Applies to: 2D magnetic programs (MAGNETO or OERSTED solver)

This function assigns volume current magnitude and phase to the


referenced object ID. In static models the phase is ignored.

iRegion Number giving the ID of the region to be assigned


a voltage.

dBC Magnitude of the current to assign.

dPhase Phase of the current to assign.

iErr Error code*.

Set2DVolumeHeat
Physics_Set2DVolumeHeat(string sName, double dVHeat, ref
short iErr)

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 95

Applies to: 2D thermal programs

This function assigns volume heat to the named object.

sName Name of the object.

dVHeat Total power applied to the object as a heat source.

iErr Error code*.

Set2DVolumeHeat_ByRegion
Physics_Set2DVolumeHeat_ByRegion(int iRegion, double
dVHeat, ref short iErr)

Applies to: 2D thermal programs

This function assigns volume heat to the region identified by its ID


number.

iRegion Number giving the ID of the region to be assigned


a voltage.

dVHeat Total power applied to the object as a heat source.

iErr Error code*.

SetFloating
Physics_SetFloating(string sName, int ifloatingNumber, ref short iErr)

Applies to: 3D electric programs

This function sets a floating reference to the named object.

INTEGRATED ENGINEERING SOFTWARE


96 INTEGRATED API Guide

sname Name of the object.

ifloatingNumber Floating reference number.

iErr Error code*.

SetFloating_BySurface
Physics_SetFloating_BySurface(int isurface, int ifloatingNumber, ref short
iErr)

Applies to: 3D electric programs

This function sets a floating reference to a defined surface.

isurface ID number of surface.

ifloatingNumber Floating reference number.

iErr Error code*.

SetBackgroundPermittivity
Physics_SetBackgroundPermittivity(double dRelPermittRe,
double dRelPermittIm, ref short iErr)

Applies to: All programs

This function sets the value of the relative permittivity of the Background
material.

dRelPermittRe Number giving the real part of the permittivity.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 97

dRelPermittIm Number giving the imaginary part of the


permittivity.

iErr Error code*.

SetBalanced
Physics_SetBalanced()

Applies to: Electric and Magnetic programs

Sets Balanced mode in Physics Global Setup.

SetCongruentMagnet_ByVolume
Physics_SetCongruentMagnet_ByVolume(int iVolume, int
iSurface, ref short iErr)

Applies to: 3D magnetic programs

Assigns a congruent magnetization – B direction follows a 6-sided volume


starting at the reference surface.

iVolume Volume ID number to be assigned magnetization.

iSurface Reference surface ID number.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


98 INTEGRATED API Guide

SetEmissionRegimeTo_EnhancedFowlerNordheim
Physics_SetEmissionRegimeTo_EnhancedFowlerNordheim(strin
g sEmitterName, double dWorkFunc, double dBeta, double dAlfa,
ref short iErr)

Applies to: Lorentz programs

Set Emission Regime to "Enhanced Fowler-Nordheim" mode(Lorentz).

sEmitterName Name of the Emitter

dWorkFunc Work Function

dBeta Beta

dAlfa Alfa

iErr Error code*.

SetEmissionRegimeToExtendedSchottky
Physics_SetEmissionRegimeTo_ExtendedSchottky(string
sEmitterName, double dWorkFunc, double dTemperature, double
dA, ref short iErr)

Applies to: Lorentz programs

Set (reinitialize) Emission Regime to "Extended-Schottky" mode(Lorentz).

sEmitterName Name of the Emitter

dWorkFunc Work Function

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 99

dTemperature Temperature

dA dA

iErr Error code*.

SetEmissionRegimeToFowlerNordheim
Physics_SetEmissionRegimeTo_FowlerNordheim(string
sEmitterName, double dWorkFunc, ref short iErr)

Applies to: Lorentz programs

Set (reinitialize) Emission Regime to "Fowler-Nordheim" mode(Lorentz).

sEmitterName Name of the Emitter

dWorkFunc Work Function

iErr Error code*.

SetEmissionRegimeTo_I
Physics_SetEmissionRegimeTo_I(string sEmitterName, double I,
ref short iErr)

Applies to: Lorentz programs

Set (reinitialize) Emission Regime to "Current" mode(Lorentz).

sEmitterName Name of the Emitter

INTEGRATED ENGINEERING SOFTWARE


100 INTEGRATED API Guide

I Current

iErr Error code*.

SetEmissionRegimeTo_J
Physics_SetEmissionRegimeTo_J(string sEmitterName, double J,
ref short iErr)

Applies to: 3D magnetic programs

Set Emission Regime to Current density mode(Lorentz).

sEmitterName Name of the Emitter

J Current density

iErr Error code*.

SetEmissionRegimeTo_RichardsonDushman
Physics_SetEmissionRegimeTo_RichardsonDushman(string
sEmitterName, double dWorkFunc, double dTemperature, double
dA, ref short iErr)

Applies to: Lorentz programs

Set Emission Regime to Richardson Dushman mode(Lorentz).

sEmitterName Name of the Emitter

dWorkFunc Work Function

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 101

dTemperature Temperature

dA dA

iErr Error code*.

SetEmissionRegimeTo_Schottky
Physics_SetEmissionRegimeTo_Schottky(string sEmitterName,
double dWorkFunc, double dTemperature, double dA, ref short
iErr)

Applies to: Lorentz programs

Set Emission Regime to Schottky mode (Lorentz).

sEmitterName Name of the Emitter

dWorkFunc Work Function

dTemperature Temperature(Temperature Unit: C)

dA dA

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


102 INTEGRATED API Guide

SetEmissionRegimeTo_ChildsLaw
Physics_SetEmissionRegimeTo_ChildsLaw(string sEmitterName,
short iGapMode, double dGapRate, double dUserGapSize, ref short
iErr)

Applies to: Lorentz programs

Set Emission Regime to "Child Law" mode (Lorentz).

sEmitterName Name of the Emitter

iGapMode Gap Mode(0 - Relative Size(parameter:


dGapRate), 1 - Direct Size(parameter:
dUserGapSize))

dGapRate Gap Rate

dUserGapSize User Gap Size

iErr Error code*.

SetEmitterColor
Physics_SetEmitterColor(string sEmitterName, short iRedValue,
short iGreenValue, short iBlueValue, ref short iErr)

Applies to: Lorentzc programs

Set Emitter color (Lorentz).

sEmitterName Name of the Emitter

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 103

iRedValue Red component Value(range: 0-255)

iGreenValue green component Value(range: 0-255)

iBlueValue blue component Value(range: 0-255)

iErr Error code*.

SetEmitterParticle
Physics_SetEmitterParticle(string sEmitterName, string
sParticleName, ref short iErr)

Applies to: 3D magnetic programs

Set Emitter Particle mode (Lorentz).

sEmitterName Name of the Emitter

sParticleName Name of the Particle.

iErr Error code*.

SetLineCurrent_BySegment
Physics_SetLineCurrent_BySegment(int iSegment, int iDirection,
double dCurrent, ref short iErr)

Applies to: 3D Magnetic programs

Assigns line current to the segment specified by its ID number. Intended


for static solutions, the phase will be assumed as 0 if this function is used
in phasor mode.

INTEGRATED ENGINEERING SOFTWARE


104 INTEGRATED API Guide

iSegment Name of the object to be assigned material.

iDirection Direction of the current flow.


1: flows in the direction the segment was drawn
-1: opposite direction as the segment was drawn.

dCurrent Value of the current.

iErr Error code*.

SetLineCurrentMagnitudePhase_BySegment
Physics_SetLineCurrentMagnitudePhase_BySegment(int
iSegment, int iDirection, double dCurrentMag, double
dCurrentPhase, ref short iErr)

Applies to: 3D magnetic programs

Assigns line current magnitude and phase to the segment specified by its
ID number.

iSegment Name of the object to be assigned material.

iDirection Direction of the current flow.


1: flows in the direction the segment was drawn
-1: opposite direction as the segment was drawn.

dCurrent RMS Magnitude of the current.

dCurrentPhase Phase angle of the current.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 105

SetMagnetizationDirection
Physics_SetMagnetizationDirection(string sName, double dirX,
double dirY, double dirZ, ref short iErr)

Applies to: 3D magnetic programs

This function assigns a magnetization direction to the named object.

sName Name of the object to be assigned material.

dirX, dirY and dirZ The components of the magnetization in the x-, y-
and z-directions.

iErr Error code*.

SetMagnetizationDirection_ByVolume
Physics_SetMagnetizationDirection_ByVolume(int iVolume,
double dirX, double dirY, double dirZ, ref short iErr)

Applies to: 3D magnetic programs

This function assigns a magnetization direction to a volume specified by


its ID number.

iVolume ID number of the volume.

dirX, dirY and dirZ The components of the magnetization in the x-, y-
and z-directions.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


106 INTEGRATED API Guide

SetMaterial
Physics_SetMaterial(string sObjName, string sMaterial, ref short
iErr)

Applies to: All programs

Assigns a material to the named object.

sObjName Name of the object to be assigned material.

sMaterial Name of the material to assign.

iErr Error code*.

SetMaterial_ByRegion
Physics_SetMaterial_ByRegion(int iRegion, string sMaterial, ref
short iErr)

Applies to: All 2D programs

Assigns material to a region using its ID number.

iRegion Number giving ID of the region.

sMaterial Name of the material to assign.

iErr Error code*.

SetMaterial_ByVolume
Physics_SetMaterial_ByVolume(int iVolume, string sMaterial, ref
short iErr)

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 107

Applies to: All 3D programs

Assigns material to a volume using its ID number.

iVolume Number giving ID of the volume.

sMaterial Name of the material to assign.

iErr Error code*.

SetMaterialConductivity
Physics_SetMaterialConductivity(string sMatName, double
dConductivity, ref short iErr)

Applies to: All programs

This function sets the value of the electric conductivity of the chosen by
material name.

sMatName Name of the material.

dConductivity Number giving the electrical conductivity.

iErr Error code*.

SetMaterialPermeability
Physics_SetMaterialPermeability(string sMatName, double
dRelPermeabRe, double dRelPermeabIm, ref short iErr)

Applies to: All programs

This function sets the value of the relative permeability of the chosen by
material name.

INTEGRATED ENGINEERING SOFTWARE


108 INTEGRATED API Guide

sMatName Name of the material.

dRelPermeabRe Number giving the real part of the permeability.

dRelPermeabIm Number giving the imaginary part of the


permeability.

iErr Error code*.

SetMaterialPermittivity
Physics_SetMaterialPermittivity(string sMatName, double
dRelPermittRe, double dRelPermittIm, ref short iErr)

Applies to: All programs

This function sets the value of the relative permittivity of the chosen by
name.

sMatName Name of the material.

dRelPermittRe Number giving the real part of the permittivity.

dRelPermittIm Number giving the imaginary part of the


permittivity.

iErr Error code*.

SetMaterialThermalConductivity
Physics_SetMaterialThermalConductivity(string sMatName,
double dConductivity, ref short iErr)

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 109

Applies to: All programs

This function sets the value of the thermal conductivity of the chosen by
material name.

sMatName Name of the material.

dConductivity Number giving the thermal conductivity.

iErr Error code*.

SetNumberEmissionPoints
Physics_SetNumberEmissionPoints(string sEmitterName, int
numPointsReq, ref int numPointsAct, ref short iErr)

Applies to: All programs

This function sets number of emission points.

sMatName Name of the material.

numPointsReq Number of Emission Points requested.

numPointsAct Actual number of emission points.

iErr Error code*.

SetPerfectLineConductor_BySegment
Physics_SetPerfectLineConductor_BySegment(int iSegment,
double Radius, ref short iErr)

INTEGRATED ENGINEERING SOFTWARE


110 INTEGRATED API Guide

Applies to: SINGULA

This function sets a perfect line conductor condition to a segment selected


by its ID number.

iSegment ID number of the segment.

Radius Radius of the wire represented by the segment.

iErr Error code*.

SetPerfectSurfaceConductor_BySurface
Physics_SetPerfectSurfaceConductor_BySurface(int iSurface, ref
short iErr)

Applies to: SINGULA

This function sets a perfect surface conductor condition to a surface


specified by its ID number.

iSurface ID number of the surface.

iErr Error code*.

SetPerfectVolumeConductor_ByVolume
Physics_SetPerfectVolumeConductor_ByVolume(int iVolume, ref
short iErr)

Applies to: SINGULA

This function sets a perfect volume conductor condition to a volume


specified by its ID number.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 111

iVolume ID number of the volume.

iErr Error code*.

SetPhasorMode
Physics_SetPhasorMode(double dFreq)

Applies to: All electric and magnetic programs

This function sets the Physics mode to phasor at the specified frequency.

dFreq Frequency for the model.

SetPointChargeSize
Physics_SetPointChargesSize(double dSize, ref short iErr)

Applies to: 3D electric programs

This function define a size for all point charges.

Dsize Size.

iErr Error code*.

SetRectangularWaveGuideSource
Physics_SetRectangularWaveGuideSource(int Surface, int Side,
int iSegment, int iNode, ref short iErr)

Applies to: SINGULA

This function assigns a waveguide source created with


Physics_CreateWaveGuideSource

INTEGRATED ENGINEERING SOFTWARE


112 INTEGRATED API Guide

Surface ID number of the surface to be assigned the


source.

Side 0 or 1 to pick the side of the surface to apply the


source.

iSegment ID number of a segment in parallel to the “m”


number of the (m,n) mode.

iNode End point of the segment for the direction of “m”.


0 – first point drawn
1 – second point drawn

Visually check the side and direction assignments interactively


by opening the waveguide setup and zooming in on the
surface.

SetStaticMode
Physics_SetStaticMode()

Applies to: All programs except CHRONOS and SINGULA

This function sets the Physics mode to static (no time dependence in the
sources).

SetUnbalanced
Physics_SetUnbalanced()

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 113

Applies to: Electric and Magnetic programs

This function sets the balanced switch in Physics Global Setup to


unbalanced.

SetVoltage
Physics_SetVoltage(string sName, double dBC, ref short iErr)

Applies to: All electric programs

This function sets the voltage on the specified object name.

sName The name of the object to be assigned a voltage.

dBC The static voltage to assign.

iErr Error code*.

SetVoltageBysurface
Physics_SetVoltage_BySurface(int iSurface, double dBC, ref short
iErr)

Applies to: All electric programs

This function sets the voltage by surface on the specified object name.

iSurface Surface

dBC The static voltage to assign.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


114 INTEGRATED API Guide

SetVoltageMagnitudePhase
Physics_SetVoltageMagnitudePhase(string sName, double dBC,
double dPhase, ref short iErr)

Applies to: All electric programs

This function sets the voltage magnitude and phase.

sName Name of the object.

dBC The static voltage to assign.

dPhase The phase.

iErr Error code*.

SetVoltageMagnitudePhase_BySurface
Physics_SetVoltageMagnitudePhase_BySurface(int iSurface,
double dBC, double dPhase, ref short iErr)

Applies to: All electric programs

This function sets the voltage magnitude and phase by surface ID.

iSurface ID number of the surface.

dBC The static voltage to assign.

dPhase The phase.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 115

SetVolumeCharge
Physics_SetVolumeCharge(string sName, double Charge, ref
short iErr)

Applies to: 3D electric programs

This function sets the volume charge.

sName Name of the object.

Charge The static charge to assign.

iErr Error code*.

SetVolumeCharge_ByVolume
Physics_SetVolumeCharge_ByVolume(int iVolume, double
Charge, ref short iErr)

Applies to: All electric and magnetic programs

This function sets the volume charge by volume.

iVolume ID of the volume to be assigned charge.

Charge The static charge to assign.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


116 INTEGRATED API Guide

SetVolumeCurrent_ByVolume
Physics_SetVolumeCurrent_ByVolume(int iVolume, int iSurface,
double dCurrent, ref short iErr)

Applies to: 3D magnetic programs

This function assigns volume current to the 6-sided volume specified by ID


entering through a surface specified by ID.

iVolume ID number of the volume.

iSurface ID number of the surface where the current enters.

dCurrent Magnitude of the current to assign.

iErr Error code*.

SetVolumeCurrentMagnitudePhase_ByVolume
Physics_SetVolumeCurrentMagnitudePhase_ByVolume(int
iVolume, int iSurface, double dCurrentMag, double dCurrentPhase,
ref short iErr)

Applies to: 3D magnetic programs

This function assigns volume current RMS magnitude and phase to the 6-
sided volume specified by ID entering through a surface specified by ID.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 117

iVolume ID number of the volume.

iSurface ID number of the surface where the current


enters.

dCurrentMag RMS magnitude of the current to assign.

dCurrentPhase Phase of the current to assign.

iErr Error code*.

SOLUTION
RunSolver
Solution_RunSolver(ref short iErr)

Applies to: All programs

This function runs the solver for the current configuration.

iErr Error code*.

RefineSolution
Solution_Refine(ref short iErr)

Applies to: All programs

This function runs the solver for the current configuration.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


118 INTEGRATED API Guide

DeleteSolution
Solution_DeleteSolution(ref short iErr)

Applies to: All programs

This function deletes current solution.

iErr Error code*.

SetODE_ToRK4
Solution_SetODE_ToRK4(double dTimeInterval, int iNumSteps, ref
short iErr)

Applies to: Lorentz programs

This function sets the ODE solver type to RK4.

dTimeInterval Time interval for each step.

iNumSteps Number of time steps.

iErr Error code*.

SetODE_ToRK5
Solution_SetODE_ToRK5(int iMaxSteps, double dAccuracy, short
iMaxDeltaFlag, double dMaxDelta, short iMinDeltaFlag, double
dMinDelta, ref short iErr)

Applies to: Lorentz programs

This function sets the ODE solver type to RK5.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 119

iMaxSteps Maximum number of time steps.

dAccuracy Relative error.

iMaxDeltaFlag To use (1) or Not to use (0) max. time step.

dMaxDelta Maximum time step.

iMinDeltaFlag To use (1) or Not to use (0) min. time step.

dMinDelta Minimum time step.

iErr Error code*.

SetODE_ToRK853
Solution_SetODE_ToRK853(int iMaxSteps, double dAccuracy, short
iMaxDeltaFlag, double dMaxDelta, short iMinDeltaFlag, double
dMinDelta, ref short iErr)

Applies to: Lorentz programs

This function sets the ODE solver type to RK853.

iMaxSteps Maximum number of time steps.

dAccuracy Relative error.

iMaxDeltaFlag To use (1) or Not to use (0) max. time step.

INTEGRATED ENGINEERING SOFTWARE


120 INTEGRATED API Guide

dMaxDelta Maximum time step.

iMinDeltaFlag To use (1) or Not to use (0) min. time step.

dMinDelta Minimum time step.

iErr Error code*.

SetODE_ToBulirschStoer
Solution_SetODE_ToBulirschStoer(int iMaxSteps, double dAccuracy,
short iMaxDeltaFlag, double dMaxDelta, short iMinDeltaFlag, double
dMinDelta, ref short iErr)

Applies to: Lorentz programs

This function sets the ODE solver type to Bulirsch Stoer.

iMaxSteps Maximum number of time steps.

dAccuracy Relative error.

iMaxDeltaFlag To use (1) or Not to use (0) max. time step.

dMaxDelta Maximum time step.

iMinDeltaFlag To use (1) or Not to use (0) min. time step.

dMinDelta Minimum time step.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 121

SetMeshSegmentWeight
Solution_SetMeshSegmentWeight(int iSegment, double dWeight,
ref short iErr)

Applies to: 2D programs

This function sets the priority weighting of a segment. The higher the
number is, the higher priority the solver will assign the segment when
assigning or refining elements.

iSegment ID number of the segment.

dWeight Number giving the priority.

iErr Error code*.

MESH
AssignTriangular_AutomaticAll
Mesh_AssignTriangular_AutomaticAll(int numElements, ref short
iErr)

Applies to: 3D Programs

This function assigns triangular elements automatically.

numElements Number of elements required

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


122 INTEGRATED API Guide

AssignTriangular_AutomaticLocal
Mesh_AssignTriangular_AutomaticLocal(string sName, int
numElements, ref short iErr)

Applies to: 3D Programs

This function assigns triangular elements locally.

sName Name of elements

numElements Number of elements required.

iErr Error code*.

AssignTetrahedral_AutomaticAll
Mesh_AssignTetrahedral_AutomaticAll(int numElements, ref short iErr)

Applies to: 3D programs

This function assigns tetrahedral elements automatically.

numElements Number of elements required.

iErr Error code*.

AssignTetrahedral_AutomaticLocal
Mesh_AssignTetrahedral_AutomaticLocal(string sName, int
numElements, ref short iErr)

Applies to: 3D programs

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 123

This function assigns tetrahedral elements locally.

sname Name of the elements.

numElements Number of elements required.

iErr Error code*.

AssignQuadrilateral_AutomaticAll
Mesh_AssignQuadrilateral_AutomaticAll(int numElements, ref short iErr)

Applies to: 2D programs

This function assigns quadrilateral elements automatically.

numElements Number of elements required.

iErr Error code*.

AssignQuadrilateral_AutomaticLocal
Mesh_AssignQuadrilateral_AutomaticLocal(string sName, int
numElements, ref short iErr)

Applies to: 2D programs

This function assigns quadrilateral elements locally.

sname Name of the elements.

INTEGRATED ENGINEERING SOFTWARE


124 INTEGRATED API Guide

numElements Number of elements required.

iErr Error code*.

AssignTriangular_BySurface
Mesh_AssignTriangular_BySurface(int iSurface, int numElements,
ref short iErr)

Applies to: 3D Programs

This function assigns triangular elements to surface.

iSurface Surface ID.

numElements Number of elements required

iErr Error code*.

DeleteVolume_MeshAll
Mesh_DeleteVolumeMesh_All(ref short iErr)

Applies to: 3D Programs

This function deletes all 3D volume mesh.

iErr Error code*.

SetMinimumVolumeMesh_OFF
Mesh_SetMinimumVolumeMesh_OFF(ref short iErr)

Applies to: 3D Programs

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 125

This function set minimum 3D volume mesh off.

iErr Error code*.

SetMinimumVolumeMesh_ON
Mesh_SetMinimumVolumeMesh_ON(ref short iErr)

Applies to: 3D Programs

This function set minimum 3D volume mesh on.

iErr Error code*.

SetSegmentWeight
Mesh_SetSegmentWeight(int iSegment, double dWeight, ref
short iErr)

Applies to: 3D Programs

Mesh Set Segment Weight. This function sets the priority weighting of a
segment. The higher the number is, the higher priority the solver will
assign the segment when assigning or refining elements

iSegment ID number of the segment.

dWeight The weight (number giving the priority).

iErr Error code*.

SetSurfaceWeight
Mesh_SetSurfaceWeight(int iSurface, double dWeight, ref short
iErr)

INTEGRATED ENGINEERING SOFTWARE


126 INTEGRATED API Guide

Applies to: 3D Programs

Mesh Set Surface Weight. This function sets the priority weighting of a
surface. The higher the number is, the higher priority the solver will assign
the surface when assigning or refining elements.

iSurface ID number of the surface.

dWeight The weight (number giving the priority).

iErr Error code*.

SetVolumeWeight
SetVolumeWeight(int iVolume, double dWeight, ref short iErr)

Applies to: 3D Programs

Mesh Set Volume Weight. This function sets the priority weighting of a
volume. The higher the number is, the higher priority the solver will assign
the volume when assigning or refining elements.

iVolume ID number of the volume.

dWeight The weight (number giving the priority).

iErr Error code*.

2D_SetRegionWeight
Mesh2D_SetRegionWeight(int iRegion, double dWeight, ref short
iErr)

Applies to: 2D Programs

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 127

Mesh2D Set Region Weight. This function sets the priority weighting of a
Region. The higher the number is, the higher priority the solver will assign
the Region when assigning or refining elements

iRegion ID number of the region.

dWeight The weight (number giving the priority).

iErr Error code*.

ANALYSIS
Create2DElectricStreamlines
Analysis_Create2DElectricStreamlines(string sName, short
LinePerSeg, ref short iErr)

Applies to: 2D electric programs

This function creates 2D electric streamline.

sName The name of the object

LinePerSeg The lines per segment. The range 3-256.

iErr Error code*.

Create2DElectricStreamlines_FromPoint
Analysis_Create2DElectricStreamlines_FromPoint(double x,
double y, ref short iErr)

INTEGRATED ENGINEERING SOFTWARE


128 INTEGRATED API Guide

Applies to: 2D electric programs

This function shows the electric streamline from a specified point in space.

x x-coordinate of the point.

y y-coordinate of the point.

iErr Error code*.

Create2DElectricStreamlines_FromSegments
Analysis_Create2DElectricStreamlines_FromSegments(Object
saArrOfElems, short LinesPerSeg, ref short iErr)

Applies to: 2D electric programs (ELECTRO solver)

This function shows electric streamlines from a group of segments


specified by an array of segment ID numbers.

saArrOfElems Array of segment ID numbers.

LinePerSeg Number of streamlines from each segment.

iErr Error code*.

Create2DStreamlines
Analysis_Create2DElectricStreamlines(string sName, short
LinePerSeg, ref short iErr)

Applies to: 2D electric programs

This function creates 2D streamline.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 129

sName The name of the object

LinePerSeg The lines per segment. The range 3-256.

iErr Error code*.

Create2DStreamlines_FromPoint
Analysis_Create2DStreamlines_FromPoint(double x, double y,
ref short iErr)

Applies to: 2D programs

This function shows the streamline from a specified point in space.

x x-coordinate of the point.

y y-coordinate of the point.

iErr Error code*.

CreateStreamlines_FromPoint
Analysis_CreateStreamlines_FromPoint(double x, double y,
double z, ref short iErr)

Applies to: 3D programs

This function shows the streamline from a specified point in space.

x x-coordinate of the point.

y y-coordinate of the point.

INTEGRATED ENGINEERING SOFTWARE


130 INTEGRATED API Guide

z z-coordinate of the point.

iErr Error code*.

CreateStreamlines_FromSegments
Analysis_CreateStreamlines_FromSegments(object saArrOfElems,
short LinePerSeg, ref short iErr)

Applies to: All programs

This function shows streamlines from a group of segments specified by an


array of segment ID numbers.

saArrOfElems Array of segment ID numbers.

LinePerSeg Number of streamlines from each segment.

iErr Error code*.

CreateStreamlines_FromSurface
Analysis_CreateStreamlines_FromSurfaces(object saArrOfElems,
short LinePerSurf, ref short iErr)

Applies to: 3D programs

This function shows streamlines from a group of surfaces specified by an


array of surfaces.

saArrOfElems Array of segment ID numbers.

LinePerSurf Number of streamlines from each surface.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 131

iErr Error code*.

DeleteStreamlines_All
Analysis_DeleteStreamlines_All()

Applies to: Electric and Magnetic programs

Deletes all streamlines.

Get2DElectricField
Analysis_Get2DElectricField(double x, double y, ref double Exr,
ref double Exi, ref double Eyr, ref double Eyi, ref short iErr)

Applies to: 2D electric programs (ELECTRO solver)

This function reports the electric field at an (x,y) point. In a static model
the imaginary parts report as 0.

x, y x- and y- coordinates of the point.

Exr, Exi Real and imaginary parts of the x-component of


the electric field.

Eyr, Eyi Real and imaginary parts of the y-component of


the electric field.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


132 INTEGRATED API Guide

Get2DElectricFields
Analysis_Get2DElectricFields(int iNumPoints, object saXarr, object
saYarr, object saExR, object saExI, object saEyR, object saEyI, ref short
iErr)

Applies to: 2D electric programs

Get the electric field at an array of points (xi, yi,)

iNumPoints Number of coordinate points.

saXArr Array of x-coordinates where the electric field was


computed.

saYArr Array of y-coordinates where the electric field was


computed.

saExR Array of the real part of the x-component of the


electric field.

saExI Array of the imaginary part of the x-component of


the electric field.

saEyR Array of the real part of the y-component of the


electric field.

saEyI Array of the imaginary part of the y-component of


the electric field.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 133

Get2DElectricField_FromSegment
Analysis_Get2DElectricField_FromSegment(int iSegment, int
iSide, int iNumPoints, ref object saArrX, ref object saArrY, ref
object saArrD, ref object saArrEt, ref object saArrEn, ref object
saArrEmag, ref short iErr)

Applies to: 2D electric programs

This function reports the electric field for a requested number of points
along a segment specified by ID number. It passes back location and
component in arrays. Make sure the arrays receiving data are the same
size. The side is specified according to the direction in which the segment
was drawn. For example, a vertical segment drawn from (0, 0) to (0, 1)
would have the negative x half-plane on the left and the positive x half-
plane on the right.

iSegment ID number of the segment.

iSide Side of the segment on which to calculate the


field.
1 – left side
2 – right side

iNumPoints Number of field computations along the segment.

saArrX Array of x-coordinates where the field was


computed.

saArrY Array of y-coordinates where the field was


computed.

saArrD Array of distances along the segment where the


field was computed.

INTEGRATED ENGINEERING SOFTWARE


134 INTEGRATED API Guide

saArrEt Array of E-tangential field components.

saArrEn Array of E-normal field components.

saArrEmag Array of E magnitude.

iErr Error code*.

Get2DElectricFieldSummary_FromSegment
Analysis_Get2DElectricFieldSummary_FromSegment(int
iSegment, int iSide, ref double dFldMin, ref double dFldMax, ref
double dFldAvg, ref short iErr)

Applies to: 2D electric programs (ELECTRO solver)

Analyzes the electric field on one side of a selected segment and reports
back the minimum, maximum and average values.

The side is specified according to the direction in which the segment was
drawn. For example, a vertical segment drawn from (0, 0) to (0, 1) would
have the negative x half-plane on the left and the positive x half-plane on
the right.

iSegment ID number of the segment.

iSide Number giving the side of the segment.


1 – left side
2 – right side

dFldMin Minimum electric field found.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 135

dFldMax Maximum electric field found.

dFldAvg Average electric field.

iErr Error code*.

Get2DFloatingVoltage_BySegment
Analysis_Get2DFloatingVoltage_BySegment(int iSegment, out
short isFloating, out double dVoltage, ref short iErr)

Applies to: 2D electric programs

Analysis get the floating voltage on a segment.

iSegment ID of the segment.

isFloating 1/0 is floating voltage condition defined on the


segment: Yes/no.

dVoltage The (static) floating voltage.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


136 INTEGRATED API Guide

Get2DFluxLinkage
Analysis_Get2DFluxLinkage(string sForwardName, string
sReturndName, ref double dFluxLinkageR, ref double dFluxLinkageI,
ref short iErr)

Applies to: 2D magnetic programs

Get 2D Flux Linkage.

sForwardName The name of the Forward object

sReturnName The name of the reverse object

dFluxLinkageR The flux linkage real component

dFluxLinkageI The flux linkage imaginary component.

iErr Error code*.

Get2DFluxLinkage_ByRegion
Analysis_Get2DFluxLinkage_ByRegion(int iForwardRegion, int
iReturnRegion, ref double dFluxLinkageR, ref double dFluxLinkageI,
ref short iErr)

Applies to: 2D magnetic programs

Get 2D Flux Linkage by Region.

iForwardRegion The name of the Forward region.

iReturnRegion The name of the reverse region.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 137

dFluxLinkageR The flux linkage real component.

dFluxLinkageI The flux linkage imaginary component.

iErr Error code*.

Get2DForce
Analysis_ Get2DForce(string sName, ref double dFx, ref double
dFy, ref short iErr)

Applies to: 2D electric and magnetic programs

Get the force on a named object.

sName Name of the object.

dFx x-component of the force.

dFy y-component of the force.

iErr Error code*.

Get2DForce_ByRegion
Analysis_ Get2DForce_ByID(int iRegion, ref double dFx, ref
double dFy, ref short iErr)

Applies to: 2D electric and magnetic programs

Get the force on an object specified by its ID number.

iRegion ID number of the object.

INTEGRATED ENGINEERING SOFTWARE


138 INTEGRATED API Guide

dFx x-component of the force.

dFy y-component of the force.

iErr Error code*.

Get2DMagneticField
Analysis_Get2DMagneticField(double x, double y, ref double Bxr,
ref double Bxi, ref double Byr, ref double Byi, ref short iErr)

Applies to: 2D magnetic programs

This function reports the magnetic field at an (x, y) point. In a static model
the imaginary parts report as 0.

x, y x- and y- coordinates of the point.

Bxr, Bxi Real and imaginary parts of the x-component of


the magnetic field.

Byr, Byi Real and imaginary parts of the y-component of


the magnetic field.

iErr Error code*.

Get2DMagneticFields
Analysis_Get2DMagneticFields(int iNumPoints, object saXarr, object
saYarr, object saBxR, object saBxI, object saByR, object saByI, ref short
iErr)

Applies to: 2D magnetic programs

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 139

Get the magnetic field at an array of points (xi, yi,)

iNumPoints The number of points

saXArr Array of x-coordinates where the magnetic field


was computed.

saYArr Array of y-coordinates where the magnetic field


was computed.

saBxR Array of the real part of the x-component of the


magnetic field.

saBxI Array of the imaginary part of the x-component of


the magnetic field.

saByR Array of the real part of the y-component of the


magnetic field.

saByI Array of the imaginary part of the y-component of


the magnetic field.

iErr Error code*.

GetBeamCenterAndDiameter
Analysis_GetBeamCenterAndDiameter(int BeamID, double
OriginX, double OriginY, double OriginZ, double NormalX, double
NormalY, double NormalZ, double UX, double UY, double UZ, int
CenterType, , int SizeType double Percent, ref double CenterX, ref
double CenterY, ref double CenterZ, ref double SpotSize, ref short
iErr)

INTEGRATED ENGINEERING SOFTWARE


140 INTEGRATED API Guide

Applies to: LORENTZ 3D programs

This function reports the size and center of the beam as the circle (center,
radius) which encloses a specified percent of the beam.

BeamID ID number for the beam (1 or greater)

OriginX, OriginY, Specify a working plane intersecting the beam by


OriginZ its origin, the normal direction, and the direction
of the “u” axis (u and v are the normal axes for an
NormalX, NormalY, arbitrary plane).
NormalZ

UX, UY, UZ

Center Type Type of calculation for calculating the beam


center:

0: User input (CenterX, CenterY and


CenterZ are passed to LORENTZ)

 for options 1, 2, 3 CenterX, CenterY and


CenterZ are received from LORENTZ

1: mean of the rays

2: Weighted by the current

3: Beam Axis point

SizeType Type of calculation for calculating the size:

0: Max (all rays)

1: RMS

2: I (Current) Percent

3: I (Current) RMS

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 141

Percent Percent of the beam to be enclosed by the radius

CenterX, CenterY, Computed center of the beam


CenterZ

SpotSize Computed diameter of the beam

iErr Error code*.

Get2DTemperature
Analysis_Get2DTemperature(double x, double y, ref double
Temperature, ref short iErr)

Applies to: 2D thermal programs

This function reports the electric field at an (x,y) point. In a static model
the imaginary parts report as 0.

x, y x- and y- coordinates of the point.

Temperature Temperature at the point.

iErr Error code*.

Get2DTorque
Analysis_ Get2DTorque(string sName, double x, double y, ref
double dTorque, ref short iErr)

INTEGRATED ENGINEERING SOFTWARE


142 INTEGRATED API Guide

Applies to: 2D electric and magnetic programs

Get the torque about a point for a named object.

sName Name of the object.

x x-coordinate of the point.

y y-coordinate of the point.

dTorque Torque about the point.

iErr Error code*.

Get2DTorque_ByRegion
Analysis_Get2DTorque_ByRegion(int iRegion, double x, double
y, ref double dTorque, ref short iErr)

Applies to: 2D electric and magnetic programs

Get the torque about a point for an object specified by its ID number.

iRegion ID number of the object.

x x-coordinate of the point.

y y-coordinate of the point.

dTorque Torque about the point.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 143

Get2DVoltage
Analysis_Get2DVoltage(double x, double y, ref double VoltR, ref
double VoltI, ref short iErr)

Applies to: 2D electric programs

Get the voltage at a point (x, y).

x, y The coordinate of the point.

VoltR RMS real part of the voltage at the point.

VoltI RMS imaginary part of the voltage at the point. In


a static model this reports as 0.

iErr Error code*.

GetElectricField
Analysis_GetElectricField(double x, double y, double z, ref
double Exr, ref double Exi, ref double Eyr, ref double Eyi, ref
double Ezr, ref double Ezi, ref short iErr)

Applies to: 3D electric programs

Get the electric field at a point (x,y,z).

x, y, z The (x, y, z) coordinate.

Exr, Eyr, Ezr x-, y-, and z-components of the real part of the
electric field.

INTEGRATED ENGINEERING SOFTWARE


144 INTEGRATED API Guide

Exi, Eyi, Ezi x-, y-, and z-components of the imaginary part of
the electric field. In a static model these report as
0.

iErr Error code*

GetElectricFields
Analysis_GetElectricFields(int iNumPoints, object saXarr, object saYarr,
object saZarr, object saExR, object saExI, object saEyR, object saEyI,
object saEzR, object saEzI, ref short iErr)

Applies to: 3D magnetic programs

Get the magnetic field at an array of points (xi, yi, zi)

iNumPoints The number of points

saXArr Array of x-coordinates where the field was


computed.

saYArr Array of y-coordinates where the field was


computed.

saZArra Array of z-coordinates where the field was


computed.

saExR Array of the real part of the x-component of the


electric field.

saExI Array of the imaginary part of the x-component of


the electric field.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 145

saEyR Array of the real part of the y-component of the


electric field.

saEyI Array of the imaginary part of the y-component of


the electric field.

saEzR Array of the real part of the z-component of the


electric field.

saBzI Array of the imaginary part of the z-component of


the electric field.

iErr Error code*.

GetElectricField_FromFile_ToFile
Analysis_GetElectricField_FromFile_ToFile(string sInFilePath,
string sOutFilePath, ref short iErr)

Applies to: 3D electric programs

Get the electric field from file output to file.

sInFilePath The name of the input file.

sOutFilePath The name of the putput file.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


146 INTEGRATED API Guide

GetFloatingVoltage
Analysis_GetFloatingVoltage(int iFloatingNumber, out double
dVoltage, ref short iErr)

Applies to: 2D electric and magnetic programs

Analysis get the voltage of the floating condition.

ifloatingNumber The floating number

dVoltage The (static) floating voltage.

iErr Error code*.

GetForce
Analysis_GetForce(string sName, ref double dFx, ref double dFy,
ref double dFz, ref short iErr)

Applies to: 2D electric and magnetic programs

Get the force on a named object.

sName Name of the object.

dFx x-component of the force.

dFy y-component of the force.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 147

GetForce_ByVolume
Analysis_GetForce_ByVolume(int iVolume, ref double dFx, ref
double dFy, ref double dFz, ref short iErr)

Applies to: 3D electric and magnetic programs

Get the force by volume identifier.

iVolumeFx The ID of the volume.

dFx X component of the force.

dFy y-component of the force.

dFz z-component of the force.

iErr Error code*.

GetForceOnPointCharge_Perturbed
Analysis_GetForceOnPointCharge_Perturbed(int iPoint, double
dX, double dY, double dZ, ref double ForceX, ref double ForceY,
ref double ForceZ, ref short iErr)

Applies to: 3D electric programs

Get the force on a point charge when perturbed. No resolving is required


for movement as a perturbation.

iPoint The ID of the point charge.

dFx X component of the force.

INTEGRATED ENGINEERING SOFTWARE


148 INTEGRATED API Guide

dFy y-component of the force.

dFz z-component of the force.

Force X, Y, Z The force X,Y,Z component.

iErr Error code*.

GetForceOnPointCharges
Analysis_GetForceOnPointCharges(int iNumPoints, out object
saForceXArr, out object saForceYArr, out object saForceZArr, ref
short iErr)

Applies to: 3D electric programs

Get the force on point charges

iNumPoints Name of the object.

saForceXArr Array of x-component of the force.

saForceYArr Array of y-component of the force.

saFroceZArr Array of z-component of the force.

iErr Error code*.

GetMagneticField
Analysis_GetMagneticField(double x, double y, double z, ref
double Bxr, ref double Bxi, ref double Byr, ref double Byi, ref
double Bzr, ref double Bzi, ref short iErr)

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 149

Applies to: 3D magnetic programs

Get the magnetic field at a point (x,y,z).

x, y, z The (x, y, z) coordinate.

Bxr, Byr, Bzr x-, y-, and z-components of the real part of the
magnetic field.

Bxi, Byi, Bzi x-, y-, and z-components of the imaginary part of
the magnetic field. In a static model these report
as 0.

iErr Error code*.

GetMagneticFields
Analysis_GetMagneticFields(int iNumPoints, object saXArr, object
saYArr, object saZArr, object saBxR, object saBxI, object saByR, object
saByI, object saBzR, object saBzI, ref short iErr)

Applies to: 3D magnetic programs


Get the magnetic field at an array of points (xi, yi, zi)

iNumPoints The number of points

saXArr Array of x-coordinates where the field was


computed.

INTEGRATED ENGINEERING SOFTWARE


150 INTEGRATED API Guide

saYArr Array of y-coordinates where the field was


computed.

saZArra Array of z-coordinates where the field was


computed.

saBxR Array of the real part of the x-component of the


magnetic field.

saBxI Array of the imaginary part of the x-component of


the magnetic field.

saByR Array of the real part of the y-component of the


magnetic field.

saByI Array of the imaginary part of the y-component of


the magnetic field.

saBzR Array of the real part of the z-component of the


magnetic field.

saBzI Array of the imaginary part of the z-component of


the magnetic field.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 151

GetMagneticField_FromFile_ToFile
Analysis_GetMagneticField_FromFile_ToFile(string sOutFilePath,
string sInFilePath, ref short iErr)

Applies to: 3D magnetic programs

Get the magnetic field from file to output file.

sOutFilePath The name of the output file.

sInFilePath The name of the input file.

iErr Error code*.

GetNumberOfBeams
Analysis_GetNumberOfBeams(ref int iNumberOfBeams, ref short
iErr)

Applies to: Lorentz programs

Get number of beams (Lorentz).

iNumberOfBeams Number of Beams.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


152 INTEGRATED API Guide

GetNumberOfEmissions
Analysis_GetNumberOfEmissions(int iBeamNumber, ref int
iNumberOfEmissions, ref short iErr)

Applies to: Lorentz programs

Get number of emissions (Lorentz).

iBeamNumber Number of Beams.

iNumberOfEmissions Number of emissions

iErr Error code*.

GetNumberOfPoints
Analysis_GetNumberOfPoints(int iBeamNumber, int
iEmissionNumber, int iRayNumber, ref int iNumberOfPoints, ref
short iErr)

Applies to: Lorentz programs

Get number of points (Lorentz).

iBeamNumber Number of Beams.

iEmissionNumber Number of emissions.

iRayNumber Number of rays.

iNumberOfPoints Number of Points

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 153

iErr Error code*.

GetNumberOfPoints_OnStreamlines
Analysis_GetNumberOfPoints_OnStreamLine(int iStreamLine, ref
int iNumberOfPoints, ref short iErr)

Applies to: All programs

Get number of points on Streamlines

iStreamLine Streamline Number

iNumberOfPoints Number of points on streamline.

iErr Error code*.

GetNumberOfRayIntersectionsWithPlane
Analysis_GetNumberOfRayIntersectionsWithPlane(int iBeamID,
double dDistance, ref int iNumberOfIntersectoins, ref short iErr)

Applies to: Lorentz programs

Get number of ray intersections with Plane (Lorentz).

iBeamID Beam Number

dDistance Distance defines the plane.

iNumberOfIntersections Number of intersections

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


154 INTEGRATED API Guide

GetNumberOfRays
Analysis_GetNumberOfRays(int iBeamNumber, int
iEmissionNumber, ref int iNumberOfRays, ref short iErr)

Applies to: Lorentz programs

Get number of rays (Lorentz).

iBeamNumber Beam Number

iEmissionNumber Number of Emissions.

iNumberOfRays Number of rays

iErr Error code*.

GetNumberOfStreamlines
Analysis_GetNumberOfStreamLines(ref int
iNumberOfStreamLines, ref short iErr)

Applies to: All programs

iNumberOfStreamlines Number of streamlines.

iErr Error code*.

GetCoordinateTimeDistance_OnRay
Analysis_GetCoordinateTimeDistance_OnRay(int iBeamNumber,
int iEmissionNumber, int iRayNumber, int iPointNumber, ref

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 155

double dX, ref double dY, ref double dZ, ref double dTime, ref
double dDistance, ref short iErr)

Applies to: Lorentzc programs

iBeamnumber Beam number

iEmissionNumber Emission number

iRayNumber Ray number

iPointNumber Point number

dX,dY,dZ X,y,z coordinate of the point

dTime Time of the point.

dDistance Distance of the point.

iErr Error code*.

GetField_OnRay
Analysis_GetPointField(int iBeamNumber, int iEmissionNumber,
int iRayNumber, int iPointNumber, ref double dEx, ref double dEy,
ref double dEz, ref double dBx, ref double dBy, ref double dBz, ref
short iErr)

Applies to: Lorentz programs

iBeamnumber Beam number

INTEGRATED ENGINEERING SOFTWARE


156 INTEGRATED API Guide

iEmissionNumber Emission number

iRayNumber Ray number

iPointNumber Point number

dEx,dEy,dEz E-field x,y,z component of the point.

dBx,dBy,dBz B-field x,y,z component of the point.

iErr Error code*.

GetKinematics_OnRay
Analysis_GetKinematics_OnRay(int iBeamNumber, int
iEmissionNumber, int iRayNumber, int iPointNumber, ref double
dVelocityX, ref double dVelocityY, ref double dVelocityZ, ref double
dEnergy, ref short iErr)

Applies to: Lorentz programs

Get the point Kinematics (Lorentz).

iBeamnumber Beam number

iEmissionNumber Emission number

iRayNumber Ray number

iPointNumber Point number

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 157

dVelocityX,dVelocityY,dVelocityZ x,y,z component of velocity.

dEnergy Energy of the point.

iErr Error code*.

GetRayRadiusandCurrent
Analysis_GetRayRadiusAndCurrent(int iBeamNumber, int
iEmissionNumber, int iRayNumber, ref double dRadius, ref double
dCurrent, ref short iErr)

Applies to: Lorentz programs

Get the radius and current of ray (Lorentz).

iBeamnumber Beam number

iEmissionNumber Emission number

iRayNumber Ray number

dRadius Radius of ray

dCurrent Current of ray.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


158 INTEGRATED API Guide

GetStreamlineData
Analysis_GetStreamlineData(int iStreamLine, int iNumberOfPoints,
out object saX, out object saY, out object saZ, out object saEx, out
object saEy, out object saEz, out object saMaterial, ref short iErr)

Applies to: 3D electric and magnetic programs

Get the points, fields, material on the streamline.

iStreamLine Streamline number

iNumberOfPoints Number of points on streamline

saX,saY,saZ Array of X,Y,Z coordinates

saEx,saEy,saEz Array of E-field x,y,z components

saMaterial Material

iErr Error code*.

GetTemperature
Analysis_GetTemperature(double x, double y, double z, ref
double Temperature, ref short iErr)

Applies to: 3D thermal programs

Get the temperature at a point.

x x-coordinate of the point.

y y-coordinate of the point.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 159

z z-coordinate of the point.

Temperature Temperature at the point.

iErr Error code*.

GetTemperature_Fromfile_ToFile
Analysis_GetTemperature_FromFile_ToFile(string sInFilePath,
string sOutFilePath, ref short iErr)

Applies to: 3D thermal programs

Get the temperature from File output to File.

sInFielPath The name of the input file.

sOutFilePath The name of the output file.

iErr Error code*.

GetTorque
Analysis_GetTorque(string sName, double x1, double y1, double
z1, double x2, double y2, double z2, ref double dTorque, ref short
iErr)

Applies to: 3D electric and magnetic programs

Get the torque.

sName Name of the object.

INTEGRATED ENGINEERING SOFTWARE


160 INTEGRATED API Guide

x1,y1,z1 x,y,z-coordinate of the axis start point.

x2,y2,z2 X,y,z-coordinate of the axis endpoint.

dTorque Torque about the point.

iErr Error code*.

GetTorque_ByVolume
Analysis_GetTorque_ByVolume(int iVolume, double x1, double
y1, double z1, double x2, double y2, double z2, ref double
dTorque, ref short iErr)

Applies to: 3D electric and magnetic programs

Get the torque by volume identifier.

iVolume Name of the object.

x1,y1,z1 x,y,z-coordinate of the axis start point.

x2,y2,z2 X,y,z-coordinate of the axis endpoint.

dTorque Torque about the point.

iErr Error code*.

GetVoltage
Analysis_GetVoltage(double x, double y, double z, ref double
VoltR, ref double VoltI, ref short iErr)

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 161

Applies to: 2D electric programs

Get the voltage at a point.

x x-coordinate of the point.

y y-coordinate of the point.

z z-coordinate of the point.

VoltR Real part of the RMS voltage at the point.

VoltI Imaginary part of the RMS voltage at the point.


Reports as 0 in a static model.

iErr Error code*.

GetVoltages
Analysis_GetVoltages(int iNumPoints, object saXarr, object saYarr,
object saZarr, object saVoltR, object saVoltI, ref short iErr)

Applies to: All electric 3D programs

Get the voltage at an array of points (xi, yi, zi)

iNumPoints The number of points

saXArr Array of x-coordinates where the voltage was


computed.

saYArr Array of y-coordinates where the voltage was


computed.

INTEGRATED ENGINEERING SOFTWARE


162 INTEGRATED API Guide

saZArra Array of z-coordinates where the voltage was


computed.

saVoltR Array of the real part of the RMS voltage.

saVoltI Array of the imaginary part of the RMS voltage.


Reports as 0 in a static model.

iErr Error code*.

GetVoltage_FromFile_ToFile
Analysis_GetVoltage_FromFile_ToFile(string sInFilePath, string
sOutFilePath, ref short iErr)

Applies to: 3D electric programs

Get the voltage from File output to File.

sInFilePath The name of the input file.

sOutFilPath The name of the output file.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 163

SetBeamAxis_AlongSegments
Analysis_SetBeamAxis_AlongSegments(int iNumSegs, object
saSegs, double dOriginX, double dOriginY, double dOriginZ, ref
short iErr)

Applies to: Lorentz programs

Set Beamaxis along segments

iNumSegs The number of segments

saSegs The list of segments.

dOriginX,dOriginY,dOriginZ X,Y,Z coordinate of the origin of the


Beam axis

iErr Error code*.

SetBeamAxis_AlongX
Analysis_SetBeamAxis_AlongX(double dOriginX, double
dOriginY, double dOriginZ, ref short iErr)

Applies to: Lorentz programs

Set Beam axis along X axis.

dOriginX,dOriginY,dOriginZ X,Y,Z coordinate of the origin of the


Beam axis

iErr

INTEGRATED ENGINEERING SOFTWARE


164 INTEGRATED API Guide

SetBeamAxis_AlongY
Analysis_SetBeamAxis_AlongY(double dOriginX, double
dOriginY, double dOriginZ, ref short iErr)

Applies to: Lorentz programs

Set Beam axis along Y axis.

dOriginX,dOriginY,dOriginZ X,Y,Z coordinate of the origin of the


Beam axis

iErr Error code*.

SetBeamAxis_AlongZ
Analysis_SetBeamAxis_AlongZ(double dOriginX, double
dOriginY, double dOriginZ, ref short iErr)

Applies to: Lorentz programs

Set Beam axis along Z axis.

dOriginX,dOriginY,dOriginZ X,Y,Z coordinate of the origin of the


Beam axis

iErr Error code*.

SetElectricStreamlinesDirection
Analysis_SetElectricStreamlinesDirection(short Direction, ref
short iErr)

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 165

Applies to: 2D electric programs

Sets the direction streamlines will be traced.

Direction +1 : draw streamlines in field direction


-1 : draw streamlines opposite to field direction

iErr Error code*.

SetElectricStreamlinesMaxLength
Analysis_SetElectricStreamlinesMaxLength(double dMaxLength,
ref short iErr)

Applies to: 2D electric programs

Sets the maximum length of streamlines.

dMaxLength Maximum length of streamlines.

iErr Error code*.

SetElectricStreamlinesPrecision
Analysis_SetElectricStreamlinesPrecision(short Precision, ref
short iErr)

Applies to: 2D electric programs

INTEGRATED ENGINEERING SOFTWARE


166 INTEGRATED API Guide

This function sets the precision factor for streamline


computations. This alters the dialog setting shown to
the right.

Precision 0 - Coarse
1 - Medium
2 - Fine
3 - Very Fine

iErr Error code*.

SetElectricStreamlinesStepSize
Analysis_SetElectricStreamlinesStepSize(double dSize, ref short
iErr)

Applies to: 2D electric and magnetic programs

Override the streamline precision setting by specifying a step size to


compute streamlines.

dSize Size of the steps used to compute streamlines.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 167

SetStreamlinesDirection
Analysis_SetStreamlinesDirection(short Direction, ref short iErr)

Applies to: 2D electric and magnetic programs

Analysis set streamlines draw direction

Direction 1/-1 – draw in field direction or not.

iErr Error code*.

SetStreamlinesMaxLength
Analysis_SetStreamlinesMaxLength(double dMaxLength, ref
short iErr)

Applies to: 2D electric and magnetic programs

Analysis set streamlines maximum length

dMaxLength maximum length.

iErr Error code*.

SetStreamlinesPrecision
Analysis_SetStreamlinesPrecision(short Precision, ref short iErr)

Applies to: 2D electric and magnetic programs

Analysis set streamlines precision.

Precision 0/1/2/3 - coarse/medium/fine/very fine

INTEGRATED ENGINEERING SOFTWARE


168 INTEGRATED API Guide

iErr Error code*.

SetStreamlinesStepSize
Analysis_SetStreamlinesStepSize(double dSize, ref short iErr)

Applies to: 2D programs

Analysis set streamlines maximum length

dsize Step size

iErr Error code*.

UnsetElectricStreamlinesMaxLength
Analysis_UnsetElectricStreamlinesMaxLength(ref short iErr)

Applies to: 2D electric programs

Remove the maximum length setting for streamlines.

iErr Error code*.

UnsetElectricStreamlinesStepSize
Analysis_UnsetElectricStreamlinesStepSize(ref short iErr)

Applies to: 2D electric programs

Remove the step size setting for streamlines.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 169

UnsetStreamLineMaxLength
Analysis_UnsetStreamlinesMaxLength(ref short iErr)

Applies to: All programs

Remove the maximum length setting for streamlines.

iErr Error code*.

UnsetStreamLineStepSize
Analysis_UnsetStreamlinesStepSize(ref short iErr)

Applies to: All programs

Remove the step size setting for streamlines.

iErr Error code*.

OBJECT
AddRegion
Object_AddRegion(string sName, int iRegion, ref short iErr)

Applies to: 2D programs

Adds a region to an object.

sName Name of the object.

iRegion ID number of the region to add.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


170 INTEGRATED API Guide

AddSegment
Object_AddSegment(string sName, int iSegment, ref short iErr)

Applies to: All programs

Adds a segment to an object.

sName Name of the object.

iSegment ID number of the segment to add.

iErr Error code*.

AddSurface
Object_AddSurface(string sName, int iSurface, ref short iErr)

Applies to: All 3D programs

Adds segments to objects using the object ID number.

sName Name of the object.

iSurface ID number of the surface to add.

iErr Error code*.

AddVolume
Object_AddVolume(string sName, int iVolume, ref short iErr)

Applies to: All 3D programs

Adds segments to objects using the object ID number.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 171

sName Name of the object.

iVolume ID number of the volume to add.

iErr Error code*.

Create
Object_Create (string sName, ref int ObjId, ref short iErr)

Applies to: All programs

Create a new object.

sName Name of the new object.

ObjId ID number of the new object.

iErr Error code*.

Create_FromArray
Object_Create_FromArray(string sName, int ArrType, Object
saArrOfElems, ref int ObjId, ref short iErr)

Applies to: All programs

Create a new object using an ID array.

sName Name of the new object.

ArrType Integer specifying the type of the array passed in:


1-SEGMENT(2D, 3D)
2-REGION(2D)

INTEGRATED ENGINEERING SOFTWARE


172 INTEGRATED API Guide

3-SURFACE(3D)
4-VOLUME(2D, 3D).

saArrOfElems Array of ID numbers.

ObjId ID number of the new object.

iErr Error code*.

Delete
Object_Delete(string sName, ref short iErr)

Applies to: All programs

Delete an object definition. The geometry and any assignments (such as


material) that were assigned by the object name will not be affected.

sName Name of the object.

iErr Error code*.

GetObjectID
Object_GetObjectID(string sName, ref int ObjId)

Applies to: All programs

Get object ID.

sName Name of the object.

ObjId ID of the object

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 173

RemoveAll Geometry
Object_RemoveAllGeometry(string sName, ref short iErr)

Applies to: All programs

Remove all geometry assignments from an object.

sName Name of the object.

iErr Error code*.

RemoveRegion
Object_RemoveRegion(string sName, int iRegion, ref short iErr)

Applies to: 2D programs

Remove a region ID from an object.

sName Name of the object.

iRegion ID number of the region to remove.

iErr Error code*.

RemoveSegment
Object_RemoveSegment(string sName, int iSegment, ref short
iErr)

Applies to: All programs

Remove a segment ID from an object.

sName Name of the object.

INTEGRATED ENGINEERING SOFTWARE


174 INTEGRATED API Guide

iSegment ID number of the segment.

iErr Error code*.

RemoveSurface
Object_RemoveSurface(string sName, int iSurface, ref short iErr)

Applies to: 3D programs

Remove a surface from an object.

sName Name of the object.

iSurface ID number of the surface to remove.

iErr Error code*.

RemoveVolume
Object_RemoveVolume(string sName, int iVolume, ref short iErr)

Applies to: 3D programs

Remove a volume from an object.

sName Name of the object.

iVolume ID number of the volume to remove.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 175

MODEL
Delete_All
Model_Delete_All()

Applies to: All programs

Delete all geometry and objects.

GetAllAvailableAnalysisModes

Model_GetAllAvailableAnalysisModes(int iModeIdx, ref string


sMode, ref short iErr)

Applies to: All programs

Model - Get All Available Analysis Modes by index.

iModeIdx Mode Index

sMode Analysis Mode ("Electric", "Magnetic", "Trajectory",


...)

iErr Error code*.

GetCurrentAnalysisMode
Model_GetCurrentAnalysisMode(ref string sMode)

Applies to: All programs

Model - Get current analysis mode

sMode Analysis Mode("Electric", "Magnetic", "Trajectory",


...)

INTEGRATED ENGINEERING SOFTWARE


176 INTEGRATED API Guide

GetUnit
Model_GetUnit(string sUnitType, ref string sSelectedUnit, ref short
iErr)

Applies to: All programs

This function is used to get the current unit set for a specified property
type.

sUnitType The type of physical property. E.g. length, voltage, etc.

sSelectedUnit The currently set unit for the property. E.g. cm, kV, etc.

iErr Error code*.

SetAnalysis
Model_SetAnalysisMode(string sMode, ref short iErr)

Applies to: All programs

Sets the application include the GUI and Solver to specified Mode.

sMode Analysis Mode("Electric", "Magnetic", "Trajectory",


...)

iErr Error code*.

SetUnit
Model_SetUnit(string sUnitType, ref string sSelectedUnit, ref short
iErr)

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 177

Applies to: All programs

This function is used to set the current unit set for a specified property
type.

sUnitType The type of physical property. E.g. length,


voltage, etc.

sSelectedUnit The currently set unit for the property. E.g. cm,
kV, etc.

iErr Error code*.

VIEW
Set2DLimits
View_Set2DLimits(double dXmin, double dYmin, double dXmax,
double dYmax, ref short iErr)

Applies to: 2D programs

This function sets the 2D limits for viewing the model.

dXmin Minimum x-coordinate value for viewing.

dYmin Minimum y-coordinate value for viewing.

dXmax Maximum x-coordinate value for viewing.

dYmax Maximum y-coordinate value for viewing.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


178 INTEGRATED API Guide

GetZoomCenterRadius
View_GetZoomCenterRadius(ref double centerx, ref double
centery, ref double centerz, ref double Radius, ref short iErr)

Applies to: All programs

This function gets center and redius.

Centerx,centery,centerz x,y,z coordinates of the center

radius radius

iErr Error code*.

Set2DLimits
View_Set2DLimits(double dXmin, double dYmin, double dXmax,
double dYmax, ref short iErr)

Applies to: All programs

This function sets the 2D limits for viewing the model.

dXmin,dYmin Minimum x,y,coordinate values for viewing.

dXmax,dYmax Maximum x,y corrdinate values for viewing.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 179

Setdirection
View_SetDirection(double dirX, double dirY, double dirZ, ref
short iErr)

Applies to: All programs

This function Sets direction for the model.

dirX,dirY,dirZ X, Y, Z component of the direction.

iErr Error code*.

SetLimits
View_SetLimits(double dXmin, double dYmin, double dZmin,
double dXmax, double dYmax, double dZmax, ref short iErr)

Applies to: All programs

This function sets direction for the model.

dXmin,dYmin,dZmin Minimum x,y,z coordinate for viewing.

dXmax,dYmax,dZmax Maximum x,y,z coordinate for viewing

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


180 INTEGRATED API Guide

SetLookatPoint
View_SetLookAtPoint(double x, double y, double z, ref short
iErr)

Applies to: All programs

This function Sets look at the point.

X,y,z X,y,z coordinates of the look at the point.

iErr Error code*.

SetTypeHiddenLine
View_SetType_HiddenLine(ref short iErr)

Applies to: 3D programs

This function Set type hidden line.

iErr Error code*.

SetTypeSolid
View_SetType_Solid(ref short iErr)

Applies to: All programs

This function Set type Solid.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 181

SetTypeSolidColorEdges
View_SetType_SolidColoredEdges(ref short iErr)

Applies to: All programs

This function Set type solid color edges.

iErr Error code*.

SetTypeSolidEdges
View_SetType_SolidEdges(ref short iErr)

Applies to: All programs

This function sets the view type as solid edges.

iErr Error code*.

SetTypeSolidTranslucent
View_SetType_SolidTranslucent(ref short iErr)

Applies to: All programs

This function sets the view type as solid translucent.

iErr Error code*.

SetTypeTranslucent

View_SetType_Translucent(ref short iErr)

Applies to: All programs

This function sets the view type as translucent.

INTEGRATED ENGINEERING SOFTWARE


182 INTEGRATED API Guide

iErr Error code*.

SetTypeWireFrame
View_SetType_WireFrame(ref short iErr)

Applies to: All programs

This function sets the voew type as WireFrame.

iErr Error code*.

SetUpAxisX
View_SetUpAxisX(ref short iErr)

Applies to: All programs

This function sets the Up axis as X.

iErr Error code*.

SetUpAxisY
View_SetUpAxisY(ref short iErr)

Applies to: All programs

This function sets the Up axis as Y.

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 183

SetUpAxisZ
View_SetUpAxisX(ref short iErr)

Applies to: All programs

This function sets the Up axis as Z.

iErr Error code*.

SetZoomAllGeometry
View_SetZoomAllGeometry(ref short iErr)

Applies to: All programs

This function Set Zoom all geometry.

iErr Error code*.

SetZoomCenterRadius
View_SetZoomCenterRadius(double centerx, double centery,
double centerz, double Radius, ref short iErr)

Applies to: All programs

This function sets the view center and readius.

Radius Radius

centerX,centerY,centerZ X,Y,Z coordinates of the center

iErr Error code*.

INTEGRATED ENGINEERING SOFTWARE


184 INTEGRATED API Guide

WINDOW
CheckInitialization
Window_CheckInitialization(ref short iErr)

Applies to: All Programs

Is CheckInitialization. Since the application initialization during the start-up


takes a time, the user have to wait for this, and proceed with API calls
thereafter initialization is complete (error code 0).

Ver 1.0, [id(279)] This API routine should be called to test the program
readiness to run the script.

iErr Error code*.

VBA
Instead of pausing for a set time:
Application.Wait (Now + TimeValue("0:00:05"))

You can use:


iErr = 1
Do
ret = IES.Window_CheckInitialization(iErr)
Loop Until iErr = 0

MATLAB
Instead of:
pause(4);

You can use:


% Starting the application
h = actxserver('IES.Document');
iErr=int16(1);
iErr = 1;
while iErr > 0
[iErr] = Window_CheckInitialization (h, iErr);
End

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 185

Close
Window_Close()

Applies to: All programs

This function closes the INTEGRATED program window.

PopupMessage
Window_PopupMessage(string sMsg)

Applies to: All programs

This function instructs the INTEGRATED program to popup a message


box with the text passed to it.

sMsg Text of the message to put in the popup box.

Refresh
Window_Refresh()

Applies to: All programs

This function redraws the workspace.

Show
Window_Show()

Applies to: All programs

This function activates the application frame and current view to show the
INTEGRATED program. It is not generally necessary to use this function,
but may be needed for some video cards.

ERROR CODES
The code iErr is an integer returned from the INTEGRATED program in
most API functions to indicate if there were errors executing the function.
0 means no errors.

INTEGRATED ENGINEERING SOFTWARE


186 INTEGRATED API Guide

Code Meaning

0 No errors

1 General error

2 A routine which only applies to 3D is used in a 2D program

3 A routine which only applies to 2D is used in a 3D program

4 A routine which requires a solution is used in an unsolved


model

5 A routine invokes a named object which doesn’t exist in the


model.

6 A 2D region number which doesn’t exist in the model is


invoked.

7 Filename used is empty

8 Cannot save database

9 Cannot convert to system array

10 Lorentz only: a function that only applies to Lorentz is used


in a non-Lorentz program

11 Lorentz: invalid ID number is given for a beam

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 187

12 Lorentz: invalid ID number is given for an emission

13 Lorent: invalid ID number is given for a ray

14 Invalid path is specified

15 Trying to a create a named object which already exists

16 Cannot create the named object

17 Array dimensions not equal

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 189

CHAPTER 4

DATA TYPES AND ARRAY


EXAMPLES
PARAMETER TYPES IN DIFFERENT ENVIRONMENTS
The types given in the descriptions of functions in this chapter are
according the C#. The following table shows the equivalent types for
declaring in different environments.

C# C++ Visual Basic for Matlab


Applications
(Automation (e.g. Excel VBA)
types)

short SHORT Integer Int16

(System.Int16)

int LONG Long Int32

(System.Int32)

double DOUBLE Double double

(System.double) (is the default


variable type)

string BSTR String char

INTEGRATED ENGINEERING SOFTWARE


190 INTEGRATED API Guide

ARRAY EXAMPLES
Excel (VBA)
Following is the example showing the use of arrays in the Geometry
command to create 2D Spline from the point array.

Option Base 1

Sub ELECTRO_Demo()

Dim iErr As Integer

Dim ret

Dim segId As Long

Dim xSp() As Double

Dim ySp() As Double

ReDim xSp(3)

xSp(1) = 1.1

xSp(2) = 2.1

xSp(3) = 3.1

ReDim ySp(3)

ySp(1) = 1.2

ySp(2) = 2.2

ySp(3) = 3.2

ret = obj.Geometry2D_Create2DSpline(xSp, ySp, segId , iErr)

INTEGRATED ENGINEERING SOFTWARE


Chapter 3 – The Integrated API Function List 191

End Sub

Geometry2D_Create2DSpline (xSp, ySp, segId, iErr)

xSp Array of X point coordinates.

ySp Array of Y point coordinates.

segId The segment number. Must be >0.

iErr Zero based index of the Error. Indicates if there were errors
executing the function.

Matlab
If you will be using array based functions with Matlab it is best to insert the
following line of code at the top of the script:

feature('COM_SafeArraySingleDim', 1);

This ensures that all passed SAFEARRAYS will be 1 dimensional (in


Matlab the default is 2D)

INTEGRATED ENGINEERING SOFTWARE


Chapter 5 – Scripting with Excel Macros 193

CHAPTER 5

SCRIPTING WITH EXCEL MACROS

WHY USE EXCEL?


Excel is only one possibility for writing scripts for the INTEGRATED API.
We have provided a chapter specifically for Excel because it is a very
common and well understood program that can be used for this purpose.

As compared to writing a full program to run the INTEGRATED API, using


a scripting environment enables a much faster implementation of many
projects. In the case of Excel you can generally have a spreadsheet laid
out with cells of input data, a button to run your INTEGRATED API
function and cells which display the results (including specialized
calculations based on the results, graphs that update from the results,
etc.).

SETTING UP EXCEL FOR THE INTEGRATED API


This chapter will focus on the use of Excel2010. For different versions
there will be similar processes and settings, but the details may vary.

Setting up IES.exe for the API


See “Essential Setup for using the API” in Chapter 2.

Enabling the Development Tools in Excel


By default the development tools are turned off in Excel since they are
only used by a small fraction of users. When they are turned on, the
ribbon at the top of the Excel window contains a tab labeled Developer:

INTEGRATED ENGINEERING SOFTWARE


194 INTEGRATED API Guide

If this tab is not turned on:

1) In Excel select File>Options (shown on


the right)

2) In the Excel Options dialog, select the


Customize ribbon option (shown below)

3) Check the box to enable the Developer tab (shown below):

INTEGRATED ENGINEERING SOFTWARE


Chapter 5 – Scripting with Excel Macros 195

4) Click the [OK] button to accept the change and close the Excel
Options dialog.

How Excel Macros Work


Microsoft Office products, including Excel, can perform automated tasks
via a built-in form of VisualBasic called “VisualBasic for Applications”, or
VBA. The VBA code saved with an Excel spreadsheet is called a Macro.
Controls for defining and running Macros can be found in the Code section
of the ribbon when the Developer tab is active.

INTEGRATED ENGINEERING SOFTWARE


196 INTEGRATED API Guide

The Visual Basic Icon

Clicking this icon opens up a


separate program window –
Microsoft Visual Basic for
Applications – shown on
the right. This window is
used to compose, view and
edit VBA code that will be
saved in the spreadsheet.

The Macros Icon

Clicking this icon


opens up the Macro
dialog. This dialog
shows available
macros with tools for
running macros,
starting the editor for
a macro, creating
macros, deleting
macros, and setting
Options such as
defining a <Ctrl>-
key sequence to
start the macro.

A Simple Example
1) Without opening your INTEGRATED program, open Microsoft
Excel.

2) Select the Developer tab

3) Click the VisualBasic icon

INTEGRATED ENGINEERING SOFTWARE


Chapter 5 – Scripting with Excel Macros 197

4) The Microsoft Visual


Basic for
Applications window
will open without any
active document on
the right for composing
the macro.

5) Double-click
ThisWorkbook
to open a
document.

6) From the menu bar select Insert>Procedure

INTEGRATED ENGINEERING SOFTWARE


198 INTEGRATED API Guide

7) The Add Procedure


dialog will open.

8) Type “Test” as the


name and leave “Sub”
as the type.

9) Click the [OK] button


to close the dialog and
create the sub.

10) Your workbook


now contains
an empty Sub.

11) Enter the following lines into your Sub:


Set obj = CreateObject("IES.Document")
Application.Wait (Now + TimeValue("0:00:4"))
It should appear as shown below. As indicated, the additional
comments are given after the apostrophe. Below the first line is a
call to Windows to open whatever is registered as IES.Document
in the Registry and to refer to it as obj. The second line is just a 4
second pause to make sure the program is open before sending
any instructions to it.

INTEGRATED ENGINEERING SOFTWARE


Chapter 5 – Scripting with Excel Macros 199

12) To test the macro,


from the menu bar
select
Run>Run
Sub/Userform
or press the <F5> key
on your keyboard.
You should find this
opens your
INTEGRATED
program.

13) To make your


script do
something after
opening or
attaching to your
INTEGRATED
program, add the
two lines shown
on the right.

You should see the length unit on the program


toolbar change to cm. You can select any of
the standard length units as shown on the right
and when you run the script you will see the
program update.

INTEGRATED ENGINEERING SOFTWARE


200 INTEGRATED API Guide

To exchange variables with the INTEGRATED API you must


declare them according to the type declared in the function list
in Chapter 3. This example shows the variable iErr passed
back from INTEGRATED for most functions. If you wish to
check for error messages while solving, test this variable. 0
means no errors. Anything above 0 is an error code.

Save your Excel test project. To do so you will need to choose a macro
enabled format.

Potential Trouble – References


When you invoke IES.Document, Excel should automatically find the
reference file IES.tlb that is needed to properly call the INTEGRATED API
functions.

In case that fails, or if you have an


Excel file generated on a different
computer that references the
wrong location for your own
computer, you may need to edit
the reference location. Begin by
clicking on Tools>References…

INTEGRATED ENGINEERING SOFTWARE


Chapter 5 – Scripting with Excel Macros 201

In the pop-up dialog


you may find an entry
for IES. If so, verify
that the Location
points to the correct
program folder. If not,
uncheck the box
beside IES and click
[OK]. Re-open the
window and the
reference should be
gone and can now be
added in the correct
location. Click the
[Browse…] button.

The [Browse…]
button will open the
Add Reference
dialog. From here
navigate to your
program folder and
select the file IES.tlb.

INTEGRATED ENGINEERING SOFTWARE


202 INTEGRATED API Guide

Adding to the Test Example

In the Excel window on the


Developer tab, there are
many tools for building a
more sophisticated interface
to your macro. To explore
these options, select the
Insert button and from the
pop-up list choose Button
(Form Control).

It will appear as if nothing


happens.

Now left-click in the main part


of the spreadsheet. This will
insert a button at that location
and prompt you to select a
subroutine to run when it is
clicked. Select the test
routine that you have written.

INTEGRATED ENGINEERING SOFTWARE


Chapter 5 – Scripting with Excel Macros 203

When you close the dialog you


will now have a button floating
on the workbook. You can
right-click on it to bring up a list
of operations. For example,
select Edit Text and change
the label to something more
descriptive than the default,
such as “Change Unit” (note
you will also have to resize the
button).

Now when you click the button you will activate your INTEGRATED
program and change the unit to whatever is indicated in the line:

ret = obj.Model_SetUnit("Length", “unit”, iErr)

… provided that what is written in the place of unit above is valid as seen
from the length unit list in the program. Try values such as m, cm, mm,
mil etc.

Interaction Between the Workbook Cells and the Macro

In your workbook, type “mm”


into the top left cell – “A1”.
We will modify the Macro to
read and use this value.

Modify your macro code as shown below:

INTEGRATED ENGINEERING SOFTWARE


204 INTEGRATED API Guide

Note that you:

 declare a string variable named unit


 assign to the variable the value read out of the location A1 in
worksheet “Sheet1”
 use this variable for the unit value in the INTEGRATED API
function call

Also, the code above shows a shorter pause since it is expected that your
program is already open.

Return to your worksheet and click the button. Your INTEGRATED


program will update the unit to mm. Change the unit in cell A1 and try
again. You will find any valid units for length will be updated in the
program when you click the button.

Included Samples
Your INTEGRATED program includes some examples which will help you
to learn the interaction between workbook/macro/API better. These are in
the zip file shown below:

INTEGRATED ENGINEERING SOFTWARE


Chapter 5 – Scripting with Excel Macros 205

Unzip this file to a convenient location where you have read/write


privileges. Open the Excel example titled “Quick 2D Geometry Utilities”.
At the bottom you will find three workbooks to select from.

Select the General


workbook.

The General workbook contains three examples:

 a Start button to simply open an INTEGRATED program

 a more sophisticated Unit selection, using a pull down list

 a tool for drawing connected lines

The Set Unit Example

For visual clarity, and to


guard against mistakes, the
cells containing the
references for the selection
list (in column F) have been
hidden.

INTEGRATED ENGINEERING SOFTWARE


206 INTEGRATED API Guide

To show column F:

 <Ctrl>-left click on E and G to


highlight their columns

 Right-click on the E/G titles to


pull up a selection list of options

 Find the Unhide option on the


list and click it

 Column F should now be visible.

Next, right-click on the selection list and choose Format Control… from
the pop-up menu. You should now see the connections needed to make a
selection list like this work. In this case, the values appearing on the list
are from cells F4 to F9 and whichever is presently highlighted is shown in
cell F2. In the case shown, the second item on the list is highlighted,
therefore cell F2 shows the value 2.

Now find the macro code in Module 2:

INTEGRATED ENGINEERING SOFTWARE


Chapter 5 – Scripting with Excel Macros 207

 There are again the type declarations for any variables used in the
API function.

 Then as usual IES.Document is invoked and a pause is inserted. It


is expected you’ve already used the Start ELECTRO button so the
pause is relatively short.

 The value in cell F2 is read as “unit”.

 A Select Case section is used to call the API with the unit
corresponding to the number read as “unit”.

Note that with all the examples the purpose is to provide basic
readable examples of using Excel to run the API. An
experienced programmer can readily provide more elegant or
efficient ways of doing the same thing. For example, you could
rewrite the code above to read the string out of the cell
“F3+number read from F2” and use that instead of the many
lines of Select Case.

INTEGRATED ENGINEERING SOFTWARE


208 INTEGRATED API Guide

The Connected Lines Example

The Connect Lines example in the General worksheet will read the x,y
pairs out of columns A and B, then draw lines joining them in your
INTEGRATED program (in the current Length unit).

The associated macro code can be found in Module 1.

The red boxes below are intended to highlight the fact that writing a
macro like this is mostly about knowing how to use VisualBasic,
and in particular, to use it interactively within Excel. Out of the
many lines of code, only the lines that open the program, draw the
line and refresh the view are specific to this being a macro for the
INTEGRATED API:

INTEGRATED ENGINEERING SOFTWARE


Chapter 5 – Scripting with Excel Macros 209

After the usual sections declaring variables and invoking the


INTEGRATED program, there is a While loop which reads the values and
draws the lines. The process is:

1) Read an x-y pair

2) Check if the next x value is empty

3) If it is empty, quit

4) If it is not empty:

o Read the next x-y pair

o Instruct INTEGRATED to draw a line connecting the two


pairs

o Increment the counter so it will start at the second pair

o Go to step 1)

INTEGRATED ENGINEERING SOFTWARE


210 INTEGRATED API Guide

Other Examples

There are other examples of geometry construction in the other


workbooks in the Quick Utilities spreadsheet. Every program also has
an Excel example of drawing, assigning Physics, solving, analyzing,
writing results back into the spreadsheet and updating a graph.

INTEGRATED ENGINEERING SOFTWARE


Chapter 6 – Programming for the API with VisualStudio 211

CHAPTER 6

PROGRAMMING FOR THE API


WITH VISUALSTUDIO

WHY WRITE FULL PROGRAMS FOR THE API?


For many cases, working with a full development environment to provide a
stand-alone application to run your INTEGRATED program will be a lot
more work than doing the same task with scripts – especially when the
task is a minor modification of another task for which you already have a
macro script. However, there are many cases where the extra
sophistication of a full development environment is well worth it. Some of
the benefits of working this way:

1) As shown in Chapter 2, as you type out function names in


VisualStudio, the available options in the API will be presented to
you.

This not only saves typing, it means that you only need to learn the
structure of the API function naming, you don’t need to actually
learn the function names to write your code.

2) When you have a general purpose program that performs standard


tasks, using your INTEGRATED program in the background, you
can readily access this program from a desktop shortcut.

INTEGRATED ENGINEERING SOFTWARE


212 INTEGRATED API Guide

3) When working in consulting types of situations, you can better


protect your intellectual property such as the source code. For
example, provide a customer with an executable program that uses
an INTEGRATED program in the background to perform standard
tasks. Not only does this protect your own property, but you can
write the API to only work with a specific INTEGRATED security
key so that your customer needs to buy additional copies from you.
That is, they cannot just copy it to other systems running the same
INTEGRATED program.

VISUALSTUDIO 2010 TEST EXAMPLE


This example will demonstrate how to setup a project and make a stand-
alone program for performing a task with your INTEGRATED software.
The example is shown for a full license of VisualStudio, however it also
works with VisualStudio Express.

Creating the Project


Open your VisualStudio and select New Project.

INTEGRATED ENGINEERING SOFTWARE


Chapter 6 – Programming for the API with VisualStudio 213

In the New Project dialog specify that this is a VisualC# project, that it is a
Windows Form Application, name it API_Test and provide a folder
location.

Click the [OK] button to proceed. You will see a basic project is created
with a blank form:

INTEGRATED ENGINEERING SOFTWARE


214 INTEGRATED API Guide

From the toolbar in the selection


box containing Debug, Release
and Configuration Manager…,
select Configuration Manager…

To create a 64 bit option, in the Configuration Manager dialog select a


new Active solution platform:

INTEGRATED ENGINEERING SOFTWARE


Chapter 6 – Programming for the API with VisualStudio 215

In the New Solution


Platform dialog select
x64. Click the [OK]
button to accept the
new platform and
close the dialog. The
Configuration Manager
will now show x86 and
64 bit options for both
Release and Debug:

Click the [Close] button to close the Configuration Manager dialog.

Setting up IES.exe for the API


See “Essential Setup for using the API” in Chapter 2.

INTEGRATED ENGINEERING SOFTWARE


216 INTEGRATED API Guide

Referencing the INTEGRATED API


To access the COM interface of the INTEGRATED API, your project
needs to know the location of the file IES.tlb. In the Solution Explorer or
Class View, right-click to add a reference.

In the Add Reference dialog select the [Browse] tab. Navigate to the
folder containing your INTEGRATED program, then select the file IES.tlb.

INTEGRATED ENGINEERING SOFTWARE


Chapter 6 – Programming for the API with VisualStudio 217

Click the [OK] button to add the reference and close the dialog.

Contents of the INTEGRATED Reference

Right-click the new IES reference and choose View in Object Browser:

In the Object Browser select Interop.IES>IES>IDualIes. In the right


window panels you will then see a list of the functions available in the
INTEGRATED API.

As functions are selected in the top panel, the details of the variables to be
passed are shown in the bottom panel.

INTEGRATED ENGINEERING SOFTWARE


218 INTEGRATED API Guide

Making a Simple Program


Your project is now ready to make a simple form which will control your
INTEGRATED program.

1) Click on the Toolbox


from the side of your
VisualStudio window.
In the pop-up list
locate the Button
icon. Right-click this
icon to pull up a list
where you can copy it,
then paste it into your
form, or just drag it
into your form.

2) You now have a


generic button in the
form.

3) Right-click the button


and select Properties
from the selection list
that pops up.

4) In the Properties
panel, find the text
property and edit as
shown below.

INTEGRATED ENGINEERING SOFTWARE


Chapter 6 – Programming for the API with VisualStudio 219

You may need to resize your button as well for the whole label to be
readable.

5) In the Design
section of the
Properties, assign
the name of the
button as
StartIntegrated.

6) Double-click the button. A new tab for the form code will be
opened up, and a function to be executed when the button is

INTEGRATED ENGINEERING SOFTWARE


220 INTEGRATED API Guide

clicked will be inserted.

7) Insert code as necessary to match code shown below:


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Threading;

namespace API_Test
{
public partial class Form1 : Form
{
IES.Document _Document = null;
public Form1()
{
InitializeComponent();
}

private void StartIntegrated_Click(object sender, EventArgs e)


{
_Document = new IES.Document();
Thread.Sleep(1000);
_Document.Window_Show();
}
}
}

INTEGRATED ENGINEERING SOFTWARE


Chapter 6 – Programming for the API with VisualStudio 221

8) Press <Ctrl>-F5 or select the menu Debug>Start Without


Debugging to compile and start the program.

9) The program will appear as a simple form with your button. It will
look exactly like your design form inside VisualStudio. When you
click the button, your INTEGRATED program will open.

10) According to you project folders and the configuration you


compiled, you can also now find the created executable file. This
can be copied to other locations and run independently of
VisualStudio.

INTEGRATED ENGINEERING SOFTWARE


222 INTEGRATED API Guide

Making the Program Read Coordinates and Draw a Line

1) From the Toolbox, copy 4


Textboxes and 4 Labels into your
form.

2) Arrange the form elements and edit


the Text property of the labels as
shown below:

3) For easier association of the parts, change the name of each


Textbox to match the label beside it:

4) Modify the StartIntegrated function as shown below. (The green


comment lines are explanations,, they don’t need to be included.)
private void StartIntegrated_Click(object sender, EventArgs e)
{
_Document = new IES.Document();
Thread.Sleep(3000);
_Document.Window_Show();
// declare variables and read values from the form
double x1 = Convert.ToDouble(this.x1.Text);
double x2 = Convert.ToDouble(this.x2.Text);
double y1 = Convert.ToDouble(this.y1.Text);

INTEGRATED ENGINEERING SOFTWARE


Chapter 6 – Programming for the API with VisualStudio 223

double y2 = Convert.ToDouble(this.y2.Text);
Int32 iSegNumber;
Int16 iErr;

// set the length unit to cm


_Document.Model_SetUnit("Length", "cm", ref iErr);
// draw the line
_Document.Geometry2D_CreateLine(x1, y1, x2, y2, ref iSegNumber, ref iErr);
// refresh the viewing window
_Document.Window_Refresh();
}

5) Compile and run the program again (you need to have closed the
previously compiled program first).

6) Fill numbers into the boxes and click the button. Your
INTEGRATED program will start, the length unit will be set to cm,
and the corresponding line will be drawn.

INTEGRATED ENGINEERING SOFTWARE


224 INTEGRATED API Guide

OTHER EXAMPLES

Your program folders will include


an example project
demonstrating various common
features. For example, the
model shown to the right was
generated by the Insulator
sample that comes with
ELECTRO. This program
directs ELECTRO to build and
analyze an insulator for various
specified parameters then
append the results to a
summary. The program window
that produced this analysis is
shown below.

The code examples in this project include:

 Reading data from the form

 Writing data to the form

 Assigning voltages

INTEGRATED ENGINEERING SOFTWARE


Chapter 6 – Programming for the API with VisualStudio 225

 Assigning materials

 Modifying material properties

 Naming parts

 Including a diagram in the program window

 Retaining results in a built in spreadsheet

 Showing results in a built in graph

 Saving model file

INTEGRATED ENGINEERING SOFTWARE


Chapter 7 – Scripting the API with Matlab 227

CHAPTER 7

SCRIPTING FOR THE API


WITH MATLAB

INTRODUCTION
The link to your INTEGRATED program from Matlab is initiated by
creating a handle such as “IES” with the actxserver command:
IES = actxserver('IES.document');

The actxserver command will search your registry for IES.document to get
the information about the INTEGRATED program. If the program is
running, Matlab will attach to it and be able to set commands to it. If the
program is not running, invoking the actxserver for IES.document will start
it.

While the handle exists (IES in the case above) the program can be
controlled interactively or by Matlab. There are some dangers in using it
both ways, so it is recommended that the end of any m-file which invokes
IES.document will also clear the handle at the end (“clear IES” for the
case above).

Invoking API Commands


The format for commands being invoked from the INTEGRATED API
using Matlab is:
[outputs] = API_command(handle, inputs);

However, the API uses “in-out” for all outputs, so the output variables
appear on the inputs list (though they have no effect). For example, in
Chapter 3 you can find this API function

INTEGRATED ENGINEERING SOFTWARE


228 INTEGRATED API Guide

Geometry2D_CreateLine(double x1, double y1, double x2,


double y2, ref int SegNumber, ref short iErr)

The “ref” indicates in-output variables. The other variables can be used as
variables or values can be typed in. So to draw a line segment from (0, 0)
to (1, 1) the command would look like this:
[SegNumber, iErr] = Geometry_CreateLine(IES, 0, 0, 1, 1,SegNumber, iErr]

A complete script invoking the command would look like this:


iErr = int16(1);
SegNumber = int32(1);

IES = actxserver('IES.document');
iErr = 1;
while iErr > 0 % pause until IES is completely initialized
[iErr] = IsApplicationInitialized(IES, iErr);
End
[SegNumber, iErr] = Geometry_CreateLine(IES, 0, 0, 1, 1,SegNumber, iErr]
clear IES

Note the “while loop” setup is a safety precaution. This will create a pause
in the Matlab script until the interface between INTEGRATED and Matlab
is completely established. If the INTEGRATED program is already
running this is normally less than a second.

Using Arrays

If you will be using array based functions with Matlab it is best to insert the
following line of code at the top of the script:

feature('COM_SafeArraySingleDim', 1);

This ensures that all passed SAFEARRAYS will be 1 dimensional (in


Matlab the default is 2D)

Initial Setup
This registry entry is setup when the program is first run. If there are any
problems, then you should try one time running the program specifically
“As Administrator” from the options pulled up by right-clicking on ies.exe
in the program folder for your program. For example, here is the prompt
for setting up

INTEGRATED ENGINEERING SOFTWARE


Chapter 7 – Scripting the API with Matlab 229

is example will demonstrate how to setup a project and make a stand-


alone program for performing a task with your INTEGRATED software.
The example is shown for a full license of VisualStudio, however it also
works with VisualStudio Express.

Quick API Function List


When a handle exists Matlab will show the format of all functions
(methods) in it with the methodsview command. For example, with a
handle of IES to IES.document set, you can run

methodsview(IES)

This will pop up a window showing all methods including the data types for
all inputs and outputs. Unfortunately, the variable names are not included,
so the interpretation may not be clear without referencing chapter 3 of this
manual.

EXAMPLE PROJECT – HALBACH WIGGLER


The sample script below shows more examples for using the API, in this
case to:

 draw two layers of rectangular volumes

 assign magnetic material to them

 assign rotating (Halbach) magnetization directions to them

 animate the viewing

INTEGRATED ENGINEERING SOFTWARE


230 INTEGRATED API Guide

 solve

 plot B down the center between the magnets

 setup some electron emission points

 show the paths of the electrons

 animate the view

For the entire script to run requires a LORENTZ3D program which


includes a 3D magnetic solver (i.e. LORENTZ3M, LORENTZ3EM,
LORENTZ-HF-M, etc.)

The magnetic part will work with AMPERES or FARADAY. For other 3D
programs the geometry will be created and the animation will run.
% the first time you use the INTEGRATED API you must setup the registry
% by right-clicking on IES.exe and selecting "Run as Administrator"

clear all;
clc;

iErr = int16(1);
SegmentNumber1 = int32(1);
SegmentNumber2 = int32(1);
SegmentNumber3 = int32(1);
SegmentNumber4 = int32(1);
SurfaceNumber = int32(1);
VolumeNumber = int32(1);
ObjID = int32(1);
NumberOfMagnets = int32(1);
time=0;
distance=0;

Lorentz = actxserver('IES.document');
iErr = 1;
while iErr > 0 % pause until Lorentz is completely initialized
[iErr] = IsApplicationInitialized(Lorentz, iErr);
end

Model_Delete_All(Lorentz); %clear everything to begin


[iErr] = Model_SetAnalysisMode(Lorentz, 'Magnetic', iErr);

%set cm as the unit


[iErr] = Model_SetUnit(Lorentz, 'Length', 'cm', iErr);
[iErr] = View_SetZoomCenterRadius(Lorentz, 0, 0, 0, 12, iErr);

Width = 2;
Thickness = 2;
Length = 20;

INTEGRATED ENGINEERING SOFTWARE


Chapter 7 – Scripting the API with Matlab 231

Separation = 5;
StartAngle = 90;
Rotation = 90;
Number = 9;

z1 = Separation / 2;
z2 = z1 + Thickness;
x1 = Length / 2;
x2 = -Length / 2;
y1 = -Width * Number / 2;
y2 = y1 + Width;
NumberOfMagnets = 9;

[iErr] = View_SetType_SolidColoredEdges(Lorentz, iErr);


% create one top magnet
[SegmentNumber1, iErr] = Geometry_CreateLine(Lorentz, x1, y1, z1, x1,
y1, z2, SegmentNumber1, iErr);
[SegmentNumber2, iErr] = Geometry_CreateLine(Lorentz, x1, y1, z2, x1,
y2, z2, SegmentNumber2, iErr);
[SegmentNumber3, iErr] = Geometry_CreateLine(Lorentz, x1, y2, z2, x1,
y2, z1, SegmentNumber3, iErr);
[SegmentNumber4, iErr] = Geometry_CreateLine(Lorentz, x1, y2, z1, x1,
y1, z1, SegmentNumber4, iErr);
[SurfaceNumber, iErr] = Geometry_Define4SidedSurface(Lorentz,
SegmentNumber1, SegmentNumber2, SegmentNumber3, SegmentNumber4,
SurfaceNumber, iErr);
[VolumeNumber, iErr] = Geometry_SweepSurface_AlongX(Lorentz,
SurfaceNumber, -Length, VolumeNumber, iErr);
[ObjID, iErr] = Object_Create(Lorentz, 'Magnets', ObjID, iErr);
[iErr] = Object_AddVolume(Lorentz, 'Magnets', VolumeNumber, iErr);
% set Material
[iErr] = Physics_SetMaterial(Lorentz, 'Magnets', 'Neodymium 45 MGOe
Sintered', iErr);

% create magnet underneath


[iErr] = Geometry_LinearCopy(Lorentz, 'Magnets', 0, 0, -Separation -
Thickness, 1, iErr);
% create the rest
[iErr] = Geometry_LinearCopy(Lorentz, 'Magnets', 0, Width, 0,
NumberOfMagnets - 1, iErr);
[iErr] = View_SetZoomAllGeometry(Lorentz, iErr);

% set Material
[iErr] = Physics_SetMaterial(Lorentz, 'Magnets', 'Neodymium 45 MGOe
Sintered', iErr);

% set Magnetization Direction


for i = 0 : Number - 1
Angle = (StartAngle - i * Rotation) * pi / 180;
x1 = 0;
y1 = -Width * Number / 2 + Width / 2 + Width * i;
z1 = Separation / 2 + Thickness / 2;
% top magnets
[VolumeNumber, iErr] = Geometry_GetVolume_FromPoint(Lorentz, x1,
y1, z1, VolumeNumber, iErr);

INTEGRATED ENGINEERING SOFTWARE


232 INTEGRATED API Guide

[iErr] = Physics_SetMagnetizationDirection_ByVolume(Lorentz,
VolumeNumber, 0, cos(Angle), sin(Angle), iErr);
% bottom magnets
[VolumeNumber, iErr] = Geometry_GetVolume_FromPoint(Lorentz, x1,
y1, -z1, VolumeNumber, iErr);
[iErr] = Physics_SetMagnetizationDirection_ByVolume(Lorentz,
VolumeNumber, 0, -cos(Angle), sin(Angle), iErr);
end
% rotate the view

x = 0;
y = 0;
z = 0;
for i = 0 : 50
R = 10 - 2 * sin(i * pi / 360);
Theta = i * 1;
dirZ = 0.6 + 0.4 * sin(i * pi / 180);
dirY = sin(Theta * pi / 180);
dirX = cos(Theta * pi / 180);
[iErr] = View_SetDirection(Lorentz, dirX, dirY, dirZ, iErr);
[iErr] = View_SetZoomCenterRadius(Lorentz, x, y, z, R, iErr);
pause(0.01);
end

% set to static then solve


Physics_SetStaticMode(Lorentz);
[iErr] = Solution_RunSolver(Lorentz, iErr);

% make the plot


xy = [];
Bxr = 0;
Bxi = 0;
Byr = 0;
Byi = 0;
Bzr = 0;
Bzi = 0;
for i = 1 : 12 * (Number + 4)
y1 = -Width * (Number + 4) / 2 + i * Width / 12;
[Bxr, Bxi, Byr, Byi, Bzr, Bzi, iErr] =
Analysis_GetMagneticField(Lorentz, 0, y1, 0, Bxr, Bxi, Byr, Byi, Bzr,
Bzi, iErr); % get field at point
xy = [xy; y1 Bzr];
end
Window_Refresh(Lorentz);
figure(1);
plot(xy(:,1), xy(:,2));
xlabel('y-position (cm)');
ylabel('Bz (Tesla)');
title('Magnetic Field Along the Center');

% launch electron
% setup point sources and solve
[iErr] = Model_SetAnalysisMode(Lorentz, 'Trajectory', iErr);
[iErr] = Physics_CreatePointEmitter(Lorentz, 'Points', iErr);

INTEGRATED ENGINEERING SOFTWARE


Chapter 7 – Scripting the API with Matlab 233

% [EmissionPointNumber iErr] = Physics_AddEmissionPoint(Lorentz,


'Points', x, y, z, dirX, dirY, dirz, Energy, StartTime, Radius,
Current, EmissionPointNumber,iErr);
[EmissionPointNumber, iErr] = Physics_AddEmissionPoint(Lorentz,
'Points', 0, -15, 0, 0.2, 1, 0, 1600000, 0, 0, 0, EmissionPointNumber,
iErr);
[EmissionPointNumber, iErr] = Physics_AddEmissionPoint(Lorentz,
'Points', 0, -15, 0, 0.3, 1, 0, 1600000, 0, 0, 0, EmissionPointNumber,
iErr);
[EmissionPointNumber, iErr] = Physics_AddEmissionPoint(Lorentz,
'Points', 0, -15, 0, 0.4, 1, 0, 1600000, 0, 0, 0, EmissionPointNumber,
iErr);
[EmissionPointNumber, iErr] = Physics_AddEmissionPoint(Lorentz,
'Points', 0, -15, 0, 0.5, 1, 0, 1600000, 0, 0, 0, EmissionPointNumber,
iErr);
[iErr] = Solution_SetODE_ToRK4(Lorentz, 0.00000000001, 100, iErr);
[iErr] = Solution_RunSolver(Lorentz, iErr);

x = 0;
y = 0;
z = 0;
[iErr] = View_SetType_SolidTranslucent(Lorentz, iErr);
for i = 0 : 250
R = 10 - 2 * sin(i * pi / 360);
Theta = i * 1;
DirZ = 0.6 + 0.4 * sin(i * pi / 180);
dirY = sin(Theta * pi / 180);
dirX = cos(Theta * pi / 180);
[iErr] = View_SetDirection(Lorentz, dirX, dirY, DirZ, iErr);
[iErr] = View_SetZoomCenterRadius(Lorentz, x, y, z, R, iErr);
pause(0.04);
end

% uncomment or paste into Matlab to see all the LORENTZ API methods
% methodsview(Lorentz)

OTHER EXAMPLES
Your installed program contains a folder called API. This folder contains a
zip file with example projects in Excel, VisualStudio, and Matlab. Copy
this zip to a folder where you have read/write permission and unzip it
there. You can then copy the Matlab examples to your normal working
Matlab folders.

INTEGRATED ENGINEERING SOFTWARE


234 INTEGRATED API Guide

INTEGRATED ENGINEERING SOFTWARE

S-ar putea să vă placă și