<?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: Pointmonitor for VB.net in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/pointmonitor-for-vb-net/m-p/2891942#M62134</link>
    <description>&lt;P&gt;You can use&lt;/P&gt;&lt;P&gt;e.Context.LastPoint.X&lt;/P&gt;&lt;P&gt;e.Context.LastPoint.Y&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to get the location of the pointer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is Tony's code in VB.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Geometry

Public Class PointMonitorTooltips

    &amp;lt;CommandMethod("SM")&amp;gt; _
    Public Shared Sub StartMonitor()
        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
        AddHandler ed.PointMonitor, New PointMonitorEventHandler(AddressOf ed_PointMonitor)
    End Sub

    &amp;lt;CommandMethod("XM")&amp;gt; _
    Public Shared Sub StopMonitor()
        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
        ed.TurnForcedPickOn()
        RemoveHandler ed.PointMonitor, AddressOf ed_PointMonitor
    End Sub

    Private Shared Sub ed_PointMonitor(ByVal sender As Object, ByVal e As PointMonitorEventArgs)

        Dim ed As Editor = DirectCast(sender, Editor)
        Dim doc As Document = ed.Document
        Try
            Dim paths As FullSubentityPath() = e.Context.GetPickedEntities()
            ' Go through the results of the selection
            ' and detect the curves
            Dim curveInfo As String = ""
            Dim tr As Transaction = doc.TransactionManager.StartTransaction()
            Using tr
                ' Open each object, one by one

                For Each path As FullSubentityPath In paths
                    Dim ids As ObjectId() = path.GetObjectIds()
                    If ids.Length &amp;gt; 0 Then
                        Dim id As ObjectId = ids(ids.GetUpperBound(0))

                        Dim obj As DBObject = tr.GetObject(id, OpenMode.ForRead)
                        If obj IsNot Nothing Then
                            ' If it's a curve, get its length

                            Dim cv As Curve = TryCast(obj, Curve)
                            If cv IsNot Nothing Then

                                Dim length As Double = cv.GetDistanceAtParameter(cv.EndParam) - cv.GetDistanceAtParameter(cv.StartParam)

                                ' Then add a message including the object
                                ' type and its length

                                curveInfo += obj.[GetType]().Name + "'s length: " &amp;amp; String.Format("{0:F}", length) &amp;amp; vbLf
                            End If
                        End If
                    End If
                Next
                ' Cheaper than aborting
                tr.Commit()
            End Using

            ' Add the tooltip of the lengths of the curves detected

            If curveInfo &amp;lt;&amp;gt; "" Then
                e.AppendToolTipText(curveInfo)
            End If
        Catch
            ' Not sure what we might get here, but not real action
            ' needed (worth adding an Exception parameter and a
            ' breakpoint, in case things need investigating).

        End Try
    End Sub
End Class&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jan 2011 03:41:38 GMT</pubDate>
    <dc:creator>arcticad</dc:creator>
    <dc:date>2011-01-25T03:41:38Z</dc:date>
    <item>
      <title>Pointmonitor for VB.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/pointmonitor-for-vb-net/m-p/2891662#M62133</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to use a Pointmonitor event event but can't find an easy example.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to find and use pointer coords into my code but I don't understand how it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to translate the examples by Kean Walmsley:&lt;/P&gt;&lt;P&gt;&lt;A href="http://through-the-interface.typepad.com/through_the_interface/2009/07/providing-information-on-autocad-objects-in-a-tooltip-using-net.html" rel="nofollow" target="_blank"&gt;http://through-the-interface.typepad.com/through_the_interface/2009/07/providing-information-on-autocad-objects-in-a-tooltip-using-net.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jeroen&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2011 21:29:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pointmonitor-for-vb-net/m-p/2891662#M62133</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-01-24T21:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: Pointmonitor for VB.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/pointmonitor-for-vb-net/m-p/2891942#M62134</link>
      <description>&lt;P&gt;You can use&lt;/P&gt;&lt;P&gt;e.Context.LastPoint.X&lt;/P&gt;&lt;P&gt;e.Context.LastPoint.Y&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to get the location of the pointer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is Tony's code in VB.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Geometry

