Drawings SDK Developer Guide > Working with .dwg Files > Working with Entities > Working with Specific Entitites > Working with 3D Faces > Specific 3D Face Properties
Specific 3D Face Properties

A face object uses four vertices and four edges to define the geometry to be drawn. In examples, the pFace variable stores a pointer to the face object.

Vertices

The Vertices property defines four vertices of the face in three-dimensional coordinates. Vertices are enumerated as 0, 1, 2, 3 and either can lie in the same plane or world space (3D). All vertices are connected by linear segments in a closed quadrangular figure. The end of the current segment is the start of the next segment and the last segment connects with the first segment. Linear segments are edges which are also enumerated as 0, 1, 2, and 3. When two vertices coincide, a triangle will be drawn. All vertices have the coordinates (0,0,0) by default.

To get the vertex, use the getVertexAt() method which requires a vertex index in the range 0 to 3 as the first argument of an Integer type, requires a reference to an existing three-dimensional point instance as the second argument of the OdGePoint3d type, and returns the specified vertex through the second argument. For example:


OdGePoint3d vertex0, vertex1, vertex2, vertex3;

pFace->getVertexAt(0, vertex0);
pFace->getVertexAt(1, vertex1);
pFace->getVertexAt(2, vertex2);
pFace->getVertexAt(3, vertex3);

odPrintConsoleString(L"\nVertex(0) = (%g,%g,%g)", vertex0.x, vertex0.y, vertex0.z);
odPrintConsoleString(L"\nVertex(1) = (%g,%g,%g)", vertex1.x, vertex1.y, vertex1.z);
odPrintConsoleString(L"\nVertex(2) = (%g,%g,%g)", vertex2.x, vertex2.y, vertex2.z);
odPrintConsoleString(L"\nVertex(3) = (%g,%g,%g)", vertex3.x, vertex3.y, vertex3.z);

To set the vertex, use the setVertexAt() method which requires a vertex index in the range 0 to 3 as the first argument of an Integer type, requires a three-dimensional point as the second argument of the OdGePoint3d type, and does not return a value. For example:


OdGePoint3d point0(1.2, 1.7, 1.5);
OdGePoint3d point1(6.5, 2.5, 2.6);
OdGePoint3d point2(9.4, 9.8, 0.3);
OdGePoint3d point3(2.3, 7.2, 2.2);

pFace->setVertexAt(0, point0);
pFace->setVertexAt(1, point1);
pFace->setVertexAt(2, point2);
pFace->setVertexAt(3, point3);

Edges

The Edges property defines the visibility for four edges of the face as a Boolean value. If the property is True, the corresponding edge is visible. If the property is False, the corresponding edge is invisible. Each edge can be switched independently. All edges are visible (True) by default.

To check the edge visibility, use the isEdgeVisibleAt() method which requires a vertex index in the range 0 to 3 as an Integer argument and returns True when the specified edge is visible or False when the specified edge is invisible. For example:


odPrintConsoleString(L"\nEdge(0) is %s", ((pFace->isEdgeVisibleAt(0)) ? L"visible" : L"invisible"));
odPrintConsoleString(L"\nEdge(1) is %s", ((pFace->isEdgeVisibleAt(1)) ? L"visible" : L"invisible"));
odPrintConsoleString(L"\nEdge(2) is %s", ((pFace->isEdgeVisibleAt(2)) ? L"visible" : L"invisible"));
odPrintConsoleString(L"\nEdge(3) is %s", ((pFace->isEdgeVisibleAt(3)) ? L"visible" : L"invisible"));

To switch the edge visibility, use the makeEdgeVisibleAt() method which requires a vertex index in the range 0 to 3 as an Integer argument and makes the specified edge visible or the makeEdgeInvisibleAt() method which requires a vertex index in the range 0 to 3 as an Integer argument and makes the specified edge invisible. For example:


pFace->makeEdgeVisibleAt(0);
pFace->makeEdgeInvisibleAt(1);
pFace->makeEdgeVisibleAt(2);
pFace->makeEdgeInvisibleAt(3);

See Also

Working with 3D Faces

Example of Working with the 3D Face Object

Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.