Example 1
- Last UpdatedJan 07, 2026
- 1 minute read
This example is a macro creating some simple geometry.
!
! All macros begin with the MACRO-stmt
!
MACRO,RECTANGLE;
GET/POINT_2D=('Give first corner',P1)
/POINT_2D=('Give second corner',P3);
ASSIGN,X1,P1/XCOORD;
ASSIGN,Y1,P1/YCOORD; ! The x- and y-coordinates
ASSIGN,X2,P3/XCOORD; ! of the 2 points are needed
ASSIGN,Y2,P3/YCOORD;
POINT_2D,P2,X1,Y2; ! Create the other
POINT_2D,P4,X2,Y1; ! two corners
CONTOUR,CNT,P1
/LINEEND = P2
/LINEEND = P3 ! Create a contour
/LINEEND = P4
/LINEEND = P1;
PRESENT,CNT; ! Display the contour
!
! All macros end with the ENDMACRO-stmt
!
ENDMACRO;
In the macro RECTANGLE, the contour was created using the four 2D points. In some cases, it might be more convenient to define a contour with lines instead. The macro above will then look like this:
MACRO,RECTANGLE;
GET/POINT_2D=('Give first corner',P1)
/POINT_2D=('Give second corner',P3);
ASSIGN,X1,P1/XCOORD;
ASSIGN,Y1,P1/YCOORD;
ASSIGN,X2,P3/XCOORD;
ASSIGN,Y2,P3/YCOORD;
POINT_2D,P2,X1,Y2;
POINT_2D,P4,X2,Y1;
LINE,L1,P1/LINEEND=P2;
LINE,L2,P2/LINEEND=P3;
LINE,L3,P3/LINEEND=P4;
LINE,L4,P4/LINEEND=P1;
CONTOUR,CNT
/LINE = L1
/LINE = L2
/LINE = L3
/LINE = L4;
PRESENT,CNT;
ENDMACRO;
Note: The CONTOUR statement looks different now. In the first case, the start point must be given but in the second case this point is the start point of the first line.