本人在工作中学习改进一点VBA代码,画图多段线图形后,能否选择生成的图形,实现多段线的标注类似论坛高手zzyong00的实现效果,- '使用点数组创建轻量多段线
- Public Function AddLWPline(ByRef pt() As Double, ByVal width As Double) As AcadLWPolyline
- Dim objPline As AcadLWPolyline
-
- '错误处理
- If (UBound(pt) + 1) Mod 2 <> 0 Then
- MsgBox "数组元素个数必须为偶数!"
- Exit Function
- End If
-
- Set objPline = ThisDrawing.ModelSpace.AddLightWeightPolyline(pt)
- objPline.ConstantWidth = width
- objPline.Update
- Set AddLWPline = objPline
- End Function
- '多短线类型1
- Public Sub Polyline()
- Dim ptArr1(0 To 9) As Double
- Dim objLWPline As AcadLWPolyline
- '多段线定点坐标数组
- ptArr1(0) = 0: ptArr1(1) = 0
- ptArr1(2) = 60: ptArr1(3) = 0
- ptArr1(4) = 60: ptArr1(5) = 40
- ptArr1(6) = 0: ptArr1(7) = 60
- ptArr1(8) = 0: ptArr1(9) = 0
- Set objLWPline = AddLWPline(ptArr1, 0)
- '设置多段线的凸出参数,1为半圆,0表示直线
- objLWPline.SetBulge 1, 0.414
- objLWPline.Update
- End Sub
如果能实现选择后标注,标注的样式能否一起定义?
|