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:
- Go to the Macro library menu item (available under the Expert menu)
- Here choose to manage the library
- And add a new Macro
- Give it a descriptive title
- And add the commands you would like to perform when executing this 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
- a max. of 2 CPUs (cores)
- and you want to store 10 steps for each phase.
You can write this macro for it:
groupfiltered Phases "PreviousPhase!="# all except the initial phaseapply Groups[-1]"setproperties""MaxCores"2apply Groups[-1]"setproperties""MaxStepsStored"10ungroup 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:
gotostagesgroupfiltered Phases"ShouldCalculate=True"groupfilteredGroups[-1]"PreviousPhase<>"applyGroups[-1]"sps""MaxCores"2#insert here the number of CPUsapplyGroups[-1]"sps""MaxStepsStored"10#max steps to save per phaseungroupGroups[-1]ungroupGroups[-1]calculate
Switch to Updated Mesh
To change all phases to use Updated Mesh, you can use this macro:
gotostagesgroupfiltered Phases"ShouldCalculate=True"groupfilteredGroups[-1]"PreviousPhase<>"applyGroups[-1]"sps""Deform.UseUpdatedMesh"TrueapplyGroups[-1]"sps""Deform.UseUpdatedWaterPressures"True#2D ONLYungroupGroups[-1]ungroupGroups[-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:
tabulatephases"PreviousPhaseReached.ReachedMsf""DeformCalcType=Safety"