Sub AddTextMidPoint() On Error Resume Next Dim StrText As String StrText = ThisDrawing.Utility.GetString(True, vbCrLf & "Input Text") Dim Pt1 As Variant Dim Pt2 As Variant Dim lineObj As AcadLine Dim textObj As AcadText Dim TxtPnt(2) As Double Pt1 = ThisDrawing.Utility.GetPoint(, "diem dau : ") Pt2 = ThisDrawing.Utility.GetPoint(Pt1, "diem cuoi: ") TxtPnt(0) = 0.5 * (Pt1(0) + Pt2(0)) TxtPnt(1) = 0.5 * (Pt1(1) + Pt2(1)) TxtPnt(2) = 0.5 * (Pt1(2) + Pt2(2)) Set lineObj = ThisDrawing.ModelSpace.AddLine(Pt1, Pt2) Set textObj = ThisDrawing.ModelSpace.AddText(StrText, TxtPnt, lineObj.Length / 20) textObj.Alignment = acAlignmentMiddleCenter textObj.TextAlignmentPoint = TxtPnt End Sub