Class vdPolyface
- Namespace
- VectorDraw.Professional.vdFigures
- Assembly
- VectorDraw.Professional.dll
Represents a polygonal surface (polyface) composed of vertices and faces. Provides geometry, rendering and editing operations for mesh-like 3D shapes such as triangulation, slicing, boolean operations and mapping of textures/images.
public class vdPolyface : vdFigure, IDisposable, IVDSerialise, IBaseObject
- Inheritance
-
vdPolyface
- Implements
- Derived
- Inherited Members
Examples
Create a cube polyface with 6 different colors for each side
var vertexlist = new gPoints(new gPoint[]
{
//bottom face points
new gPoint(0,0,0),
new gPoint(1,0,0),
new gPoint(1,1,0),
new gPoint(0,1,0),
//top face points
new gPoint(0,0,1),
new gPoint(1,0,1),
new gPoint(1,1,1),
new gPoint(0,1,1),
});
//note: the face list is defined as a list of quads (4 points for each face) and the fifth item is the palette color index for the face, if you set it to -1 it will use the default pen color of the polyface object
//vertex indexing starts from 1 in the face list and not from 0, so the first vertex in the vertex list is referenced as 1 in the face list
var facelist = new Int32Array(new int[]
{
//Note : set the fifth item of each face to -1 to use the default PenColor of the polyface object
//bottom face with palette color 0(red)
1,2,3,4,0,
//top face with palette color 1(yellow)
5,6,7,8,1,
//front face with palette color 2(green)
1,2,6,5,2,
//back face with palette color 3(cyan)
4,3,7,8,3,
//left face with palette color 4(blue)
1,4,8,5,4,
//right face with palette color 5(magenta)
2,3,7,6,5,
});
var polyface = new vdPolyface(doc, vertexlist, facelist);
doc.Model.Entities.AddItem(polyface);
doc.RenderMode = vdRender.Mode.Shade;
doc.CommandAction.View3D("VINE");
Remarks
The vdPolyface class implements vdFigure. It encapsulates vertex and face collections (see VertexList and FaceList), optional texture coordinates (TexCoords), mapped images (MappedImages) and gradient/elevation coloring (GradientColors).
Typical usage:
- Modify geometric data via VertexList and FaceList and call Update() to recalculate derived data (normals, bounds).
- Use provided operations such as Triangulate(ushort, double), Slice(gPoint, Vector), Cut(vdCurve, gPoint, bool, bool), CombinePolyfaces(vdPolyface, vdPolyface, BooleanOperation) and GetTriangles() to perform mesh editing and boolean combinations.
- When setting material/texture information ensure TexCoords and MappedImages are populated accordingly.
After modifying geometry programmatically, call Update() and, where appropriate, register or redraw the document to reflect visual changes.
Constructors
- vdPolyface()
Initializes the vdPolyface object.
- vdPolyface(gPoints, Int32Array)
Initializes a new instance of the vdPolyface object.
- vdPolyface(vdDocument)
Initializes a new instance of the vdPolyface object and registers it to the passed Document.
- vdPolyface(vdDocument, gPoints, Int32Array)
Initializes a new instance of the vdPolyface object and registers it to the passed Document.
Properties
- BoundingBox
Gets the Bounding Box of the vdPolyface object in WorldCoordinate System.
- CombineCuttedEdgesVisibility
Get/Set a boolean value that represents the visibility of the cutted edges when combining (boolean operations) vdPolyfaces.
- 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).
- Flag
Get/Set extra flags that controls polyface representation
- GradientColors
Get/Set an array of elevations with their colors used for gradient rendering.
- MappedImages
Get/Set the mapped images of the object.
- MeshDrawType
Determines the way that the object is drawn.
- SectionClipCoverFacesColor
Get/Set color that used to fill the Section clip faces. Default value is Color.Empty in order the vdDocument.GlobalRenderProperties.SectionClipCoverFacesColor color to be used.
- SelectingMode
Get/Set the selecting method of the polyface when you click either inside of a face or to the wireframe of the polyface.
- SmoothAngle
Get/Set the angle in degrees between 0 and 90 used to calculate normals for each vertex in each face when rendering a polyface object. Defines the maximun angle which is compared with the angles between the planes of neighboring faces in order to filter out the normals of the planes that will added in the average calculation.
- VertexList
A collection of all points of the vdPolyface object in World Coordinate System(WCS).
Methods
- Add3dFace(vd3DFace, bool)
Adds to the current vdPolyface object the passed face
- AddFaceItem(int, int, int, int, int)
Adds a face to the facelist of the object.
- Area()
Calculates the enclosed area of the vdPolyface object in Drawing Units.
- ClearUnusedVerticies()
Clears the vertexlist from unused vertices.
- ClearVerticies()
Clears all vertecies that are used twice from the object's vertexlist.
- CombinePolyfaces(vdPolyface, vdPolyface, BooleanOperation)
Combines two polyfaces using the passed operation
- CombinePolyfacesEx(vdPolyface, vdPolyface, BooleanOperation)
Combines two polyfaces using the passed operation
- CombinePolyfacesEx2(vdPolyface, vdPolyface, BooleanOperation)
Combines two polyfaces using the passed operation and returns a vdPolyface object
- CreateBox(gPoint, double, double, double, double)
Creates a Box to this polyface.
- CreateCone(gPoint, double, double, double, int)
Creates a cone to this polyface.
- CreateSphere(gPoint, double, int, int)
Creates a sphere to this polyface.
- CreateTorus(gPoint, double, double, int, int)
Creates s Torus using the passed parameters to this polyface.
- Cut(vdCurve, gPoint, bool, bool)
Cuts this polyface using the passed vdCurve object.
- Cut(vdCurve, gPoint, bool, bool, bool)
Cuts this polyface using the passed vdCurve object.
- DeSerialize(DeSerializer, string, object)
This Function is called foreach field name of the vdPolyface object when opening in vdml format.
- Dispose()
Releases all resources used by this object.
- Draw(vdRender)
Called in order to draw the object in a specified vdRender object.
- Explode()
Explodes the vdPolyface object into a vd3DFace objects.
If Flag is MultiTexture exploded produce entities of vdPolyface type equal to the number of MappedImages Count
- Generate3dPathSection(gPoints, vdArray<gPoints>, gPoint, double, double, Vector, Vector, bool, bool)
Modify a vdPolyface object following a given path and drawing a given section
- Generate3dPathSection(vdCurve, vdCurve, gPoint, int, double)
Modify a vdPolyface object following a given path and drawing a given section
- Generate3dPathSection(vdCurve, vdCurve, gPoint, int, double, Vector, Vector)
Modify a vdPolyface object following a given path and drawing a given section
- Generate3dPathSection(vdCurve, vdCurve, gPoint, int, double, Vector, Vector, bool)
Modify a vdPolyface object following a given path and drawing a given section
- Generate3dPathSection(vdCurve, vdPolyhatch, gPoint, int, double)
Modify a vdPolyface object following a given path and drawing a given vdPolyhatch section
- Generate3dPathSection(vdCurve, vdPolyhatch, gPoint, int, double, Vector, Vector)
Modify a vdPolyface object following a given path and drawing a given vdPolyhatch section
- Generate3dPathSection(vdCurve, vdPolyhatch, gPoint, int, double, Vector, Vector, bool)
Modify a vdPolyface object following a given path and drawing a given vdPolyhatch section
- GetCompareHash()
Returns a unique 32 bit integer value according to the object type and its properties values
- GetGripPoints()
A function returning the grip points of the object.
- GetIntersectionPoints(vdPolyface, vdPolyface)
Get the intersection gPoints collection where two closed polyfaces intersect.
- GetMappedImageAt(int)
Returns the VectorDraw.Render.IBindMappedImage at the specified index.
- GetMappedImages()
Returns an array of Images and their matrixes that applied over the Polyface object.
- GetNormals(vdRender, ref Vector[], ref Vector[], ref Int32Array)
Internally used. Calculate VertexNormals, FaceNormals and OrientedFaceList in order to be used from render. Values are saved to this object and recalculated on Update.
- GetNumMappedImages()
Returns the Number of IBindMappedImage
- GetPenStyleAtIndex(int, vdRender)
Returns the vdGdiPenStyle used by the passed render at index that is the fifth item of each face in the FaceList
- GetPlineRegion()
If all points of the polyface belong to the same plane and the polyface can be represented as a closed filled polyline then a vdPolyline object is calculated and returned.
- GetPolylineSlice(Vector, gPoint)
Get a collection of entities(polylines) that intersect this polyface with a plane.
- GetTableDependecies(vdTableDependeciesArgs)
Fills the passed vdTableDependeciesArgs args with all the table references of this object (vdLayer, vdBlock, vdDimstyle, vdLineType, vdTextstyle, vdImageDef, vdHatchPattern etc).
- GetTriangles()
Returns all triangle surfaces that consist the object.
- GetValidGripPointsItems()
Returns the number of valid grip points of the object. Must return the same number of points as the GetGripPoints() method.
- InitializeProperties()
Resets the properties of the vdPolyface object to the Default values.
- InternalSetOwner(vdBaseObject)
Internally used only.
Set the object owner
- MatchProperties(vdPrimary, vdDocument)
Matches all the common properties from an object and sets them to this object.
- MergePolyface(vdPolyface)
Adds to this polyface the passed polyface.
- MergeTriangles(gTriangles)
Adds a collection of triangles to this polyface.
- MoveGripPointsAt(Int32Array, double, double, double)
This function is intended to be called during a grip edit of the object.
- PushPull(vdCurve, double)
Combines this polyface with the passed curve and it's thickness.
- Serialize(Serializer)
This Function is called when saving the vdPolyface object to vdml format.
- Slice(gPoint, Vector)
Changes the vertexlist and facelist of the polyface in order to be sliced using a plane from the passed parameters.
- Slice(gPoint, Vector, bool, bool)
Changes the vertexlist and facelist of the polyface in order to be sliced using a plane from the passed parameters.
- Slice(gPoint, Vector, bool, bool, vdPolyface)
Changes the vertexlist and facelist of the polyface in order to be sliced using a plane from the passed parameters.
- SortFaceList()
Sort the FaceList depend on the fifth item of the face and when the Flag is MultiTexture User must call the SortFaceList after all vdPolyface properties are defined
- ToPolylines(double, bool, ProgressMeter)
Calculate all the closed vdPolyline regions each one contains all triangles belongs to the same plane.
- Transformby(Matrix)
Transforms all geometrical properties of this object by the specified Matrix.
- Triangulate(ushort, double)
Triangulates the VertexList points using Delaunay algorithm and change the FaceList with calculated triangles.
- Update()
Updates the object after change of properties.
- Volume(double, out double)
Calculates an Approximation of the Volume of the polyface object.Note that the vdPolyface must be closed in order to calculate the volume or the result will not be accurate.
- Volume(double, out double, out gPoint)
Calculates an Approximation of the Volume of the polyface object.Note that the vdPolyface must be closed in order to calculate the volume or the result will not be accurate.
- getOsnapPoints(Matrix, OsnapMode, gPoint, gPoint, int, OsnapPoints)
Overrrides the getOsnapPoints(Matrix, OsnapMode, gPoint, gPoint, int, OsnapPoints).
- isPointInside(gPoint)
Calculates if a point is inside a closed polyface.