Macros using the commands runner


ApplicationPLAXIS 2D
PLAXIS 3D
VersionPLAXIS 2D
PLAXIS 3D
Date created08 June 2015
Date modified08 June 2015

When using certain command templates multiple times, it would be helpful if you can re-play these commands with just a single click. With a Macro you can do this: you can easily play a set of predefined commands.

Creating a macro

To create a macro:

Figure 1. The Macros library window

Using a macro

In order to make use of a macro, open the menu item Expert > Macro library > and here you will see the available macros. Now click on a macro to execute it.

Figure 2. Macros in the Expert menu

Keyboard shortcuts

Next to using the menu item to run a macro, PLAXIS also offers to execute a command via a keyboard shortcut. The first macro will be accessible via the key combination Shift + Ctrl + Alt + 1. This keyboard shortcut is also shown in the menu Expert > Macro library, see in the image above.

Examples

Tip: to make any command more flexible and useful in any Plaxis model, use the Group Filtered and Apply commands [link] in combination with the possibility to refer to any object using their index [link]. See also the examples below.

Calculation settings

Let’s say you have a large project with many phases and want to switch all of them except the initial one to use

You can write this macro for it:

groupfiltered Phases "PreviousPhase!=" # all except the initial phase
apply Groups[-1] "setproperties" "MaxCores" 2
apply Groups[-1]"setproperties" "MaxStepsStored" 10
ungroup Groups[-1]  # get rid of temporary group to leave model clean

This will work regardless of how many phases and/or groups you already have. It will only fail if you just have the initial phase, as that would try to create an empty group at the beginning.

Or, if you want to only change this for all the phases that are set to be calculated, we can add a new filter (groupfiltered command) to only use phases that are set to be calculated (ShouldCalculate == True), and then directly calculate it:

gotostages
groupfiltered Phases "ShouldCalculate=True"
groupfiltered Groups[-1] "PreviousPhase<>"
apply Groups[-1] "sps" "MaxCores" 2 #insert here the number of CPUs
apply Groups[-1] "sps" "MaxStepsStored" 10 #max steps to save per phase
ungroup Groups[-1]
ungroup Groups[-1]
calculate

Switch to Updated Mesh

To change all phases to use Updated Mesh, you can use this macro:

gotostages
groupfiltered Phases "ShouldCalculate=True"
groupfiltered Groups[-1] "PreviousPhase<>"
apply Groups[-1] "sps" "Deform.UseUpdatedMesh"
True apply Groups[-1] "sps" "Deform.UseUpdatedWaterPressures" True #2D ONLY
ungroup Groups[-1]
ungroup Groups[-1]

Note that UpdatedWaterPressures is currently (2015) only available in PLAXIS 2D.

Geometry checks for meshing in PLAXIS 3D

The tabulate command can also be used to detect if small surfaces or volumes are present in the intersected 3D geometry in the mesh mode. This could indicate problem areas for the 3D mesh generation.
To check for small volumes ( < 1 m3), small surfaces (e.g. a surface area < 0.1 m2) and small lines, you can use this macro:

tabulate SoilVolumes "Volume" "Volume<1"
tabulate Volumes "Volume" "Volume<1"
tabulate Surfaces "Area" "Area<0.1"
tabulate Lines "Length" "Length<0.1"

Show a table of safety factors

To show a table of the SumMsf values, you can use this single command as a macro to quickly get this table in the Input program:

 tabulate phases "PreviousPhase Reached.ReachedMsf" "DeformCalcType=Safety"

See also