%%PageItemTitle%%

VectorDraw Web Library

JsPropertiesExtractor Send comments on this topic.
AddPolyface Method
See Also  Example
vdWebLibrary Namespace > vdrawObj Class : AddPolyface Method
points
A collection of all points (x,y,z) of the vdPolyface object in World Coordinate System(WCS).
facelist
A collection of integers indicating for each face four edges that rest on each of the face's 4 points. Also the color the face has (the fifth value of every face, if -1 the object's color is used). If any of the four edge values is negative, this edge is not drawn (the face is drawn normally).
drawit
Defines if the vdPolyline object will be drawn.
entities
The entities collection where the polyline will be added. This can be the entities of layout or a block.
Adds a new vdPolyface in the document.

Syntax

JScript 
public function AddPolyface( 
   points : Object[],
   facelist : Object[],
   drawit : boolean,
   entities : Object
) : Object;

Parameters

points
A collection of all points (x,y,z) of the vdPolyface object in World Coordinate System(WCS).
facelist
A collection of integers indicating for each face four edges that rest on each of the face's 4 points. Also the color the face has (the fifth value of every face, if -1 the object's color is used). If any of the four edge values is negative, this edge is not drawn (the face is drawn normally).
drawit
Defines if the vdPolyline object will be drawn.
entities
The entities collection where the polyline will be added. This can be the entities of layout or a block.

Return Value

The vdPolyface object created.

Example

C#Copy Code
//create a box with size 1x1x1 (width x length x height) at point 0,0,0 
//define the vertex list of the box with 8 points 
var VertexList = [ 
                      [0, 0, 0], 
                      [1, 0, 0], 
                      [1, 1, 0], 
                      [0, 1, 0], 
                      [0, 0, 1], 
                      [1, 0, 1], 
                      [1, 1, 1], 
                      [0, 1, 1] 
                  ]; 
//Each face consists by 4  boundary points 
//in the facelist we define each vertex of face by the index in the VertexList (First index is 1) 
//The fith item in each face represents the color index from document Palette. If it is -1 the vdPolyface color will be used. 
//If the vertex index is negative then the edge that begins with this vertex will be invisible in wire render mode. 
        var FaceList = [ 
                  1, 2, 3, 4, 1,//first face from indexes 1,2,3,4 and Color index 1. 
                  5, 6, 7, 8, 2,//2nd face from indexes 5, 6, 7, 8 and Color index 2. 
                  1, 2, 6, 5, 3, 
                  2, 3, 7, 6, 4, 
                  3, 4, 8, 7, 5, 
                  4, 1, 5, 8, 6 
                    ]; 
vdcanvas.AddPolyface(VertexList, FaceList, true);

See Also