19 Replies Latest reply on Mar 26, 2014 6:52 AM by geonetadmin

    Cut polygons without selection edit task for arcmap v10 sp3

    geonetadmin
      Original User: bwragg

      Hi all,

      I've spent days now trying to get the "Cut polygons without selection" sample (
      http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Sample_Cut_polygons_without_selection_edit_task/000100000077000000/) to work with ArcMap v10 sp3 (ArcView). We need this extension so we can trace selected features without selecting the polygon we want to split. I know what your going to say..."just use the normal 'Cut polygon tools' with the new trace tool that doesn't require to select features' but we can't use this tool as we have really complex data and we have to trace long distances. As a result when we have tested the new 'trace without a selection' feature we end up accidentally tracing many small features. Hence we would like to get this old sample working.

      I'm not a vb developer but with some help from a developer I've downloaded the vb.net solution and compiled it. I've run ESRIRegAsm, select Desktop and it succeeds in registering it. I've checked the dependancies with dependancy walker and its all good. I've checked the Components.exe program and I can see it registers itself under "ESRI Engine Edit Tasks" but not under "ESRI Edit Tasks" which is the spot you would put it in 9.3 and 9.2. When I run ArcMap I can't see the task 'Cut Polygon without selection' in the task list. I assume this is because its not added in the Components.exe under "ESRI Edit Tasks". If I manually try to add it throws an error saying 'Can't Load Library'.

      So is there a way to get this sample to compile and install so that it runs as a task in the normal Editor toolbar in ArcMap? Or have I missed some readme that explains this sample is only available in the Engine?

      Also is there a reason ESRI doens't compile this as a dll like they used to for previous versions?

      Thanks,

      bwragg
        • Re: Cut polygons without selection edit task for arcmap v10 sp3
          geonetadmin
          Original User: agray1

          The reason you can't use this sample in ArcMap is that it is made for engine.

          Implements ESRI.ArcGIS.Controls.IEngineEditTask
          
           Private Shared Sub ArcGISCategoryRegistration(ByVal registerType As Type)
              Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
              EngineEditTasks.Register(regKey)
          
            End Sub
            ''' <summary>
            ''' Required method for ArcGIS Component Category unregistration -
            ''' Do not modify the contents of this method with the code editor.
            ''' </summary>
            Private Shared Sub ArcGISCategoryUnregistration(ByVal registerType As Type)
              Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
              EngineEditTasks.Unregister(regKey)
          
          ...
          
          #Region "Private Members"
            Private m_engineEditor As IEngineEditor
            Private m_editSketch As IEngineEditSketch
            Private m_editLayer As IEngineEditLayers
          #End Region
          
          
            End Sub


          You could try to use the ArcGIS developer templates (installed with the arcgis developer kit) to create an ArcMap edit task and copy the code (not all the code, just the methods that make up the interface) and the member variables.  You would have to convert all the classes specific to engine to the a similar class specific to ArcMap.  Probably a task that an ArcObjects developer could undertake.
          • Re: Cut polygons without selection edit task for arcmap v10 sp3
            geonetadmin
            Original User: bwragg

            The reason you can't use this sample in ArcMap is that it is made for engine.

            Implements ESRI.ArcGIS.Controls.IEngineEditTask
            
             Private Shared Sub ArcGISCategoryRegistration(ByVal registerType As Type)
                Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
                EngineEditTasks.Register(regKey)
            
              End Sub
              ''' <summary>
              ''' Required method for ArcGIS Component Category unregistration -
              ''' Do not modify the contents of this method with the code editor.
              ''' </summary>
              Private Shared Sub ArcGISCategoryUnregistration(ByVal registerType As Type)
                Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
                EngineEditTasks.Unregister(regKey)
            
            ...
            
            #Region "Private Members"
              Private m_engineEditor As IEngineEditor
              Private m_editSketch As IEngineEditSketch
              Private m_editLayer As IEngineEditLayers
            #End Region
            
            
              End Sub


            You could try to use the ArcGIS developer templates (installed with the arcgis developer kit) to create an ArcMap edit task and copy the code (not all the code, just the methods that make up the interface) and the member variables.  You would have to convert all the classes specific to engine to the a similar class specific to ArcMap.  Probably a task that an ArcObjects developer could undertake.


            Thanks agray, I had an feeling that might be the answer I got. Guess we'll have to start trying to convert the code. Thanks again for your time.

            I'm sure I'm not the first person who's had to do this...anyone out there got a compiled dll already???

            Thanks
            • Re: Cut polygons without selection edit task for arcmap v10 sp3
              ttruong
              Hi Ben,

              I know that this thread has been for awhile, were you be able to re-create this tool?
              • Re: Cut polygons without selection edit task for arcmap v10 sp3
                geonetadmin
                Original User: bwragg

                Hi Ben,

                I know that this thread has been for awhile, were you be able to re-create this tool?


                Hi, Sorry for the late reply, no I haven't been able to re-create this tool but would love to hear any information you may have on this.

                Thanks,

                bwragg
                • Re: Cut polygons without selection edit task for arcmap v10 sp3
                  johns
                  I found this to be an essential tool in 9x since it: 1. allowed cutting without having to select a polygon (saving the time and clicks involved in changing to the select tool, making a selection and then changing back to the sketch tool), and 2. it allowed cutting using selected features and the trace tool.

                  I would still like this tool in 10x.  I went through a lot of the same wasted effort with the developer sample before finding out it was only for Engine.  It could avoid the selection clicks when using a sketch to cut a polygon.  As for using the trace tool, in 10x the cut polygon tool combined with the trace tool is really nice, but tracing can be difficult in places where there are many features at the scale one is editing.  So in 10x I'd like both the built in and the cut without selecting versions, and in both have the ability to use 10's trace without selecting, or to use 9's trace using only the selected features for more control.
                  • Re: Cut polygons without selection edit task for arcmap v10 sp3
                    geonetadmin
                    Original User: sean_jones

                    I'll take a crack at the conversion and post it up on editing labs.

                    In the meantime you can:
                    Union the selected set of lines you would have traced, into an empty temporary layer.
                    Using the cut polygon tool, replace the sketch with the line you just unioned.
                    • Re: Cut polygons without selection edit task for arcmap v10 sp3
                      sean_jones-esristaff
                      Ok, the ported sample is up on arcgis.com as the Cut Polygons Without Selection Tool code sample.
                      This is a visual studio 2010 project that will create a 10.1 desktop add-in for use in ArcMap.

                      The code is included so you can generally see the pattern for creating edit tools that use the sketch in the 10.x framework.
                      The tool was created using the esri add-in templates in visual studio by creating a construction tool but without the category part, thus you still get an edit tool template that uses the sketch but without it being a construction tool. The code from the OnFinishSketch method in the engine edit task was then ported to the OnSketchFinished method in the add-in.

                      You can create COM dll for use in 10.0.x using the same pattern but by using the Desktop ArcMap Edit Tool template in the ArcGIS New Item wizard when creating a new class in your com dll project. Stick the code in the m_editEvents_OnSketchFinished method. Note that this has to be a com dll at 10.0.x because add-ins do not support implementing interfaces until 10.1, and you need to implement ISketchTool to use the sketch. Consider changing the ArrayList to generics and use a different method for the sketch-polygon intersection if you take this on.
                      • Re: Cut polygons without selection edit task for arcmap v10 sp3
                        geonetadmin
                        Original User: johns

                        Excellent!  It works either with the feature templates or with my customized classic editing in 10.1.  Thank you very much Sean.
                        • Re: Cut polygons without selection edit task for arcmap v10 sp3
                          ttruong
                          Attached is a COM component version of this tool allows us to create sketch of cut line by using other sketch tools like: Right Angle, Arc, End Point Arc, Tangent Curve, & Bezier Curve.

                          [ATTACH=CONFIG]15790[/ATTACH]

                          To use:
                          1. Install this tool
                          2. Start Editing from Editor toolbar.
                          3. Select a polygon feature class that you want to edit.
                          4. Select Cut Polygons Without Selection tool from Construction Tools.
                          5. Sketch on map to create a line that cuts through the original polygon(s) as desired.
                          6. You can create your sketch with any Feature Construction (straight lines, with curves, or tracing from the shapes of other features) to place vertices in the sketch. Youâ??ll be able to use snap, too.
                          7. Double click, press F2 key, or Right-click anywhere on the map and choose Finish Sketch to complete you cut line.
                          • Re: Cut polygons without selection edit task for arcmap v10 sp3
                            geonetadmin
                            Original User: rbonar

                            I'm using 10.1. I tired to install the tool, but get a message saying I need to install version 10. Can we get the tool to work with 10.1?
                            • Re: Cut polygons without selection edit task for arcmap v10 sp3
                              geonetadmin
                              Original User: bwragg

                              sean_jones & ttruong thankyou so much! I just tried the compiled version in 10 sp5 and it works great.

                              We really appreciate your efforts. Thanks again.
                              • Re: Cut polygons without selection edit task for arcmap v10 sp3
                                ttruong
                                I'm using 10.1. I tired to install the tool, but get a message saying I need to install version 10. Can we get the tool to work with 10.1?


                                With ArcGIS Desktop v10.1, you need to use the addin that sean_jones created in post # 8
                                • Re: Cut polygons without selection edit task for arcmap v10 sp3
                                  geonetadmin
                                  Original User: rbonar

                                  With ArcGIS Desktop v10.1, you need to use the addin that sean_jones created in post # 8


                                  Thanks. My problem is I don't understand how to install it.
                                  • Re: Cut polygons without selection edit task for arcmap v10 sp3
                                    jajohnso
                                    Thanks. My problem is I don't understand how to install it.


                                    I also do not know how to proceed with installing on 10.1.

                                    I have previously registered the .dll and added this in 9.3.x, but I cannot find "esriRegSvr32.exe" in Program Files\ArcGIS\Bin for 10.1.

                                    Am I missing a step?


                                    These are the instructions I wrote for myself for a 9.3.x install, perhaps someone can tell me where I am going wrong.




                                    Download and save correctly
                                    1.Download and unzip your add in to a file location you desire.
                                    2.Open the location and find the .dll file containing the name of your add-in.
                                    3.Save a copy at :/Program Files/ArcGIS/Bin

                                    Register the .dll 
                                    1.Open Windows Explorer and navigate to C:\Program Files\ArcGIS\Bin.
                                    2.Find �??esriRegSvr32.exe�?� and run it.
                                    3.Check the �??Register Files�?� and �??Individual File�?� boxes, then click "select".
                                    3.Find your .dll in the ArcGIS\Bin folder, then hit OK.

                                    Add your .dll to the ArcGIS edit tasks
                                    1.Open Windows Explorer and navigate to C:\Program Files\ArcGIS\Bin.
                                    2.Find �??categories.exe�?� and run it.
                                    3.Scroll to the folder �??ESRI Edit Tasks�?�, select it, then click �??Add Object.
                                    4.Navigate to C:\Program Files\ArcGIS\Bin and select your .dll.

                                    Verify
                                    1.Start an edit session and see if the new tool is available in the Task dropdown.
                                    2.If not, open the Editor Properties dialog; at Editor / Options / Edit Tasks.
                                    3.Select the Add button and click on the Desired add in.
                                    4.This should add the "Zipper task" or "Cut polygon without selection" to the list of tasks.

                                    Thanks


                                    I retract my previous inquiry on how to install on 10.1.

                                    I used "the force" and figured it out; actually pretty easy, easier than in 9.3.x

                                    Just double click on "CutPolygonsWithoutSelection.esriAddIn" that comes in the zip file.

                                    Then simply add it by the same way you add any tool to the toolbar.

                                    Thanks for making it!
                                    • Re: Cut polygons without selection edit task for arcmap v10 sp3
                                      geonetadmin
                                      Original User: ttruong

                                      It's been quite a while since I was here.  The attached is the new deployment package of the COM component version I just recompile today.  I modified the launch conditions to make it works for both ArcGIS 10.0 and 10.1.

                                      For those who have trouble installing the add-in for 10.1, you can try this COM component version.  It should be as same as the add-in version that Sean Jones created for 10.1.

                                      Let me know if you run into any troubles with the installer.
                                      • Re: Cut polygons without selection edit task for arcmap v10 sp3
                                        geonetadmin
                                        Original User: bwragg

                                        It's been quite a while since I was here.  The attached is the new deployment package of the COM component version I just recompile today.  I modified the launch conditions to make it works for both ArcGIS 10.0 and 10.1.

                                        For those who have trouble installing the add-in for 10.1, you can try this COM component version.  It should be as same as the add-in version that Sean Jones created for 10.1.

                                        Let me know if you run into any troubles with the installer.


                                        Hi ttruong,

                                        I just tried installing this on a new install of ArcGIS 10 sp5 and I get an error after clicking "install". It says "ArcGIS Desktop 10.0 or 10.1 is required before you can complete this setup". Any ideas?

                                        Thanks,

                                        bwragg
                                        • Re: Cut polygons without selection edit task for arcmap v10 sp3
                                          grpOptivert
                                          Ok, the ported sample is up on arcgis.com as the Cut Polygons Without Selection Tool code sample.
                                          This is a visual studio 2010 project that will create a 10.1 desktop add-in for use in ArcMap.

                                          The code is included so you can generally see the pattern for creating edit tools that use the sketch in the 10.x framework.
                                          The tool was created using the esri add-in templates in visual studio by creating a construction tool but without the category part, thus you still get an edit tool template that uses the sketch but without it being a construction tool. The code from the OnFinishSketch method in the engine edit task was then ported to the OnSketchFinished method in the add-in.

                                          You can create COM dll for use in 10.0.x using the same pattern but by using the Desktop ArcMap Edit Tool template in the ArcGIS New Item wizard when creating a new class in your com dll project. Stick the code in the m_editEvents_OnSketchFinished method. Note that this has to be a com dll at 10.0.x because add-ins do not support implementing interfaces until 10.1, and you need to implement ISketchTool to use the sketch. Consider changing the ArrayList to generics and use a different method for the sketch-polygon intersection if you take this on.


                                          Hello , i try to download your source code in the link above but it says that i don't have authorisation to see this content. I'm logged with my esri global account... Any tips ? Thx
                                          • Re: Cut polygons without selection edit task for arcmap v10 sp3
                                            geonetadmin
                                            Original User: sean_jones

                                            Sorry about that, I've shared it publicly. We're reorganizing those editing labs samples.