<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Select/Delete all the circles with a specified radius using VBA in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/select-delete-all-the-circles-with-a-specified-radius-using-vba/m-p/13033994#M338</link>
    <description>&lt;P&gt;Well, since the circle's radius is a Double type, the value (1.9433 in your case) could be either exactly 1.9433, or could be 1.943333333333..... Using radius property in the filter, the value must be matched exactly. You can try to create a circle with radius of exact 1.9 and set the filter value to 1.9, and your code would be able to select it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, it might not be a good idea to use properties with floating value. Since you are writing code, it would be simple to just do the fine filtering in the code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dim c As AcadCircle&lt;/P&gt;
&lt;P&gt;'' target radius&lt;/P&gt;
&lt;P&gt;Dim r As Double&lt;/P&gt;
&lt;P&gt;r=1.9433&lt;/P&gt;
&lt;P&gt;'' choose a suitable tolerance&lt;/P&gt;
&lt;P&gt;Dim tolerance as Double&lt;/P&gt;
&lt;P&gt;tolerance=0.000001&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'' loop through the selected circles and test its radius&lt;/P&gt;
&lt;P&gt;For Each ent In selectionSet&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Set c = ent&lt;/P&gt;
&lt;P&gt;&amp;nbsp; If Abs(c.Radius - r)&amp;lt;=tolerance Then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; '' This circle is the target one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; End If&lt;/P&gt;
&lt;P&gt;Next&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Sep 2024 17:53:34 GMT</pubDate>
    <dc:creator>norman.yuan</dc:creator>
    <dc:date>2024-09-20T17:53:34Z</dc:date>
    <item>
      <title>Select/Delete all the circles with a specified radius using VBA</title>
      <link>https://forums.autodesk.com/t5/vba-forum/select-delete-all-the-circles-with-a-specified-radius-using-vba/m-p/13033889#M337</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my vba code to select all the circles with a radius of 1.9433 and delete. Unfortunately, it deletes all the circles, even the ones which don't match the specified radius. Any help to resolve this is very much appreciated. Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub DeleteAllSelectedCircles()
    ' Declare variables
    Dim acadApp As Object
    Dim acadDoc As Object
    Dim selectionSet As Object
    Dim filterType(1) As Integer
    Dim filterData(1) As Variant

    ' Get the AutoCAD application and active document
    Set acadApp = GetObject(, "AutoCAD.Application")
    Set acadDoc = acadApp.ActiveDocument

    ' Create a new selection set
    On Error Resume Next
    Set selectionSet = acadDoc.SelectionSets.Add("CircleSelectionSet")
    If Err.Number &amp;lt;&amp;gt; 0 Then
        Set selectionSet = acadDoc.SelectionSets.Item("CircleSelectionSet")
        Err.Clear
    End If
    On Error GoTo 0

    ' Define the filter for circles
    filterType(0) = 0
    filterData(0) = "CIRCLE"
    filterType(1) = 40 ' Radius property
    filterData(1) = 1.9433

    ' Select all circles in the drawing
    selectionSet.Select acSelectionSetAll, , , filterType, filterData

    ' Delete the selected circles
    Dim entity As Object
    For Each entity In selectionSet
        entity.Delete
    Next entity

    ' Inform the user
    MsgBox selectionSet.Count &amp;amp; " circles deleted."
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;-NT&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 17:06:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/select-delete-all-the-circles-with-a-specified-radius-using-vba/m-p/13033889#M337</guid>
      <dc:creator>niranjan_thyagaraja</dc:creator>
      <dc:date>2024-09-20T17:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: Select/Delete all the circles with a specified radius using VBA</title>
      <link>https://forums.autodesk.com/t5/vba-forum/select-delete-all-the-circles-with-a-specified-radius-using-vba/m-p/13033994#M338</link>
      <description>&lt;P&gt;Well, since the circle's radius is a Double type, the value (1.9433 in your case) could be either exactly 1.9433, or could be 1.943333333333..... Using radius property in the filter, the value must be matched exactly. You can try to create a circle with radius of exact 1.9 and set the filter value to 1.9, and your code would be able to select it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, it might not be a good idea to use properties with floating value. Since you are writing code, it would be simple to just do the fine filtering in the code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dim c As AcadCircle&lt;/P&gt;
&lt;P&gt;'' target radius&lt;/P&gt;
&lt;P&gt;Dim r As Double&lt;/P&gt;
&lt;P&gt;r=1.9433&lt;/P&gt;
&lt;P&gt;'' choose a suitable tolerance&lt;/P&gt;
&lt;P&gt;Dim tolerance as Double&lt;/P&gt;
&lt;P&gt;tolerance=0.000001&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'' loop through the selected circles and test its radius&lt;/P&gt;
&lt;P&gt;For Each ent In selectionSet&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Set c = ent&lt;/P&gt;
&lt;P&gt;&amp;nbsp; If Abs(c.Radius - r)&amp;lt;=tolerance Then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; '' This circle is the target one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; End If&lt;/P&gt;
&lt;P&gt;Next&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 17:53:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/select-delete-all-the-circles-with-a-specified-radius-using-vba/m-p/13033994#M338</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2024-09-20T17:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Select/Delete all the circles with a specified radius using VBA</title>
      <link>https://forums.autodesk.com/t5/vba-forum/select-delete-all-the-circles-with-a-specified-radius-using-vba/m-p/13034093#M339</link>
      <description>&lt;P&gt;Thanks, Norman! I was able to confirm that the code works for a circle with precise radius of 1.9. I'll try your workaround now&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":crossed_fingers:"&gt;🤞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 18:43:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/select-delete-all-the-circles-with-a-specified-radius-using-vba/m-p/13034093#M339</guid>
      <dc:creator>niranjan_thyagaraja</dc:creator>
      <dc:date>2024-09-20T18:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: Select/Delete all the circles with a specified radius using VBA</title>
      <link>https://forums.autodesk.com/t5/vba-forum/select-delete-all-the-circles-with-a-specified-radius-using-vba/m-p/13034126#M340</link>
      <description>&lt;P&gt;This update worked! Thank you once again..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;' Define the filter for circles&lt;BR /&gt;filterType(0) = 0&lt;BR /&gt;filterData(0) = "CIRCLE"&lt;BR /&gt;filterType(1) = -4&lt;BR /&gt;filterData(1) = "&amp;gt;"&lt;BR /&gt;filterType(2) = 40 ' Radius property&lt;BR /&gt;filterData(2) = 1.9432&lt;BR /&gt;filterType(3) = -4&lt;BR /&gt;filterData(3) = "&amp;lt;"&lt;BR /&gt;filterType(4) = 40 ' Radius property&lt;BR /&gt;filterData(4) = 1.9433&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 19:00:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/select-delete-all-the-circles-with-a-specified-radius-using-vba/m-p/13034126#M340</guid>
      <dc:creator>niranjan_thyagaraja</dc:creator>
      <dc:date>2024-09-20T19:00:38Z</dc:date>
    </item>
  </channel>
</rss>

