Table of Contents

Method AddPolyface

Namespace
vdWebLibrary
Assembly
JsPropertiesExtractor.dll

AddPolyface(object[], object[], bool, object)

Adds a new vdPolyface in the document.

There is a property of the polyface DrawEdges which by default is undefined.

If it is true the edge lines are drawn using the active PenColor of the polyface.

When the render mode is Shade or Render the color of the faces is specified by the fifth element of each face of the face list and the width of edge lines

can be changed by set a bigger value of line weight.

When WebGl is active so we use RenderGl or ShadeGl note that the line width of edge lines is always one pixel by a limitation of WebGl.

Also a new propery ApplyDrawEdges of canvas has been added which by default is true so the edge lines of polyfaces will be drawn.

We can set it to false in order not to be drawn any edge line of all the polyfaces of the document.For more information see ApplyDrawEdges

NOTE also that the edge lines of the polyface have NOT compatibility with the VDF component.This feature is only for WebControl.

public object AddPolyface(object[] points, object[] facelist, bool drawit, object entities)

Parameters

points object[]

A collection of all points (x,y,z) of the vdPolyface object in World Coordinate System(WCS).

facelist object[]

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 bool

Defines if the vdPolyline object will be drawn.

entities object

The entities collection where the polyline will be added. This can be the entities of layout or a block.

Returns

object

The vdPolyface object created.

Examples

//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
                    ];

var vdpolyface = vdcanvas.AddPolyface(VertexList, FaceList, true);
vdpolyface.DrawEdges = false;// Not to be drawn the edge lines of the polyface on render and shade mode.
vdcanvas.UpdateFig(vdpolyface);//update the polyface object in order to get the change.
setTimeout(vdcanvas.redraw);//and post a redraw to see the new polyface.