<?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: Customs Tools in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/customs-tools/m-p/1106434#M20395</link>
    <description>&lt;P&gt;I'm afraid I don't understand what's going on on those pages Duncan enough to understand how to apply it to my situation.&lt;/P&gt;</description>
    <pubDate>Mon, 11 Oct 2021 15:29:59 GMT</pubDate>
    <dc:creator>shawnstanley</dc:creator>
    <dc:date>2021-10-11T15:29:59Z</dc:date>
    <item>
      <title>Customs Tools</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/customs-tools/m-p/1096534#M20376</link>
      <description>&lt;P&gt;hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a custom extension created in VB.NET for ArcGIS.&amp;nbsp; In one of the forms I have two tools which do very similar things (select a point from the map area) and so the code is rather similar.&amp;nbsp; One of the tools works but the other throws a NullReferenceException.&amp;nbsp; It happens because the following line returns nothing:&lt;/P&gt;&lt;P&gt;pCommandItem = Application.Document.CommandBars.Find(pUID, False, False)&lt;/P&gt;&lt;P&gt;However, and this is what is confusing to me - apart of course from why the two tools with similar wording has one not work ... If I add the tool to the ToolBar for the whole extension then it works in this form.&lt;/P&gt;&lt;P&gt;This is not a good solution since I do not want the tool in the ToolBar - it only works in relation to what the form is doing.&amp;nbsp; But why should it be working if it is added to the ToolBar, but not if it, and the similar tool are added to the Form?&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;shawn&lt;/P&gt;</description>
      <pubDate>Wed, 08 Sep 2021 20:38:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/customs-tools/m-p/1096534#M20376</guid>
      <dc:creator>shawnstanley</dc:creator>
      <dc:date>2021-09-08T20:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Customs Tools</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/customs-tools/m-p/1099612#M20382</link>
      <description>&lt;P&gt;You need to explain what '&lt;SPAN&gt;pUID' is referencing and show your code.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 12:34:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/customs-tools/m-p/1099612#M20382</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2021-09-18T12:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Customs Tools</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/customs-tools/m-p/1104507#M20392</link>
      <description>&lt;P&gt;pUID is referencing the ClassID of the tool itself.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;pUID.Value = "{" &amp;amp; SelectPoint1.ClassId &amp;amp; "}"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SelectPoint1 or SelectPoint2 are the two tools being referenced.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The full code of point of those two tools is here, it's SelectPoint1.&amp;nbsp; As noted above, the other tool is the same, it just writes to a different part of the form.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Imports System.Runtime.InteropServices&lt;BR /&gt;Imports System.Drawing&lt;BR /&gt;Imports ESRI.ArcGIS.ADF.BaseClasses&lt;BR /&gt;Imports ESRI.ArcGIS.ADF.CATIDs&lt;BR /&gt;Imports ESRI.ArcGIS.Framework&lt;BR /&gt;Imports ESRI.ArcGIS.ArcMapUI&lt;BR /&gt;Imports System.Windows.Forms&lt;BR /&gt;Imports System.Windows.Forms.Application&lt;/P&gt;&lt;P&gt;Imports ESRI.ArcGIS.ArcScene&lt;BR /&gt;Imports ESRI.ArcGIS.Analyst3D&lt;/P&gt;&lt;P&gt;&amp;lt;ComClass(SelectPoint1.ClassId, SelectPoint1.InterfaceId, SelectPoint1.EventsId), _&lt;BR /&gt;ProgId("NAME.SelectPoint1")&amp;gt; _&lt;BR /&gt;Public NotInheritable Class SelectPoint1&lt;BR /&gt;Inherits BaseTool&lt;/P&gt;&lt;P&gt;#Region "COM Registration Function(s)"&lt;BR /&gt;&amp;lt;ComRegisterFunction(), ComVisibleAttribute(False)&amp;gt; _&lt;BR /&gt;Public Shared Sub RegisterFunction(ByVal registerType As Type)&lt;BR /&gt;' Required for ArcGIS Component Category Registrar support&lt;BR /&gt;ArcGISCategoryRegistration(registerType)&lt;/P&gt;&lt;P&gt;'Add any COM registration code after the ArcGISCategoryRegistration() call&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;lt;ComUnregisterFunction(), ComVisibleAttribute(False)&amp;gt; _&lt;BR /&gt;Public Shared Sub UnregisterFunction(ByVal registerType As Type)&lt;BR /&gt;' Required for ArcGIS Component Category Registrar support&lt;BR /&gt;ArcGISCategoryUnregistration(registerType)&lt;/P&gt;&lt;P&gt;'Add any COM unregistration code after the ArcGISCategoryUnregistration() call&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;#Region "ArcGIS Component Category Registrar generated code"&lt;BR /&gt;''' &amp;lt;summary&amp;gt;&lt;BR /&gt;''' Required method for ArcGIS Component Category registration -&lt;BR /&gt;''' Do not modify the contents of this method with the code editor.&lt;BR /&gt;''' &amp;lt;/summary&amp;gt;&lt;BR /&gt;Private Shared Sub ArcGISCategoryRegistration(ByVal registerType As Type)&lt;BR /&gt;Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)&lt;BR /&gt;MxCommands.Register(regKey)&lt;/P&gt;&lt;P&gt;End Sub&lt;BR /&gt;''' &amp;lt;summary&amp;gt;&lt;BR /&gt;''' Required method for ArcGIS Component Category unregistration -&lt;BR /&gt;''' Do not modify the contents of this method with the code editor.&lt;BR /&gt;''' &amp;lt;/summary&amp;gt;&lt;BR /&gt;Private Shared Sub ArcGISCategoryUnregistration(ByVal registerType As Type)&lt;BR /&gt;Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)&lt;BR /&gt;MxCommands.Unregister(regKey)&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;#End Region&lt;BR /&gt;#End Region&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;#Region "COM GUIDs"&lt;BR /&gt;' These GUIDs provide the COM identity for this class&lt;BR /&gt;' and its COM interfaces. If you change them, existing&lt;BR /&gt;' clients will no longer be able to access the class.&lt;BR /&gt;Public Const ClassId As String = "a38b65c3-255c-4578-ab06-2e00c59efa2d"&lt;BR /&gt;Public Const InterfaceId As String = "042a7209-0920-4531-95be-9bcbb0f4a64d"&lt;BR /&gt;Public Const EventsId As String = "c94af36c-0e76-43ad-96ad-28d77b008c17"&lt;BR /&gt;#End Region&lt;/P&gt;&lt;P&gt;Private m_application As IApplication&lt;/P&gt;&lt;P&gt;' A creatable COM class must have a Public Sub New()&lt;BR /&gt;' with no parameters, otherwise, the class will not be&lt;BR /&gt;' registered in the COM registry and cannot be created&lt;BR /&gt;' via CreateObject.&lt;BR /&gt;Public Sub New()&lt;BR /&gt;MyBase.New()&lt;/P&gt;&lt;P&gt;MyBase.m_category = Work tools"&lt;BR /&gt;MyBase.m_caption = "Select Point"&lt;BR /&gt;MyBase.m_message = "Select Point"&lt;BR /&gt;MyBase.m_toolTip = "Select Point1"&lt;BR /&gt;MyBase.m_name = "SelectPoint1"&lt;/P&gt;&lt;P&gt;Try&lt;BR /&gt;Dim bitmapResourceName As String = Me.GetType().Name + ".bmp"&lt;BR /&gt;MyBase.m_bitmap = New Bitmap(Me.GetType(), bitmapResourceName)&lt;BR /&gt;MyBase.m_cursor = New System.Windows.Forms.Cursor(Me.GetType(), Me.GetType().Name + ".cur")&lt;BR /&gt;Catch ex As Exception&lt;BR /&gt;System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap")&lt;BR /&gt;End Try&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;Public Overrides Sub OnCreate(ByVal hook As Object)&lt;/P&gt;&lt;P&gt;If Not hook Is Nothing Then&lt;BR /&gt;m_application = CType(hook, IApplication)&lt;/P&gt;&lt;P&gt;'Disable if it is not ArcMap or ArcScene&lt;BR /&gt;If TypeOf hook Is IMxApplication Or TypeOf hook Is ESRI.ArcGIS.ArcScene.ISxApplication Then&lt;BR /&gt;MyBase.m_enabled = True&lt;BR /&gt;Else&lt;BR /&gt;MyBase.m_enabled = False&lt;BR /&gt;End If&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;' TODO: Add other initialization code&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;Public Overrides Sub OnClick()&lt;BR /&gt;'TODO: Add SelectPoint1.OnClick implementation&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;Public Overrides Sub OnMouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Integer, ByVal Y As Integer)&lt;/P&gt;&lt;P&gt;Dim pPoint As ESRI.ArcGIS.Geometry.IPoint = Nothing&lt;/P&gt;&lt;P&gt;Dim pFeatures As Collection = Nothing&lt;BR /&gt;Dim pFeature As ESRI.ArcGIS.Geodatabase.IFeature = Nothing&lt;/P&gt;&lt;P&gt;If TypeOf m_pApp Is ESRI.ArcGIS.ArcMapUI.IMxApplication Then&lt;/P&gt;&lt;P&gt;' If the tool applies to an active view make sure the right map is showing&lt;BR /&gt;pPoint = m_pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y)&lt;/P&gt;&lt;P&gt;Dim pMap As ESRI.ArcGIS.Carto.IMap&lt;BR /&gt;pMap = m_pActiveView.HitTestMap(pPoint)&lt;/P&gt;&lt;P&gt;If pMap Is Nothing Then Exit Sub&lt;/P&gt;&lt;P&gt;If Not pMap Is m_pActiveView.FocusMap Then&lt;/P&gt;&lt;P&gt;m_pActiveView.FocusMap = pMap&lt;BR /&gt;m_pActiveView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGraphics, Nothing, Nothing)&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;NAME.GetClosestFeature((m_pActiveView.FocusMap), pPoint, pFeatures, pFeature)&lt;/P&gt;&lt;P&gt;ElseIf TypeOf m_pApp Is ESRI.ArcGIS.ArcScene.ISxApplication Then&lt;/P&gt;&lt;P&gt;Dim pSxDoc As ESRI.ArcGIS.ArcScene.ISxDocument&lt;BR /&gt;pSxDoc = m_pApp.Document&lt;BR /&gt;Dim pScene As IScene&lt;BR /&gt;pScene = pSxDoc.Scene&lt;BR /&gt;Dim pSG As ESRI.ArcGIS.Analyst3D.ISceneGraph&lt;BR /&gt;pSG = pScene.SceneGraph&lt;/P&gt;&lt;P&gt;Dim pOwner As stdole.IUnknown = Nothing&lt;BR /&gt;Dim pObject As stdole.IUnknown = Nothing&lt;/P&gt;&lt;P&gt;pSG.Locate(pSG.ActiveViewer, X, Y, ESRI.ArcGIS.Analyst3D.esriScenePickMode.esriScenePickGeography, True, pPoint, pOwner, pObject)&lt;/P&gt;&lt;P&gt;If (pPoint Is Nothing) Then&lt;/P&gt;&lt;P&gt;Beep()&lt;BR /&gt;Exit Sub&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;NAME.GetClosestSceneFeature(pScene, pPoint, pFeatures, pFeature)&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;Dim SelectDistanceForm As frmSelectDistance&lt;/P&gt;&lt;P&gt;If OpenForms.Item("frmSelectDistance") IsNot Nothing Then&lt;/P&gt;&lt;P&gt;'exists&lt;BR /&gt;SelectDistanceForm = OpenForms.Item("frmSelectDistance")&lt;/P&gt;&lt;P&gt;Else&lt;/P&gt;&lt;P&gt;SelectDistanceForm = Nothing&lt;BR /&gt;'not exists&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;If (pFeature Is Nothing) Then&lt;/P&gt;&lt;P&gt;SelectDistanceForm.txtLatitude1.Text = ""&lt;BR /&gt;SelectDistanceForm.txtLongitude1.Text = ""&lt;BR /&gt;Exit Sub&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;Dim lngField As Integer&lt;/P&gt;&lt;P&gt;lngField = pFeature.Fields.FindField(SelectDistanceForm.cbxLatitude.Text)&lt;BR /&gt;SelectDistanceForm.txtLatitude1.Text = CStr(pFeature.Value(lngField))&lt;BR /&gt;lngField = pFeature.Fields.FindField(SelectDistanceForm.cbxLongitude.Text)&lt;BR /&gt;SelectDistanceForm.txtLongitude1.Text = CStr(pFeature.Value(lngField))&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;Public Overrides Sub OnMouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Integer, ByVal Y As Integer)&lt;BR /&gt;'TODO: Add SelectPoint1.OnMouseMove implementation&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;Public Overrides Sub OnMouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Integer, ByVal Y As Integer)&lt;BR /&gt;'TODO: Add SelectPoint1.OnMouseUp implementation&lt;BR /&gt;End Sub&lt;BR /&gt;End Class&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 18:39:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/customs-tools/m-p/1104507#M20392</guid>
      <dc:creator>shawnstanley</dc:creator>
      <dc:date>2021-10-04T18:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Customs Tools</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/customs-tools/m-p/1104682#M20393</link>
      <description>&lt;P&gt;Have a look at these discussions?&lt;/P&gt;&lt;P&gt;&lt;A href="https://gis.stackexchange.com/questions/1533/how-to-programmatically-get-a-reference-to-an-icommand-inside-arcgis" target="_blank"&gt;https://gis.stackexchange.com/questions/1533/how-to-programmatically-get-a-reference-to-an-icommand-inside-arcgis&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://gis.stackexchange.com/questions/32038/how-to-find-all-icommanditem-instances-of-a-custom-button-command-in-an-arcmap-a" target="_blank"&gt;https://gis.stackexchange.com/questions/32038/how-to-find-all-icommanditem-instances-of-a-custom-button-command-in-an-arcmap-a&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 09:19:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/customs-tools/m-p/1104682#M20393</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2021-10-05T09:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: Customs Tools</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/customs-tools/m-p/1106434#M20395</link>
      <description>&lt;P&gt;I'm afraid I don't understand what's going on on those pages Duncan enough to understand how to apply it to my situation.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 15:29:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/customs-tools/m-p/1106434#M20395</guid>
      <dc:creator>shawnstanley</dc:creator>
      <dc:date>2021-10-11T15:29:59Z</dc:date>
    </item>
  </channel>
</rss>

