Application | PLAXIS 2D PLAXIS 3D |
Version | PLAXIS 2D AE PLAXIS 3D |
Date created | 15 July 2014 |
Date modified | 15 July 2014 |
It is possible to create commands using the last created item from e.g. the previously executed command using so called array indexing. This consists of an opening square bracket behind a (listable) object name, followed by an integer (a whole number) and a matching closing bracket, for example to use the last created point:
Points[-1]
This integer indexing is zero-based and works on any listable object, i.e. any object on which you can fire a filter or tabulate command (examples: Points for all points, Plates for all plate objects, or Group_1 for a created group). The items in these lists are stored in the order the objects are created. Both positive and negative numbering can be used in this array indexing:
- the positive numbering starts at the top of the list, in which [0] is the first item from the table, [1] the second, etc.
- negative numbering starts from the bottom [-1] and goes up the list.
Example for PLAXIS 3D
0003> line (1 2 0) (5 1 0) (5 3 0) (4 7 0)
# Create points with coordinates specified in the brackets and lines connecting them
...
0004> tabulate Points "x y z" # List the created points and their coordinates
Object x y z
Point_1 1 2 0
Point_2 5 1 0
Point_3 5 3 0
Point_4 4 7 0
0005> move Points[0] -1 -2 0
# Relocate the first point, Point_1, to (0 0 0)
0006> move Points[-1] -1 -2 0 # Relocate the last added point, Point_4 to (3 5 0)
0007> move Points[-3] 1 2 0
# Relocate the third from last added point, Point_2 from (5 1 0) to (6 3 0)
Example of Plates in PLAXIS 2D AE
This array indexing also works for assigned user features (e.g. Plates). See this example below for PLAXIS 2D AE and notice the differences for e.g. Plates[-1] and Lines[-1].Plate:
0003> line (1 0) (6 0)
Added Point_1
Added Point_2
Added Line_1
0004> line (1 2) (1 6)
Added Point_3
Added Point_4
Added Line_2
0005> echo Lines[-1] #shows the last created line
Line named "Line_2"
First: Point named "Point_3"
Second: Point named "Point_4"
0006> echo Lines[-2] #shows the second last created line
Line named "Line_1"
First: Point named "Point_1"
Second: Point named "Point_2"
0007> plate lines[-1] #creates a plate on Line_2
Added Plate_1
0008> plate lines[-2] #creates a plate on Line_1
Added Plate_2
0009> echo Plates[-1]
Plate named "Plate_1" on Line_2
Material: <not assigned>
0010> echo Plates[-2]
Plate named "Plate_2" on Line_1
Material: <not assigned>
0011> echo Lines[-1].Plate #shows the last created line's plate
Plate named "Plate_1" on Line_2
Material: <not assigned>
0012> echo Lines[-2].Plate #shows the second last created line's plate
Plate named "Plate_2" on Line_1
Material: <not assigned>