Keith,
如果我发布我的代码,我仍然有麻烦,你能给它一个tweek吗??我不确定你上一次发布的声明应该放在哪里...
- Sub TextDemo()
- Dim objsset As AcadSelectionSet
- Dim ObjEnt As AcadEntity
- Dim minExt As Variant
- Dim maxExt As Variant
- Dim text1 As Double
- Dim text2 As AcadText
- Dim text3 As Double
- Dim text As String
- Dim text4 As AcadText
- Dim height As Double
- height = 4
- Dim inst(0 To 2) As Double
- Dim var As Variant
- inst(2) = 0
- Set objsset = ThisDrawing.PickfirstSelectionSet
- objsset.Select acSelectionSetAll
- For Each ObjEnt In objsset
- If ObjEnt.Layer = "0" Then
- ObjEnt.GetBoundingBox minExt, maxExt
- text1 = maxExt(1) - minExt(1)
- text3 = maxExt(0) - minExt(0)
- inst(0) = (maxExt(0) - (text3 / 2)) - 6
- inst(1) = maxExt(1) - (text1 / 2)
- text = "x"
- Set text4 = ThisDrawing.ModelSpace.AddText(text, inst, height)
- inst(1) = inst(1) + 5
- text = text1
- Set text4 = ThisDrawing.ModelSpace.AddText(text, inst, height)
- inst(1) = inst(1) - 10
- text = text3
- Set text4 = ThisDrawing.ModelSpace.AddText(text, inst, height)
- End If
- Next
- objsset.Delete
- End Sub
|