classof Posted July 23, 2010 Share Posted July 23, 2010 hello.. I am using "autocad2006". I want to know the number of lines and length of lines drawn at "current layer". But it didn't work properly. I don't know why. Please help me about below code. Sub LineSelect() Dim mode As Integer Dim retval As New Collection Dim gpCode(0) As Integer Dim dataValue(0) As Variant Dim ssetObj As AcadSelectionSet Dim tempent As AcadEntity With ThisDrawing gpCode(0) = 0: dataValue(0) = "LINE" mode = acSelectionSetAll On Error Resume Next If .SelectionSets("SELECT") Then .SelectionSets("SELECT").Delete On Error GoTo 0 Set ssetObj = .SelectionSets.Add("SELECT") ssetObj.Select mode, , , gpCode, dataValue Dim idBlock As Long idBlock = ThisDrawing.ActiveLayout.Block.ObjectID Dim i As Integer For i = 0 To ssetObj.Count - 1 If ssetObj(i).OwnerID = idBlock Then retval.Add tempent End If Next i MsgBox retval.Count 'number of lines at current layout Dim Eac As AcadLine For Each Eac In retval MsgBox Eac.Length 'ERROR Next Eac End With End Sub thank you Quote Link to comment Share on other sites More sharing options...
SEANT Posted July 23, 2010 Share Posted July 23, 2010 I think the problem is that “tempent” in this line has never been set to a value. retval.Add tempent Quote Link to comment Share on other sites More sharing options...
classof Posted July 27, 2010 Author Share Posted July 27, 2010 SEANT I think so.. I will try again. thank you.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.