<?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: How to filter selection set for &amp;quot;Curve&amp;quot;? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-filter-selection-set-for-quot-curve-quot/m-p/10884978#M13973</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can explicitly specify all curve entities in the selection filter (take care to avoid the meshes which also use the "POLYLINE" DXF group)&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;var filter = new SelectionFilter(new[]
{
    new TypedValue(-4, "&amp;lt;OR"),
    new TypedValue(0, "ARC,CIRCLE,ELLIPSE,LEADER,LINE,LWPOLYLINE,RAY,SPLINE,XLINE"),
    new TypedValue(-4, "&amp;lt;AND"),
    new TypedValue(0, "POLYLINE"),
    new TypedValue(-4, "&amp;amp;"),
    new TypedValue(70, 16 | 32 | 64),
    new TypedValue(-4, "AND&amp;gt;"),
    new TypedValue(-4, "OR&amp;gt;")
});&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another way should be handling the Editor.SelectionAdded event&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;static void OnSelectionAdded(object sender, SelectionAddedEventArgs e)
{
    var curveClass = RXObject.GetClass(typeof(Curve));
    var ids = e.AddedObjects.GetObjectIds();
    for (int i = 0; i &amp;lt; ids.Length; i++)
    {
        if (!ids[i].ObjectClass.IsDerivedFrom(curveClass))
            e.Remove(i);
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;using:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;ed.SelectionAdded += OnSelectionAdded;
PromptSelectionResult selectionResult = ed.GetSelection();
ed.SelectionAdded -= OnSelectionAdded;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Jan 2022 14:26:49 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2022-01-17T14:26:49Z</dc:date>
    <item>
      <title>How to filter selection set for "Curve"?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-filter-selection-set-for-quot-curve-quot/m-p/10884883#M13972</link>
      <description>&lt;P&gt;I know how to filter a selection set for a specific type, such as "Polyline", or "Circle".&lt;BR /&gt;&lt;BR /&gt;But how can I make a filter that can accept any "Curve"? (All kinds of objects in Autocad .NET that are derived from "Curve").&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a very simple method to solve this for an "exact" type, but it doesn't work for a "derived" type:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public static SelectionFilter New&amp;lt;T&amp;gt;() where T: Entity
{
    RXClass type = RXClass.GetClass(typeof(T));
    SelectionFilter result = new SelectionFilter(new TypedValue[] { new TypedValue((int)DxfCode.Start, type.DxfName) });
    return result;
}&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 17 Jan 2022 13:50:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-filter-selection-set-for-quot-curve-quot/m-p/10884883#M13972</guid>
      <dc:creator>danielmollerX5W2N</dc:creator>
      <dc:date>2022-01-17T13:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter selection set for "Curve"?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-filter-selection-set-for-quot-curve-quot/m-p/10884978#M13973</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can explicitly specify all curve entities in the selection filter (take care to avoid the meshes which also use the "POLYLINE" DXF group)&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;var filter = new SelectionFilter(new[]
{
    new TypedValue(-4, "&amp;lt;OR"),
    new TypedValue(0, "ARC,CIRCLE,ELLIPSE,LEADER,LINE,LWPOLYLINE,RAY,SPLINE,XLINE"),
    new TypedValue(-4, "&amp;lt;AND"),
    new TypedValue(0, "POLYLINE"),
    new TypedValue(-4, "&amp;amp;"),
    new TypedValue(70, 16 | 32 | 64),
    new TypedValue(-4, "AND&amp;gt;"),
    new TypedValue(-4, "OR&amp;gt;")
});&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another way should be handling the Editor.SelectionAdded event&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;static void OnSelectionAdded(object sender, SelectionAddedEventArgs e)
{
    var curveClass = RXObject.GetClass(typeof(Curve));
    var ids = e.AddedObjects.GetObjectIds();
    for (int i = 0; i &amp;lt; ids.Length; i++)
    {
        if (!ids[i].ObjectClass.IsDerivedFrom(curveClass))
            e.Remove(i);
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;using:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;ed.SelectionAdded += OnSelectionAdded;
PromptSelectionResult selectionResult = ed.GetSelection();
ed.SelectionAdded -= OnSelectionAdded;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jan 2022 14:26:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-filter-selection-set-for-quot-curve-quot/m-p/10884978#M13973</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2022-01-17T14:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter selection set for "Curve"?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-filter-selection-set-for-quot-curve-quot/m-p/10885077#M13974</link>
      <description>&lt;P&gt;Great! Thank you!&lt;BR /&gt;&lt;BR /&gt;For safety, I inverted the loop in the event handler, doesn't removing by index corrupt indexing?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jan 2022 14:59:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-filter-selection-set-for-quot-curve-quot/m-p/10885077#M13974</guid>
      <dc:creator>danielmollerX5W2N</dc:creator>
      <dc:date>2022-01-17T14:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter selection set for "Curve"?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-filter-selection-set-for-quot-curve-quot/m-p/10885198#M13975</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11029180"&gt;@danielmollerX5W2N&lt;/a&gt;&amp;nbsp; a écrit&amp;nbsp;:&lt;BR /&gt;
&lt;P&gt;For safety, I inverted the loop in the event handler, doesn't removing by index corrupt indexing?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;From the tests I did (and i use it for a while) it does not corrupt indexing.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jan 2022 15:43:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-filter-selection-set-for-quot-curve-quot/m-p/10885198#M13975</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2022-01-17T15:43:10Z</dc:date>
    </item>
  </channel>
</rss>

