ActiveLinetype Example

Using Programming Languages other than VBA

Sub Example_ActiveLinetype()
	' This example finds the current linetype. It then sets
	' the new linetype to be the first entry in the linetype
	' collection that is not equal to the current linetype.
	' Finally, it resets the active linetype to the original
	' setting.

	Dim currLineType As AcadLineType
	Dim newLineType As AcadLineType

	' Find the current LineType of the active document
	Set currLineType = ThisDrawing.ActiveLinetype
	MsgBox "The current linetype is " &, vbInformation, "ActiveLinetype Example"

	' Set the current Linetype to anything else in the collection
	Dim entry
	Dim found As Boolean
	For Each entry In ThisDrawing.Linetypes
		If StrComp(,, 1) <> 0 Then
			Set newLineType = entry
			found = True
			Exit For
		End If
	If found Then
		ThisDrawing.ActiveLinetype = newLineType
		MsgBox "The new linetype is " &, vbInformation, "ActiveLinetype Example"
		' Reset the linetype to the previous setting
		ThisDrawing.ActiveLinetype = currLineType
		MsgBox "The active linetype is reset to " &, vbInformation, "ActiveLinetype Example"
	End If
End Sub