LinetypeScale Example

Using Programming Languages other than VBA

Sub Example_LinetypeScale()
	' This example creates a line and finds the linetype scale
	' for the line. It then changes the linetype scale, and finally
	' resets the linetype scale back to the original value.
	Dim startPoint(0 To 2) As Double
	Dim endPoint(0 To 2) As Double
	Dim lineObj As AcadLine
	Dim currLTScale As Double

	' Create a Line object in model space
	startPoint(0) = 2#: startPoint(1) = 2#: startPoint(2) = 0#
	endPoint(0) = 4#: endPoint(1) = 4#: endPoint(2) = 0#
	Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
	lineObj.Update
	currLTScale = lineObj.LinetypeScale
	MsgBox "The linetype scale for the line is:" & lineObj.LinetypeScale, vbInformation, "Linetypes Example"


	' Set the linetype scale of a Line to .5
	lineObj.LinetypeScale = 0.5
	lineObj.Update
	MsgBox "The new linetype scale for the line is:" & lineObj.LinetypeScale, vbInformation, "Linetypes Example"

	' Reset the linetype scale of a Line to what is was before
	lineObj.LinetypeScale = currLTScale
	lineObj.Update
	MsgBox "The linetype scale for the line is reset to:" & lineObj.LinetypeScale, vbInformation, "Linetypes Example"
End Sub

 

   Comments?