Professional Documents
Culture Documents
Macros
Flux10
Table of Contents
Forward.. ...................................................................................................... ..3
1.Creation of a New Macro ....................................................................................................... .4
1.1 Objective: ...................................................................................................................... 4
1.2 Macro Components and creation stages ........................................................................ 4
1.3 Example..5
1.4 Structure.6
1.5 Process...7
1.5.1 Create.py file...7
1.5.2 Create.txt file.............................................................................................10
1.5.3 Load the macro.11
1.5.4 Run the macro...12
1.6 Create_Line.pfm.12-14
2.Management and execution of macros.......15
Overview15
2.1 Management of macros15
2.2 Macro interface with Flux16
2.3 Running a macro..16
3.
This document outlines the process of Macro creation, installation, activation and execution in Flux V10
software, New 2D and 3D
Page
Macros
Flux10
Forward
Overview:
Page
Macros
Flux10
Introduction
This Chapter will give a general overview along with a specific example of
writing a Macro.
Contents
See Page
4
1.3 Example
1.4 Structure
7-13
13
a.
b.
c.
To write python command and parameterize the command using the macro format see
Sec. 1.4.
Page
Macros
Flux10
Stages
Description of file
Of
Creation
1
Required
applications
for macro creation
Flux
Flux
1.3 Example
Description
Action
1.4 Structure The structure of a file defining the macro (*.py) is presented in the example
below.
Page
Macros
Flux10
The Idle .py editor is the most efficient tool to use for writing pyflux scripts.
To download the python tutorial and IDLE .py editor.
http://www.python.org/
(useful when constructing .py files and macros)
The macro can be broken into 3 sections.
(1) Program
header
Part
Description
The Flux program header is compulsory. It specifies which Flux program (2D
and/or 3D) will execute the macro and its version*.
* The indicated version can correspond to the current software version or a
previous version.
(2) Description of This second section deals with the description of the input parameters of the
macro.
parameters
For each parameter it is necessary to define:
A parameter name
A Pyflux type
Minimal and maximal values corresponding to
the data structure
A default value or a keyword None
A label associated to the parameter
(this label appears in the dialogue box for the running macro)
(3)
Parameterized
function
Macros
Flux10
1.5 Process:
1.5.1 Create the .py file
We will examine the steps necessary in creating the
Page
Macros
Flux10
Page
Macros
Flux10
Page
Macros
Flux10
*This input file will be requested from the macro interface once the macro is loaded.
Input files are not necessary for all macros. This is dependent on the input format for the input
parameters. In this case geometric coordinates are required and are input using the .txt file.
The point.txt file is presented as follows:
Locate this in your project folder and navigate to it using the macro input interface.
extract point data and save the file under the name point.txt
Page 10
Macros
Flux10
Page 11
Macros
1.5.2
Flux10
Load the
Macro
1.5.3
Run the macro
Click on the Run command in the contextual menu of the macro
Fill out the fields in the dialog box Polypoint3D
After running the Polypoint3D macro, the user has the following 8 points in
his Flux project
(0, 0, 0), (3, 0, 0), (3, 2, 0), (2, 2, 0), (2, 1, 0), (1, 1, 0), (1, 2, 0), (0, 2, 0).
Page 12
Macros
Flux10
1.6 Create_line.pfm
Page 13
Macros
Flux10
#1
Header
#2 parameter
input interface
definition
Example of
input file
#3 a) Parameterized
Function interface
#3 b) Pyflux command
script
Page 14
Macros
Flux10
Overview
This section describes the steps required to manage and execute existing
macros.
Contents
2.1 Management
of macros
See Page
15
16
16
The user can load, unload and reload macros within the
project.
The Flux commands for the management of macros are
located in the Extensions menu. (see screenshots)
Page 15
Macros
Flux10
2.3
Running a
macro
The user can run a macro by using the Run command from the macro
contextual menu or by clicking on the corresponding icon. The dialog box
associated to the types of parameters is then displayed.
Page 16
Macros
Flux10
Contents
See Page
17
17
18
18
19
20
Create_Lines.PFM
Description
Executable macro that
creates cubic point
configuration from a
.txt file input in
3D(example in .py file)
Executable macro
creates lines .txt file
input(example in .py
file
Macros
3.1.3 Import Materials
Macros
Import_RCP_TTableFunc
tion.PFM
Flux10
Description cont.
Imports a table to
describe material
properties: Temp. Vs.
Specific heat (RhoCP
(rho density [kg/m] cp
specific heat capacity
[J/kg/K]))
Import_KT_IsotropicTTa Imports a table to
bleFunction.PFM
describe: Isotropic
Thermal Conductivity
Import_JE_TTableFunctio Imports a table to
n.PFM
describe: Temp Vs.
Rho (density)
Import_BH_NonlinearSpli Imports a property
ne.PFM
table to describe a nonlinear BH curve
Import_BH_MagnetNonli A macro to import the
nearSpline.PFM
B(H) values of a
Magnet Nonlinear
Spline
Import_BH_LinearTTable Imports properties for
Function.PFM
the B(H) values of a
Linear Temp. Table
Function
Page 18
Macros
Flux New 2d
assignSquirrelCage.PFM
BHSplinetoexcel.PFM
Flux10
Descriptions
Flux 3d
Import_ComposedCoil.PF
M
Page 19
Macros
animationColorShadeFace
Region.PFM
animationIsolineFaceRegi
onAC.PFM
ColorShadeFaceRegion.P
FM
IsolinesVectorPotential.P
FM
Flux10
Descriptions
Flux 3d
animationIsolineVolumeR
egionAC.PFM
Macros
Flux10
Page 21