AddPolyfaceMesh Example

Using Programming Languages other than VBA

Sub Example_AddPolyfaceMesh()

	Dim vertexList(0 To 17) As Double

	'Data
	vertexList(0) = 4: vertexList(1) = 7: vertexList(2) = 0
	vertexList(3) = 5: vertexList(4) = 7: vertexList(5) = 0
	vertexList(6) = 6: vertexList(7) = 7: vertexList(8) = 0
	vertexList(9) = 4: vertexList(10) = 6: vertexList(11) = 0
	vertexList(12) = 5: vertexList(13) = 6: vertexList(14) = 0
	vertexList(15) = 6: vertexList(16) = 6: vertexList(17) = 1


	Dim FaceList(0 To 7) As Integer

	FaceList(0) = 1
	FaceList(1) = 2
	FaceList(2) = 5
	FaceList(3) = 4
	FaceList(4) = 2
	FaceList(5) = 3
	FaceList(6) = 6
	FaceList(7) = 5

	Dim obj As AcadPolyfaceMesh
	Set obj = ModelSpace.AddPolyfaceMesh(vertexList, FaceList)
	obj.Update

	' Change the viewing direction of the viewport to
	' better see the polyface mesh
	Dim NewDirection(0 To 2) As Double
	NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
	ThisDrawing.ActiveViewport.direction = NewDirection
	ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
	ZoomAll
End Sub

 

   Comments?