问了几次了,多段线的长度怎么获得
问了几次了,多段线的长度怎么获得劳烦版主回答了几次,
但我运行时却报错呀
贴出我的源程序
Sub Count_len()
' 创建新的选择集
Dim sset As AcadSelectionSet
For i = 0 To ThisDrawing.SelectionSets.Count - 1
ThisDrawing.SelectionSets.Item(i).Clear
ThisDrawing.SelectionSets.Item(i).Delete
Next
On Error Resume Next
Set sset = ThisDrawing.SelectionSets.Add("SS0")
sset.SelectOnScreen
Dim entry As AcadEntity
Dim l_text As String
Dim l_l As Double
Dim Arc_count As Integer
Dim Line_count As Integer
For Each entry In sset
'如果是多段线或曲线的长度,就不行了
If entry.ObjectName = "AcDbArc" Then
l_text = l_text & "+" & entry.ArcLength
l_l = l_l + entry.ArcLength
Arc_count = Arc_count + 1
ElseIf entry.ObjectName = "AcDbLine" Then
l_text = l_text & "+" & entry.Length
l_l = l_l + entry.Length
Line_count = Line_count + 1
End If
Next entry
ThisDrawing.Utility.Prompt vbCrLf & Arc_count & "个弧," & Line_count & "条直线. 共" & Arc_count + Line_count & "个对象." & vbCrLf & l_text & "=" & l_l & vbCrLf
End Sub
看链接吧
http://www.mjtd.com/function/list.asp?id=308&ordertype=byletterRE
你用ACAD2004算了。本程序需要使用VLAX类。什么意思,我不懂
本帖最后由 作者 于 2003-6-14 13:32:31 编辑本程序需要使用VLAX类。
什么意思,我不懂
VLAX-VisualLISP ActiveX 模块类
http://www.mjtd.com/mcdown/list.asp?id=85thanks
多谢版主一直照顾我, Public Sub Test()Dim objAcadObject As AcadObject Dim varPickedPoint As Variant Dim objDocument As AcadDocument ThisDrawing.Utility.GetEntity objAcadObject, varPickedPoint, "請選擇 Polyline"If TypeOf objAcadObject Is AcadPolyline Then Dim objPolyline As AcadPolyline Set objPolyline = objAcadObject MsgBox "Polyline 長度=" + CStr(objPolyline.Length)End IfEnd Sub
页:
[1]