    

 ## On this page

  

 

 # MacroFunction Class Reference

 Last update: 16.07.2025 

Definition of a single macro. [More...](class_macro_function.xhtml#details)

## <a name="pub-types"></a>Public Types

enum [eMeshType](class_macro_function.xhtml#a780e3ecd635a51b0fd95798865bf59b0) {   
 [ALL](class_macro_function.xhtml#a780e3ecd635a51b0fd95798865bf59b0ab1d5eac4b1dca480c8056eaea7663b7a) = 0, [FEM](class_macro_function.xhtml#a780e3ecd635a51b0fd95798865bf59b0a154e9b5357bed4c4d219188ca6307fbe), [GRID1D](class_macro_function.xhtml#a780e3ecd635a51b0fd95798865bf59b0aa98690ce8950c246c4f3f01a4f7a061a), [GRID2D](class_macro_function.xhtml#a780e3ecd635a51b0fd95798865bf59b0ae15336d9483644280ce6b341433a32f0),   
 [GRID3D](class_macro_function.xhtml#a780e3ecd635a51b0fd95798865bf59b0a77756f32ebdf41b872da13882c7f6537)  
 } the enum data type for defining teh data type of the argument in script context [More...](class_macro_function.xhtml#a780e3ecd635a51b0fd95798865bf59b0)  
 ## <a name="pub-methods"></a>Public Member Functions

 [addArg](class_macro_function.xhtml#a34c2f0688d085969931dacae1bbab572) ([MacroArg](class_macro_arg.xhtml) arg) adds a new argument to the end of the list [More...](#a34c2f0688d085969931dacae1bbab572)  
  [addRet](class_macro_function.xhtml#adc9ad59339429434f4f5264f7082e80c) ([MacroArg](class_macro_arg.xhtml) arg) adds a new return value to the end of the list [More...](#adc9ad59339429434f4f5264f7082e80c)  
 bool [builderCompatible](class_macro_function.xhtml#ad72b04d5c241d5013ae494a7e6a5444d) ()  [delArg](class_macro_function.xhtml#ab8089d0d94e8c2777b1d916d16e2156f) (number i) erases the given argument from the list [More...](#ab8089d0d94e8c2777b1d916d16e2156f)  
 <a id="a56070320bb7a6f0cfd74ef713e59841c"></a> [delArgs](class_macro_function.xhtml#a56070320bb7a6f0cfd74ef713e59841c) () erases all arguments from the list   
  [delRet](class_macro_function.xhtml#acda344069fda07e7be749a4275364fbc) (number i) erases the given return value from the list [More...](#acda344069fda07e7be749a4275364fbc)  
 <a id="abd586c3832e1d673892228ef81071f15"></a> [delRets](class_macro_function.xhtml#abd586c3832e1d673892228ef81071f15) () erases all return values from the list   
 string [generateAutoTestMacro](class_macro_function.xhtml#ab10c86a39058e4f25496e5aad78982be) () tries to generate a simplified test call of the defined function This may work, if all argument types are known. All values will be assigned to simplified defaults, like [More...](#ab10c86a39058e4f25496e5aad78982be)  
 [MacroArg](class_macro_arg.xhtml) [getArg](class_macro_function.xhtml#a5c9c67e6f862bcf8ca468c8a5d769b85) (number i) <a id="acec33d9069dae670176614e5edeec1b4"></a>string [getHelp](class_macro_function.xhtml#acec33d9069dae670176614e5edeec1b4) () gets m\_help   
 <a id="a8cf7d6a803e3c004fc7c8f79cfa68c30"></a>string [getIdent](class_macro_function.xhtml#a8cf7d6a803e3c004fc7c8f79cfa68c30) () gets m\_func\_ident   
 <a id="a84a62e79fc4db9e03a7c34ab3a2f703b"></a>string [getLongName](class_macro_function.xhtml#a84a62e79fc4db9e03a7c34ab3a2f703b) () gets m\_func\_name\_long   
 string [getMacro](class_macro_function.xhtml#a71c3844280543a40bb76c70a2c5a828b) () gets the macro's code [More...](#a71c3844280543a40bb76c70a2c5a828b)  
 [MacroArg](class_macro_arg.xhtml) [getRet](class_macro_function.xhtml#a3b07ee91fca517295ee33aeedcbc5dc1) (number i) std::vector&lt; [MacroArg](class_macro_arg.xhtml) &gt; [getRets](class_macro_function.xhtml#adab8ee51776d3ba36d190fd994869a34) () <a id="adcc1a50f0500aa749944c4f30718f745"></a>string [getShortName](class_macro_function.xhtml#adcc1a50f0500aa749944c4f30718f745) () gets m\_func\_name\_short   
 <a id="a2ad8a93da87e1c71eed3bbbcbc5e12e3"></a>string [getTestMacro](class_macro_function.xhtml#a2ad8a93da87e1c71eed3bbbcbc5e12e3) () Get cdoe to be executed to test this macro.   
 <a id="afeb5dfbeecea42a292841a25144bb201"></a>string [htmlHelp](class_macro_function.xhtml#afeb5dfbeecea42a292841a25144bb201) () Get a html-Format help text. Includes a complete set of information of this [MacroFunction](class_macro_function.xhtml "Definition of a single macro. "), including arguments.   
 bool [isHidden](class_macro_function.xhtml#a451227147204d105046094b758ce3438) () const <a id="a26650b23ff05d54b8790159090933669"></a> [MacroFunction](class_macro_function.xhtml#a26650b23ff05d54b8790159090933669) () default constructor   
 [eMeshType](class_macro_function.xhtml#a780e3ecd635a51b0fd95798865bf59b0) [meshType](class_macro_function.xhtml#a0c3181a72432b56a28e26dc267e03e9c) () const bool [needsMesh](class_macro_function.xhtml#a9efdd2c387facefb8690c0f75448947f) () number [numArg](class_macro_function.xhtml#acaf4e286d91a4645a3aab71156b80ce2) () number [numRet](class_macro_function.xhtml#a65713576dbee7b0aaec0f982d614ae78) () bool [operator&lt;](class_macro_function.xhtml#a47afb079614e0877c9fd531b4fb6f79f) ([MacroFunction](class_macro_function.xhtml) other) a comparison operator used for std::set usage [More...](#a47afb079614e0877c9fd531b4fb6f79f)  
 string [scriptChangeToFunction](class_macro_function.xhtml#a3f780bb95596a963c14d39e6c80915c9) (string var\_ident, [MacroFunction](class_macro_function.xhtml) other) identifies a script code that changes the function [More...](#a3f780bb95596a963c14d39e6c80915c9)  
  [setArg](class_macro_function.xhtml#a26d997c6d5bc337447cc8baf8e337c5c) (number i, [MacroArg](class_macro_arg.xhtml) arg) sets a new argument inside the vector [More...](#a26d997c6d5bc337447cc8baf8e337c5c)  
 <a id="a3dc08a85532b2bfe34ab8d7aa14dc87a"></a> [setHelp](class_macro_function.xhtml#a3dc08a85532b2bfe34ab8d7aa14dc87a) (string s) sets m\_help   
  [setHidden](class_macro_function.xhtml#ac1eae8f6cde9616c5f0fe828e3a2e2c4) () hide macro Obscure the macro string. (Notice: ANSYS does not guarantee a strong encryption.) [More...](#ac1eae8f6cde9616c5f0fe828e3a2e2c4)  
 <a id="a5f8048f93b77c41416eb9feb57f26dc2"></a> [setIdent](class_macro_function.xhtml#a5f8048f93b77c41416eb9feb57f26dc2) (string s) sets m\_func\_ident   
 <a id="a2cad93a8a0b6c7ef572cc4554484b4a5"></a> [setLongName](class_macro_function.xhtml#a2cad93a8a0b6c7ef572cc4554484b4a5) (string s) sets m\_func\_name\_long   
 <a id="a4ee7dec9efd650bb727b520b38deec17"></a> [setMacro](class_macro_function.xhtml#a4ee7dec9efd650bb727b520b38deec17) (string s) set the macro's code   
  [setMeshType](class_macro_function.xhtml#a9e30eaf87c226168dc670e9ddc448d20) ([eMeshType](class_macro_function.xhtml#a780e3ecd635a51b0fd95798865bf59b0) mesh\_type) sets the mesh type(s) being compatible with this macro [More...](#a9e30eaf87c226168dc670e9ddc448d20)  
  [setNeedsMesh](class_macro_function.xhtml#ac64f229a463a491cd30e37ff19fd9996) (bool needs\_mesh)  [setRet](class_macro_function.xhtml#aa201b9b70b6f4462cff2261c54c7fa3e) (number i, [MacroArg](class_macro_arg.xhtml) arg) sets a new return value inside the vector [More...](#aa201b9b70b6f4462cff2261c54c7fa3e)  
 <a id="a10ab3b142028e4504d8450c731f6dabd"></a> [setShortName](class_macro_function.xhtml#a10ab3b142028e4504d8450c731f6dabd) (string s) sets m\_func\_name\_short   
 <a id="a41c15fb3803eb47edfe16f762dc81241"></a> [setTestMacro](class_macro_function.xhtml#a41c15fb3803eb47edfe16f762dc81241) (string s) Set code to be executed to test this macro.   
 ## <a name="pub-static-methods"></a>Static Public Member Functions

static bool [validIdent](class_macro_function.xhtml#a21521140ed5f808426bd3cdaba87281a) (string s) <a id="details" name="details"></a>## Detailed Description

Definition of a single macro.



## Member Enumeration Documentation

<a id="a780e3ecd635a51b0fd95798865bf59b0"></a>## [◆ ](#a780e3ecd635a51b0fd95798865bf59b0)eMeshType

 enum [eMeshType](class_macro_function.xhtml#a780e3ecd635a51b0fd95798865bf59b0)

the enum data type for defining teh data type of the argument in script context

Enumerator<a id="a780e3ecd635a51b0fd95798865bf59b0ab1d5eac4b1dca480c8056eaea7663b7a"></a>ALL &lt; independent from mesh type (or all mesh types)

<a id="a780e3ecd635a51b0fd95798865bf59b0a154e9b5357bed4c4d219188ca6307fbe"></a>FEM &lt; unstructured meshes

<a id="a780e3ecd635a51b0fd95798865bf59b0aa98690ce8950c246c4f3f01a4f7a061a"></a>GRID1D &lt; 1d structurted grids, eg. signals

<a id="a780e3ecd635a51b0fd95798865bf59b0ae15336d9483644280ce6b341433a32f0"></a>GRID2D &lt; 2d structured grids, eg. matrices

<a id="a780e3ecd635a51b0fd95798865bf59b0a77756f32ebdf41b872da13882c7f6537"></a>GRID3D &lt; 3d structured grids, eg. voxels





## Member Function Documentation

<a id="a34c2f0688d085969931dacae1bbab572"></a>## [◆ ](#a34c2f0688d085969931dacae1bbab572)addArg()

 addArg  ( [MacroArg](class_macro_arg.xhtml)  *arg*) 

adds a new argument to the end of the list

Parameters argthe argument to be added 



<a id="adc9ad59339429434f4f5264f7082e80c"></a>## [◆ ](#adc9ad59339429434f4f5264f7082e80c)addRet()

 addRet  ( [MacroArg](class_macro_arg.xhtml)  *arg*) 

adds a new return value to the end of the list

Parameters argthe return value to be added 



<a id="ad72b04d5c241d5013ae494a7e6a5444d"></a>## [◆ ](#ad72b04d5c241d5013ae494a7e6a5444d)builderCompatible()

 bool builderCompatible  ( ) 

Returnstrue if this funtion can be used in the MacroBuilder 



<a id="ab8089d0d94e8c2777b1d916d16e2156f"></a>## [◆ ](#ab8089d0d94e8c2777b1d916d16e2156f)delArg()

 delArg  ( number  *i*) 

erases the given argument from the list

Parameters ithe existing index to be deleted, starting with 0 



<a id="acda344069fda07e7be749a4275364fbc"></a>## [◆ ](#acda344069fda07e7be749a4275364fbc)delRet()

 delRet  ( number  *i*) 

erases the given return value from the list

Parameters ithe existing index to be deleted, starting with 0 



<a id="ab10c86a39058e4f25496e5aad78982be"></a>## [◆ ](#ab10c86a39058e4f25496e5aad78982be)generateAutoTestMacro()

 string generateAutoTestMacro  ( ) 

tries to generate a simplified test call of the defined function This may work, if all argument types are known. All values will be assigned to simplified defaults, like

- strings: empty
- numbers: 0
- matrices: 1x1, zero Returnsthe genrated test code or empty string (if not able to generate one)





<a id="a5c9c67e6f862bcf8ca468c8a5d769b85"></a>## [◆ ](#a5c9c67e6f862bcf8ca468c8a5d769b85)getArg()

 [MacroArg](class_macro_arg.xhtml) getArg  ( number  *i*) 

Returnsa reference to the specified argument Parameters ithe index of the argument, starting with 0 



<a id="a71c3844280543a40bb76c70a2c5a828b"></a>## [◆ ](#a71c3844280543a40bb76c70a2c5a828b)getMacro()

 string getMacro  ( ) 

gets the macro's code

Exceptions execptionif the macro is hidden 



<a id="a3b07ee91fca517295ee33aeedcbc5dc1"></a>## [◆ ](#a3b07ee91fca517295ee33aeedcbc5dc1)getRet()

 [MacroArg](class_macro_arg.xhtml) getRet  ( number  *i*) 

Returnsa reference to the specified return value Parameters ithe index of the return value, starting with 0 



<a id="adab8ee51776d3ba36d190fd994869a34"></a>## [◆ ](#adab8ee51776d3ba36d190fd994869a34)getRets()

 std::vector&lt;[MacroArg](class_macro_arg.xhtml)&gt; getRets  ( ) 

Returnsa reference to the vector of MacroArgs 



<a id="a451227147204d105046094b758ce3438"></a>## [◆ ](#a451227147204d105046094b758ce3438)isHidden()

 bool isHidden  ( )  const

Returnstrue if the macro is hidden 



<a id="a0c3181a72432b56a28e26dc267e03e9c"></a>## [◆ ](#a0c3181a72432b56a28e26dc267e03e9c)meshType()

 [eMeshType](class_macro_function.xhtml#a780e3ecd635a51b0fd95798865bf59b0) meshType  ( )  const

Returnsthe mesh type(s) being compatible with this macro 



<a id="a9efdd2c387facefb8690c0f75448947f"></a>## [◆ ](#a9efdd2c387facefb8690c0f75448947f)needsMesh()

 bool needsMesh  ( ) 

Returnstrue if this function needs a mesh 



<a id="acaf4e286d91a4645a3aab71156b80ce2"></a>## [◆ ](#acaf4e286d91a4645a3aab71156b80ce2)numArg()

 number numArg  ( ) 

Returnsthe number of defined arguments 



<a id="a65713576dbee7b0aaec0f982d614ae78"></a>## [◆ ](#a65713576dbee7b0aaec0f982d614ae78)numRet()

 number numRet  ( ) 

Returnsthe number of defined return values 



<a id="a47afb079614e0877c9fd531b4fb6f79f"></a>## [◆ ](#a47afb079614e0877c9fd531b4fb6f79f)operator&lt;()

 bool operator&lt;  ( [MacroFunction](class_macro_function.xhtml)  *other*) 

a comparison operator used for std::set usage

Parameters otherthe other function to be compared Returnstrue if the ident of this function is "smaller" than the ident of the other function. NoteThe "smaller" operator also checks if "numbers" are at the end of the ident, we try to resolve this according to "human ordering", e.g. "chunk\_9" &lt; "chunk\_10" 



<a id="a3f780bb95596a963c14d39e6c80915c9"></a>## [◆ ](#a3f780bb95596a963c14d39e6c80915c9)scriptChangeToFunction()

 string scriptChangeToFunction  ( string  *var\_ident*,    [MacroFunction](class_macro_function.xhtml)  *other*   ) 

identifies a script code that changes the function

Parameters otherthe other function wotr which the differences are checked. var\_identthe variable ident in script to be changed. Returnsthe script code to change this function to match the other on 



<a id="a26d997c6d5bc337447cc8baf8e337c5c"></a>## [◆ ](#a26d997c6d5bc337447cc8baf8e337c5c)setArg()

 setArg  ( number  *i*,    [MacroArg](class_macro_arg.xhtml)  *arg*   ) 

sets a new argument inside the vector

Parameters ian existing index in the list, starting with 0 argthe new argument to be set 



<a id="ac1eae8f6cde9616c5f0fe828e3a2e2c4"></a>## [◆ ](#ac1eae8f6cde9616c5f0fe828e3a2e2c4)setHidden()

 setHidden  ( ) 

hide macro Obscure the macro string. (Notice: ANSYS does not guarantee a strong encryption.)

Warningcannot be undone 



<a id="a9e30eaf87c226168dc670e9ddc448d20"></a>## [◆ ](#a9e30eaf87c226168dc670e9ddc448d20)setMeshType()

 setMeshType  ( [eMeshType](class_macro_function.xhtml#a780e3ecd635a51b0fd95798865bf59b0)  *mesh\_type*) 

sets the mesh type(s) being compatible with this macro

Parameters mesh\_typethe new value 



<a id="ac64f229a463a491cd30e37ff19fd9996"></a>## [◆ ](#ac64f229a463a491cd30e37ff19fd9996)setNeedsMesh()

 setNeedsMesh  ( bool  *needs\_mesh*) 

Parameters setsthe property if the function needs mesh needs\_meshtrue if this function needs a mesh 



<a id="aa201b9b70b6f4462cff2261c54c7fa3e"></a>## [◆ ](#aa201b9b70b6f4462cff2261c54c7fa3e)setRet()

 setRet  ( number  *i*,    [MacroArg](class_macro_arg.xhtml)  *arg*   ) 

sets a new return value inside the vector

Parameters ian existing index in the list, starting with 0 argthe new return value to be set 



<a id="a21521140ed5f808426bd3cdaba87281a"></a>## [◆ ](#a21521140ed5f808426bd3cdaba87281a)validIdent()

 static bool validIdent  ( string  *s*)   static 

Returnstrue if the ident s can be used in Lua Parameters sthe ident to be checked