Inserts a new vertex into polygon or polyline. If the vertexType is nonzero, it will convert the objectHandle into a polyline.
PROCEDURE InsertVertex(
objectHandle : HANDLE;
x : REAL;
y : REAL;
beforeVertexNum : INTEGER;
vertexType : INTEGER;
arcRadius : REAL);def vs.InsertVertex(objectHandle, x, y, beforeVertexNum, vertexType, arcRadius):
return None| Name | Type | Description |
|---|---|---|
| objectHandle | HANDLE | Handle to the polygon or polyline |
| x | REAL | X-coordinate of the vertex to add |
| y | REAL | Y-coordinate of the vertex to add |
| beforeVertexNum | INTEGER | Vertex number before which the new vertex is to be inserted |
| vertexType | INTEGER | Vertex type of the new vertex: 0 =Corner; 1= Bezier; 2= Cubic; 3= Arc; |
| arcRadius | REAL | For arc vertices, the radius of the arc |
_c_, (2010.12.23) The routine also when used for adding an arc vertex needs a correction of the arc passed:
- pass "0" --> a radius for arc on circle by three points will be autogenerated
- pass anything else (custom radius): you need to convert the radius to mm: ** arcRadius := arcRadius / upi * 25.4;
It is not possible insert a vertex as type 4 (radius vertex). You must insert the vertex first, then use SetPolylineVertex to change the type to 4.
{ If Config is 'Sort' insert the intersecting point of the two additional lines
in the object as otherwise the lines will not be part of the polyline. }
tempH := MakePolyline( FInGroup( objH ) );
GetSegPt2( NextObj( tempH ), tempPt.x, tempPt.y );
InsertVertex( tempH, tempPt.x, tempPt.y, 4, 0 , 0 );
SetPolyClosed( tempH, TRUE );
MakePoly := tempH;
END;
FOR vertexNum := 1 TO GetVertNum( tempPolyH ) DO BEGIN
GetPolylineVertex( tempPolyH, vertexNum, pX, pY, vertexType, arcRadius );
InsertVertex( polylineH, pX, pY, 1, vertexType, arcRadius );
SetVertexVisibility( polylineH, 1, TRUE );
END;
n := GetVertNum(hPoly);
GetPolyPt(hPoly, 1, x1, y1);
GetPolyPt(hPoly, n, xn, yn);
IF (x1 <> xn) | (y1 <> yn) THEN
InsertVertex(hPoly, x1, y1, n+1, 0, 0);
SetPolyClosed(hPoly, FALSE);
END;import vs
# Inserts a new vertex into polygon or polyline.
objectHandle = vs.FSActLayer() # handle to the first selected object on the active layer
x = 0.0
y = 0.0
beforeVertexNum = 1
vertexType = 0
arcRadius = 1.0
vs.InsertVertex(objectHandle, x, y, beforeVertexNum, vertexType, arcRadius)Availability: from VectorWorks 10.0