## ConnectNewPolygonToPoint

### Introduced

v1.5

### Description

Adds a point to the polygon being created and shares it with an existing point.

### Scripting Syntax

    oLong = ConnectNewPolygonToPoint( InputObj, PointID, [InsertPosition], [InvertPolygon] );

### Return Value

Returns the ID of the polygon affected as a Long (-1 is returned if polygon has less than 3 points)

### Parameters

Parameter | Type | Description
--- | --- | ---
InputObj | String | Mesh holding the polygon being built
PointID | Integer | ID of the target point to connect with
Possible Values: | Description:
0<=i | index of the point in the mesh
InsertPosition | Long | Ordinal of the vertex where to insert that 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 of the polygon
InvertPolygon | Boolean | true if the adjacent polygon(s) should be inverted before accomodating a CW-CCW connection Default Value: false

### Examples

#### VBScript Example

    ' Add a quad to a grid and connect one of its points to an existing point
    dim obj, poly
    set obj = CreatePrim( "Grid", "MeshSurface" )
    SelectObj obj
    ApplyOp "CreatePolygon", obj, siUnspecified
    AddPointToNewPolygon obj, -6.088, 0.0, 0.864
    AddPointToNewPolygon obj, -6.345, 0.0, 2.953
    poly = ConnectNewPolygonToPoint( obj, 16, 0 )
    SelectObj obj & ".poly[" & poly & "]"

### See Also

ApplyOp AddPointToNewPolygon ConnectNewPolygonToEdge