ScoRm Posted March 19, 2019 Posted March 19, 2019 i found a VBA that get the coordinates Here: but its not quite what i have in mind, first, it can select multiple lines - I need to select single line... (to control my selections) second, i need to press enter everytime i select - i need to automatically press enter if its possible my guess on the pressing the enter thingy is this code: oSS.SelectOnScreen iFilterCode, vFilterValue is there any other ways to select a line? so that i will not press ENTER everytime? Here is the code BTW if you dont wanna go to the link: Public Sub LineDetail() Dim oSS As AcadSelectionSet Dim oEntity As AcadEntity Dim iFilterCode(0) As Integer Dim vFilterValue(0) As Variant On Error Resume Next Application.ActiveDocument.SelectionSets("Lines").Delete On Error GoTo 0 Set oSS = Application.ActiveDocument.SelectionSets.Add("Lines") iFilterCode(0) = 0: vFilterValue(0) = "Line" oSS.SelectOnScreen iFilterCode, vFilterValue If oSS.Count Then For Each oEntity In oSS Dim oLine As AcadLine Set oLine = oEntity With oLine MsgBox "StartPoint: " & .StartPoint(0) & ", " & .StartPoint(1) & ", " & .StartPoint(2) & vbCrLf & _ "EndPoint : " & .EndPoint(0) & ", " & .EndPoint(1) & ", " & .EndPoint(2) End With Next oEntity End If End Sub Quote
BIGAL Posted March 20, 2019 Posted March 20, 2019 (edited) Public Sub alantest() Dim objent As AcadObject pick = True 'WHILE PICKING ENTITY Do While pick ThisDrawing.Utility.GetEntity objent, basepnt, "Pick line : " 'WHILE PICKING ENTITY If objent.ObjectName = "AcDbLine" Then ' If condition is True. Dim oLine As AcadLine Set oLine = objent With oLine MsgBox "StartPoint: " & .StartPoint(0) & ", " & .StartPoint(1) & ", " & .StartPoint(2) & vbCrLf & _ "EndPoint : " & .EndPoint(0) & ", " & .EndPoint(1) & ", " & .EndPoint(2) End With Else pick = False ' Set value of flag to False. MsgBox "object is not a line " & objent.ObjectName End If Loop End Sub Edited March 20, 2019 by BIGAL Quote
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.