以X坐标一点中心对齐 X=775,y坐标提取就是.InsertionPoint(1) 如pp(0) = 775: pp(1) = .InsertionPoint(1): pp(2) = 0 程序如下: Sub ls() Dim objText As AcadText, Ent As AcadEntity Dim pp(0 To 2) As Double ', alignmentPoint(0 To 2) As Double For Each Ent In ThisDrawing.ModelSpace Set objText = Ent With objText pp(0) = 775: pp(1) = .InsertionPoint(1): pp(2) = 0 'alignmentPoint(0) = 775: alignmentPoint(1) = .InsertionPoint(1): alignmentPoint(2) = 0 'Debug.Print .InsertionPoint(1), .TextString For jj = 0 To 2 Debug.Print .InsertionPoint(jj), pp(jj) Next jj .Alignment = acAlignmentCenter .TextAlignmentPoint = pp 'alignmentPoint End With Next End Sub
|