21 | 08 | 2017

Filter Arc Entities and get Coodinates

Code below lets you select objects. It filters al Arc Objects and show the coordinates. You can change the vFiltervalue from arc into other entities. For instance circle. That way you can modify this code to filter specific objects.


Sub ArcDetails()
  Dim oSS As AcadSelectionSet
  Dim oArc As AcadArc
  Dim iFilterCode(0) As Integer
  Dim vFilterValue(0) As Variant
  'Delete selection set if it exists
  On Error Resume Next
  On Error GoTo 0
  'Create a temp selection set
  Set oSS = Application.ActiveDocument.SelectionSets.Add("TempSS")
  iFilterCode(0) = 0: vFilterValue(0) = "Arc"
  'Select objects on screen and filter only Arc Entities
  oSS.SelectOnScreen iFilterCode, vFilterValue
  If oSS.Count Then
    For Each oArc In oSS 'For each arc show the X and Y Coordinates
      With oArc
        MsgBox "StartPoint: " & .StartPoint(0) & ", " & .StartPoint(1) & ", " & .StartPoint(2) & vbCrLf & _
               "EndPoint  : " & .EndPoint(0) & ", " & .EndPoint(1) & ", " & .EndPoint(2)
      End With
    Next oArc
  End If
End Sub




Sign up now and upload your code to the website.

Help us to continue.....
Articles View Hits
Latest Articles