Public Class PointMonitorTooltips

    &amp;lt;CommandMethod("SM")&amp;gt; _
    Public Shared Sub StartMonitor()
        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
        AddHandler ed.PointMonitor, New PointMonitorEventHandler(AddressOf ed_PointMonitor)
    End Sub

    &amp;lt;CommandMethod("XM")&amp;gt; _
    Public Shared Sub StopMonitor()
        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
        ed.TurnForcedPickOn()
        RemoveHandler ed.PointMonitor, AddressOf ed_PointMonitor
    End Sub

    Private Shared Sub ed_PointMonitor(ByVal sender As Object, ByVal e As PointMonitorEventArgs)

        Dim ed As Editor = DirectCast(sender, Editor)
        Dim doc As Document = ed.Document
        Try
            Dim paths As FullSubentityPath() = e.Context.GetPickedEntities()
            ' Go through the results of the selection
            ' and detect the curves
            Dim curveInfo As String = ""
            Dim tr As Transaction = doc.TransactionManager.StartTransaction()
            Using tr
                ' Open each object, one by one

                For Each path As FullSubentityPath In paths
                    Dim ids As ObjectId() = path.GetObjectIds()
                    If ids.Length &amp;gt; 0 Then
                        Dim id As ObjectId = ids(ids.GetUpperBound(0))

                        Dim obj As DBObject = tr.GetObject(id, OpenMode.ForRead)
                        If obj IsNot Nothing Then
                            ' If it's a curve, get its length

                            Dim cv As Curve = TryCast(obj, Curve)
                            If cv IsNot Nothing Then

                                Dim length As Double = cv.GetDistanceAtParameter(cv.EndParam) - cv.GetDistanceAtParameter(cv.StartParam)

                                ' Then add a message including the object
                                ' type and its length

                                curveInfo += obj.[GetType]().Name + "'s length: " &amp;amp; String.Format("{0:F}", length) &amp;amp; vbLf
                            End If
                        End If
                    End If
                Next
                ' Cheaper than aborting
                tr.Commit()
            End Using

            ' Add the tooltip of the lengths of the curves detected

            If curveInfo &amp;lt;&amp;gt; "" Then
                e.AppendToolTipText(curveInfo)
            End If
        Catch
            ' Not sure what we might get here, but not real action
            ' needed (worth adding an Exception parameter and a
            ' breakpoint, in case things need investigating).

        End Try
    End Sub
End Class&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2011 03:41:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pointmonitor-for-vb-net/m-p/2891942#M62134</guid>
      <dc:creator>arcticad</dc:creator>
      <dc:date>2011-01-25T03:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: Pointmonitor for VB.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/pointmonitor-for-vb-net/m-p/3082202#M62135</link>
      <description>&lt;P&gt;I'm trying to use custom tooltips the same way, but for some reason, only the default tooltips are displayed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.AppendToolTipText(info)﻿ does nothing&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;maybe some AutoCAD settings disable the custom tooltips?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2011 12:42:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pointmonitor-for-vb-net/m-p/3082202#M62135</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-07-06T12:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Pointmonitor for VB.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/pointmonitor-for-vb-net/m-p/3083278#M62136</link>
      <description>&lt;P&gt;so i solved it, there were 2 issues&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;first, i had to turn off the rollover tooltips&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and second, I had AUTOSNAP set to 0, you have to have the third bit set to true to have the tooltips displayed.﻿ &lt;A target="_blank" href="http://forums.autodesk.com/t5/NET/PointMonitor-and-AutoSnap-37/m-p/2125768/highlight/true#M8924"&gt;http://forums.autodesk.com/t5/NET/PointMonitor-and-AutoSnap-37/m-p/2125768/highlight/true#M8924&lt;/A&gt; gives a hint.﻿&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2011 06:48:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pointmonitor-for-vb-net/m-p/3083278#M62136</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-07-07T06:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: Pointmonitor for VB.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/pointmonitor-for-vb-net/m-p/5810056#M62137</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;How can I fire off the point monitor event? Perhaps using another event, for example the right click mouse?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 21:59:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pointmonitor-for-vb-net/m-p/5810056#M62137</guid>
      <dc:creator>joantopo</dc:creator>
      <dc:date>2015-09-09T21:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Pointmonitor for VB.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/pointmonitor-for-vb-net/m-p/5810909#M62138</link>
      <description>&lt;P&gt;You do not fire off PointMonitor event, AutoCAD's Editor does. That is, when the mouse cursor moves on the screen of AutoCAD Ediitor, the event fires. This is how AutoCAD works. Your code cannot stop it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What your code can do is to handle the event if needed. If you want to something when this event fires, you add event handler&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;VB:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AddHandler TheEditor.PointMonitor, AddressOf.....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;C#&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TheEditor.PointMonitor += .....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;During your code execution, you likely only need to handle this event in particular steps, so, you register the handler when needed, and then remove the handler when you do not want it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since the event fires with every slight move of the mouse, you do not want to do heavy lifting in the event handler, which would cause the mouse move staggering/sticky.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2015 13:31:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pointmonitor-for-vb-net/m-p/5810909#M62138</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2015-09-10T13:31:15Z</dc:date>
    </item>
  </channel>
</rss>

