<?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: Get closest entity when dragging in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/get-closest-entity-when-dragging/m-p/9378040#M20175</link>
    <description>I did it with your help. Thank you very much.</description>
    <pubDate>Sat, 14 Mar 2020 14:33:26 GMT</pubDate>
    <dc:creator>845179011</dc:creator>
    <dc:date>2020-03-14T14:33:26Z</dc:date>
    <item>
      <title>Get closest entity when dragging</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-closest-entity-when-dragging/m-p/9365340#M20169</link>
      <description>&lt;P&gt;[platform win10,AutoCAD 2018]&lt;/P&gt;&lt;P&gt;I want to implement a dynamic drawing tool.DWG files have many Polylines that represent points. When the drawing tool starts and the mouse moves to the point, the coordinates of the point are prompted (extended data is written to the point).&lt;BR /&gt;I referred to an article: &lt;A href="https://www.keanw.com/2006/11/two_methods_for.html" target="_blank" rel="noopener"&gt;https://www.keanw.com/2006/11/two_methods_for.html&lt;/A&gt;&amp;nbsp;. Gets the entities in range by the SelectCrossingWindow() function, which works when used in a command function. I write a test program to get the text entity near the picked point:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public static void SelectCrossingEditor()
{
            Editor ed =            Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            try
            {
                PromptPointOptions ptOpts =
                  new PromptPointOptions(
                    "\nPick a point at which to select all text entities: "
                  );
                PromptPointResult ptRes =
                  ed.GetPoint(ptOpts);
                if (PromptStatus.OK == ptRes.Status)
                {
                    Point3d p = ptRes.Value;
                    Point3d p1 =
                      new Point3d(p.X - 100, p.Y - 100, 0.0);
                    Point3d p2 =
                      new Point3d(p.X + 100, p.Y + 100, 0.0);
                    TypedValue[] values =
                      {
              new TypedValue(
                (int)DxfCode.Start,
                "TEXT"
              )
            };
                    SelectionFilter filter = new SelectionFilter(values);
                    PromptSelectionResult res =
                      ed.SelectCrossingWindow(p1, p2, filter);
                    if(res.Status== PromptStatus.OK)
                    {
                        SelectionSet ss = res.Value;
                        int n = 0;
                        if (ss != null)
                        {
                            n = ss.Count;
                        }
                        ed.WriteMessage(
                          string.Format(
                            "\n{0} text entit{1} selected.",
                            n, 1 == n ? "y" : "ies"
                          )
                        );
                    }
                }
            }
            catch (System.Exception e)
            {
                ed.WriteMessage("\nException {0}.", e);
            }
        }&lt;/LI-CODE&gt;&lt;P&gt;But when SelectCrossingWindow() function used in DrawJig's WorldDraw function, it always returns an Error, even if the mouse position is in the text position.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to solve this problem?&lt;/P&gt;</description>
      <pubDate>Sun, 08 Mar 2020 12:36:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-closest-entity-when-dragging/m-p/9365340#M20169</guid>
      <dc:creator>845179011</dc:creator>
      <dc:date>2020-03-08T12:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Get closest entity when dragging</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-closest-entity-when-dragging/m-p/9369457#M20170</link>
      <description>&lt;P&gt;I don't think you can run a window selection while in a jig.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote something similar, but I cycle through a subset of modelspace entities to check for points within a distance to the cursor. Depending on the drawing it can be kind of laggy, so be certain to trim down the subset of entities as much as you can.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 15:27:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-closest-entity-when-dragging/m-p/9369457#M20170</guid>
      <dc:creator>timgrote</dc:creator>
      <dc:date>2020-03-10T15:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Get closest entity when dragging</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-closest-entity-when-dragging/m-p/9370401#M20171</link>
      <description>&lt;P&gt;Thanks, someone told me that the entity under the cursor can be obtained by "reactor" in c++. I just want to get the entity under the cursor, can it be solved by c#?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 23:20:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-closest-entity-when-dragging/m-p/9370401#M20171</guid>
      <dc:creator>845179011</dc:creator>
      <dc:date>2020-03-10T23:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Get closest entity when dragging</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-closest-entity-when-dragging/m-p/9370801#M20172</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe you can get some inspiration from &lt;A href="https://forums.autodesk.com/t5/net/rollover-tooltip-code/m-p/8385407" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;this topic&lt;/STRONG&gt;&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2020 06:16:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-closest-entity-when-dragging/m-p/9370801#M20172</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2020-03-11T06:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: Get closest entity when dragging</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-closest-entity-when-dragging/m-p/9371291#M20173</link>
      <description>&lt;P&gt;Thanks so much. I know the monitor,it works well when&amp;nbsp;&lt;STRONG&gt;idle. But when start a Jip, the tooltip display some point like "center of circle",&amp;nbsp; or display the&amp;nbsp; data I read from&amp;nbsp; Entity, it's&amp;nbsp;irregular. I just want to display the data of Entity.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2020 11:03:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-closest-entity-when-dragging/m-p/9371291#M20173</guid>
      <dc:creator>845179011</dc:creator>
      <dc:date>2020-03-11T11:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: Get closest entity when dragging</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-closest-entity-when-dragging/m-p/9374496#M20174</link>
      <description>&lt;P&gt;You did not describe how your "jig" works like. However, since you want some custom feature that Entity/DrawJig class does not offer directly (identifying entity when mouse cursor hovers during drag, and showing tooltip style prompt, if I were you, I would create my own jig, using Editor.PointMonitor event and Transient Graphics. That is, in PointMonitor event handler, you can easily identify the entity the mouse cursor hover, then you can collect related data and show custom tooltip; you use Transient Graphics as the ghost image of the "dragged" entity.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have ever coded PointMonitor event handler and used transient graphics, you should be able to achieve your goal with fairly satisfactory effect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&amp;nbsp;'s reply provides the link to discussion of showing custom tooltips. I have quite a few articles in my blog on transient graphics being used in custom drag, for example, this one:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://drive-cad-with-code.blogspot.com/2011/01/creating-move-command-with-net-api-take.html" target="_blank" rel="noopener"&gt;https://drive-cad-with-code.blogspot.com/2011/01/creating-move-command-with-net-api-take.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 14:41:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-closest-entity-when-dragging/m-p/9374496#M20174</guid>
      <dc:creator>Norman_Yuan</dc:creator>
      <dc:date>2020-03-12T14:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Get closest entity when dragging</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-closest-entity-when-dragging/m-p/9378040#M20175</link>
      <description>I did it with your help. Thank you very much.</description>
      <pubDate>Sat, 14 Mar 2020 14:33:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-closest-entity-when-dragging/m-p/9378040#M20175</guid>
      <dc:creator>845179011</dc:creator>
      <dc:date>2020-03-14T14:33:26Z</dc:date>
    </item>
  </channel>
</rss>

