TextMovement Example

Using Programming Languages other than VBA

Sub Example_TextMovement()
   ' This example creates two aligned dimensions in model space and
   ' sets the TextMovement property of each one differently to allow
   ' the user to see the differences this property makes when moving
   ' dimension text
   '
   ' To see the effects of this property:
   ' 1) Run this sample
   ' 2) Enter the drawing and move the dimension text of the leftmost object
   '	on the screen with the mouse or keyboard.
   ' 3) Notice the position of the dimension lines
   ' 4) Repeat with the rightmost object
   
	Dim dimObj1 As AcadDimAligned, dimObj2 As AcadDimAligned
	Dim point1(0 To 2) As Double, point2(0 To 2) As Double
	Dim point3(0 To 2) As Double, point4(0 To 2) As Double
	Dim location1(0 To 2) As Double, location2(0 To 2) As Double
	
	' Define the two dimensions
	point1(0) = 5: point1(1) = 5: point1(2) = 0
	point2(0) = 6: point2(1) = 5: point2(2) = 0
	location1(0) = 5: location1(1) = 7: location1(2) = 0

	point3(0) = 7: point3(1) = 5: point3(2) = 0
	point4(0) = 8: point4(1) = 5: point4(2) = 0
	location2(0) = 5: location2(1) = 7: location2(2) = 0

	' Create the aligned dimension objects in model space
	Set dimObj1 = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location1)
	Set dimObj2 = ThisDrawing.ModelSpace.AddDimAligned(point3, point4, location2)

	ThisDrawing.Application.ZoomAll

	' Set the text movement of the new dimensions to different values
	dimObj1.TextMovement = acMoveTextNoLeader
	dimObj2.TextMovement = acDimLineWithText
	 
End Sub

 

   Comments?