## AddPointToNewPolygon

### Introduced

v1.5

### Description

Adds a point to the new polygon being created.
Note: This command uses output arguments. C# and some scripting languages (such as JScript, PerlScript and Python) don't support arguments passed by reference. Normally you can get the output arguments via either XSIApplication.ExecuteCommand method (C#) or the ISIVTCollection (scripting languages), but this command already returns a value.
The only available workaround in this case is to create a VBScript custom command which returns both the output arguments and the return value in one array. For details, see What Happens when the Function Already Returns a Value?.

### Scripting Syntax

    oLong = AddPointToNewPolygon( InputObj, X, Y, Z, [InsertPosition], [PolygonID] );

### Return Value

Returns the ID of the newly created point as a Long.

### Parameters

Parameter | Type | Description
--- | --- | ---
InputObj | String | Mesh object holding the polygon being built
X | Double | X coordinate
Y | Double | Y coordinate
Z | Double | Z coordinate
InsertPosition | Long | Ordinal of the vertex where to insert the new point in the polygon Default Value: 0
Possible Values: | Description:
0 | The point is added at the end of the list
0 | The point is inserted between vertices i-1 and i
PolygonID | Integer | ID of the polygon affected (-1 is returned if polygon has less than 3 points)

### Examples

#### VBScript Example

    ' Create a triangle

    dim obj, poly

    SIGetPrim "EmptyPolygonMesh", , , , obj

    SelectObj obj

    ApplyOp "CreatePolygon", obj, siUnspecified

    AddPointToNewPolygon obj, -2.229, 2.713, 0.000

    AddPointToNewPolygon obj, -3.140, -1.686, 0.000

    AddPointToNewPolygon obj, 1.744, -2.345, 0.000, , poly

    SelectObj obj & ".poly[" & poly & "]"

### See Also

ApplyOp ConnectNewPolygonToEdge ConnectNewPolygonToPoint RemovePointFromPolygon AddPointInteriorToPolygon RemoveLastPointInteriorToPolygon TerminateAddEdgeWithInteriorPoints SnapOffsetToPointForSlicePolygons