version 6.0
DR POLYGON TO ARRAY (area; scope; arrayH; arrayV{; bezier})
| Parameter | Type | Description | |
| area | Longint | 4D Draw area | |
| scope | Longint | -1 = Vertices of first object | |
| 0 = Vertices of selected object | |||
| >0 = Object ID | |||
| arrayH | Numeric array | Array of horizontal values for vertices | |
| arrayV | Numeric array | Array of vertical values for vertices | |
| bezier | Numeric array | 1=Bezier control point | |
| 0=Not a Bezier control point |
Description
The command DR POLYGON TO ARRAY returns into the arrays arrayH and arrayV, the position for each vertex of the polygon described by scope.
If scope equals -1, the command returns the vertices of the first object in the document.
If scope equals 0, the command returns the vertices of the first object selected.
If scope is greater than 0, it must be equal to a specific polygon's ID; the command returns that polygon's vertices. If the object does not exist, DR POLYGON TO ARRAY returns empty arrays, and DR Error returns error number 2.
If the object described by scope is not a polygon, DR POLYGON TO ARRAY returns empty arrays and DR Error returns error number 47.
arrayH and arrayV are the horizontal and vertical positions for each vertex of the polygon; these are expressed in base units. Use the DR ARRAY BASE TO SCALE command to convert an array of base units to scale units. arrayH and arrayV can be arrays of type Real, Longint, or Integer, and must exist before calling DR POLYGON TO ARRAY. If you use one of the more restrictive array types (Longint or Integer), some information may be lost because values are truncated to whole numbers.
The bezier parameter lets you determine whether or not a control point is a Bezier control point. Bezier control points can only be created with the DR POLYGON CURVE command.
Example
The following example fills two arrays with the vertices of the selected polygon. It then uses the 4th Dimension command ARRAY TO SELECTION to create records based on the values in the arrays.
ARRAY REAL(ArrayH;0) `Declare the arrays ARRAY REAL(ArrayV;0) DR POLYGON TO ARRAY (Area;0;ArrayH;ArrayV) `Get vertices If (DR Error=0) ARRAY TO SELECTION (ArrayH;[Polygon]FieldH;ArrayV;[Polygon]FieldV) `Create records End if
See Also
DR Array to polygon, DR Get object type.