- 积分
- 1912
- 明经币
- 个
- 注册时间
- 2010-5-11
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2011-9-19 17:04:19
|
显示全部楼层
把linlq986的程序修改一下,就可以求长度了
Private Sub GetLWPOLYLINECoordinates()
Dim ss_dim As AcadSelectionSet, ent As AcadLWPolyline
Dim dxf_code() As Integer, dxf_value() As Variant
Dim i As Long, j As Long
Dim dbCor As Variant, x As Double, y As Double, z As Double
Dim lLen as long
Dim lLenAll as Long
Set ss_dim = ThisDrawing.SelectionSets.Add("ssLine1")
ReDim dxf_code(0), dxf_value(0)
dxf_code(0) = 0: dxf_value(0) = "LWPOLYLINE"
ss_dim.Select acSelectionSetAll, , , dxf_code, dxf_value
Open "d:\aaaaa.txt" For Append As #1
For Each ent In ss_dim
For j = 0 To UBound(ent.Coordinates) \ 2
x = ent.Coordinates(j * 2)
y = ent.Coordinates(j * 2 + 1)
Print #1, "X" & x & ",Y" & y
' 以下是添加的内容
lLen=ent.Length
Print #1, "lLen" & lLen
lLenAll=lLenAll+lLen
Print #1, "lLenAll" & lLenAll
Next
Next
Close #1
ss_dim.Clear
ss_dim.Delete
End Sub
|
|