26 | 02 | 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.

[code]

Sub ArcDetails()
 
  Dim oSS As AcadSelectionSet
  Dim oArc As AcadArc
  Dim iFilterCode(0) As Integer
  Dim vFilterValue(0) As Variant
 
  'Errorhandler
  'Delete selection set if it exists
  On Error Resume Next
  Application.ActiveDocument.SelectionSets("TempSS").Delete
  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

[/code]

 

Login

Sign up now and upload your code to the website.

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