VisibilityEdge4 Example

Using Programming Languages other than VBA

Sub Example_VisibilityEdge4()
	' This example creates a 3D Face in model space and allows the user to
	' control the visibility of the edges

	Dim faceObj As Acad3DFace
	Dim point1(0 To 2) As Double, point2(0 To 2) As Double, _
		point3(0 To 2) As Double, point4(0 To 2) As Double
	Dim Edge1Msg As String, Edge2Msg As String, _
		Edge3Msg As String, Edge4Msg As String

	' Define the four coordinates of the face
	point1(0) = 0: point1(1) = 0: point1(2) = 0
	point2(0) = 5: point2(1) = 0: point2(2) = 1
	point3(0) = 1: point3(1) = 10: point3(2) = 0
	point4(0) = 5: point4(1) = 5: point4(2) = 1

	' Create the 3DFace object in model space
	Set faceObj = ThisDrawing.ModelSpace.Add3DFace(point1, point2, point3, point4)
	ThisDrawing.Application.ZoomAll

	' Display information about the visibility of the edges for this object
DisplayEdgeInformation:
	Edge1Msg = IIf(faceObj.VisibilityEdge1, "Edge1 of the new 3DFace is visible", "Edge1 of the new 3DFace is not visible")
	Edge2Msg = IIf(faceObj.VisibilityEdge2, "Edge2 of the new 3DFace is visible", "Edge2 of the new 3DFace is not visible")
	Edge3Msg = IIf(faceObj.VisibilityEdge3, "Edge3 of the new 3DFace is visible", "Edge3 of the new 3DFace is not visible")
	Edge4Msg = IIf(faceObj.VisibilityEdge4, "Edge4 of the new 3DFace is visible", "Edge4 of the new 3DFace is not visible")

	MsgBox Edge1Msg & vbCrLf & _
		 Edge2Msg & vbCrLf & _
		 Edge3Msg & vbCrLf & _
		 Edge4Msg
		
	' Allow user to toggle the visibility of one of the edges
	Select Case InputBox("Which edge of the 3DFace would you like to toggle the visibility of?", "Toggle Edge Visibility", 1)
		Case "1": faceObj.VisibilityEdge1 = Not (faceObj.VisibilityEdge1)
		Case "2": faceObj.VisibilityEdge2 = Not (faceObj.VisibilityEdge2)
		Case "3": faceObj.VisibilityEdge3 = Not (faceObj.VisibilityEdge3)
		Case "4": faceObj.VisibilityEdge4 = Not (faceObj.VisibilityEdge4)
		Case "":  Exit Sub
		Case Else: MsgBox "You must enter the number of an edge (1-4)", vbInformation
	End Select
		
	' Refresh view
	ThisDrawing.Regen acAllViewports

	' Return to display information about the edges
	GoTo DisplayEdgeInformation

End Sub





   Comments?