<?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 Flip subset of lines using arcpy.FlipLine_edit in a Python script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/flip-subset-of-lines-using-arcpy-flipline-edit-in/m-p/424685#M33341</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In a Python script I can't seem to get FlipLine_edit to work on a selected set of lines contained within a shapefile. Unfortunately, all of the lines are getting flipped instead of just those that are selected. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Steps I am using (note code snippet pasted below, full script attached):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;Create a layer using MakeFeatureLayer&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Count all lines using GetCount (report result with print statement)&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Select a subset of lines using SelectLayerByAttribute&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Count selected lines using GetCount (report result with print statement)&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Attempt to change direction of selected lines using FlipLine_edit&lt;/LI&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;PRE class="plain" name="code"&gt;arcpy.MakeFeatureLayer_management(shpLine, "lyrLines") strCountAll = str(arcpy.GetCount_management("lyrLines")) print "Count of all features is " + strCountAll arcpy.SelectLayerByAttribute_management("lyrLines", "NEW_SELECTION", '"Flip_yn" = \'yes\'') strCountSelected = str(arcpy.GetCount_management("lyrLines")) print "Count of selected features is " + strCountSelected arcpy.FlipLine_edit(shpLine) arcpy.SelectLayerByAttribute_management("lyrLines", "CLEAR_SELECTION") &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In ArcMap, when using the Flip Line tool contained within Editing Tools: &lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;No lines selected: all lines will be flipped&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;One line selected: the selected line will be flipped&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;SPAN&gt;FYI: I have 64-bit Windows 7 with ArcGIS 10.1 (ArcInfo license) and both Python 2.7.2 and Pythonwin (both 2.7.2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also tried using FlipLine using arcpy.da.UpdateCursor, but individual lines were not being flipped this way either.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance for any input!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Mar 2014 16:45:30 GMT</pubDate>
    <dc:creator>DarrenMcCormick</dc:creator>
    <dc:date>2014-03-12T16:45:30Z</dc:date>
    <item>
      <title>Flip subset of lines using arcpy.FlipLine_edit in a Python script</title>
      <link>https://community.esri.com/t5/python-questions/flip-subset-of-lines-using-arcpy-flipline-edit-in/m-p/424685#M33341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In a Python script I can't seem to get FlipLine_edit to work on a selected set of lines contained within a shapefile. Unfortunately, all of the lines are getting flipped instead of just those that are selected. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Steps I am using (note code snippet pasted below, full script attached):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;Create a layer using MakeFeatureLayer&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Count all lines using GetCount (report result with print statement)&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Select a subset of lines using SelectLayerByAttribute&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Count selected lines using GetCount (report result with print statement)&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Attempt to change direction of selected lines using FlipLine_edit&lt;/LI&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;PRE class="plain" name="code"&gt;arcpy.MakeFeatureLayer_management(shpLine, "lyrLines") strCountAll = str(arcpy.GetCount_management("lyrLines")) print "Count of all features is " + strCountAll arcpy.SelectLayerByAttribute_management("lyrLines", "NEW_SELECTION", '"Flip_yn" = \'yes\'') strCountSelected = str(arcpy.GetCount_management("lyrLines")) print "Count of selected features is " + strCountSelected arcpy.FlipLine_edit(shpLine) arcpy.SelectLayerByAttribute_management("lyrLines", "CLEAR_SELECTION") &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In ArcMap, when using the Flip Line tool contained within Editing Tools: &lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;No lines selected: all lines will be flipped&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;One line selected: the selected line will be flipped&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;SPAN&gt;FYI: I have 64-bit Windows 7 with ArcGIS 10.1 (ArcInfo license) and both Python 2.7.2 and Pythonwin (both 2.7.2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also tried using FlipLine using arcpy.da.UpdateCursor, but individual lines were not being flipped this way either.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance for any input!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 16:45:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/flip-subset-of-lines-using-arcpy-flipline-edit-in/m-p/424685#M33341</guid>
      <dc:creator>DarrenMcCormick</dc:creator>
      <dc:date>2014-03-12T16:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: Flip subset of lines using arcpy.FlipLine_edit in a Python script</title>
      <link>https://community.esri.com/t5/python-questions/flip-subset-of-lines-using-arcpy-flipline-edit-in/m-p/424686#M33342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;In a Python script I can't seem to get FlipLine_edit to work on a selected set of lines contained within a shapefile. Unfortunately, all of the lines are getting flipped instead of just those that are selected. &lt;BR /&gt;&lt;BR /&gt;Steps I am using (note code snippet pasted below, full script attached):&lt;BR /&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;Create a layer using MakeFeatureLayer&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Count all lines using GetCount (report result with print statement)&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Select a subset of lines using SelectLayerByAttribute&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Count selected lines using GetCount (report result with print statement)&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Attempt to change direction of selected lines using FlipLine_edit&lt;/LI&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;PRE class="plain" name="code"&gt;arcpy.MakeFeatureLayer_management(shpLine, "lyrLines") strCountAll = str(arcpy.GetCount_management("lyrLines")) print "Count of all features is " + strCountAll arcpy.SelectLayerByAttribute_management("lyrLines", "NEW_SELECTION", '"Flip_yn" = \'yes\'') strCountSelected = str(arcpy.GetCount_management("lyrLines")) print "Count of selected features is " + strCountSelected arcpy.FlipLine_edit(shpLine) arcpy.SelectLayerByAttribute_management("lyrLines", "CLEAR_SELECTION") &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;In ArcMap, when using the Flip Line tool contained within Editing Tools: &lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;No lines selected: all lines will be flipped&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;One line selected: the selected line will be flipped&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;FYI: I have 64-bit Windows 7 with ArcGIS 10.1 (ArcInfo license) and both Python 2.7.2 and Pythonwin (both 2.7.2)&lt;BR /&gt;&lt;BR /&gt;I also tried using FlipLine using arcpy.da.UpdateCursor, but individual lines were not being flipped this way either.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance for any input!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Your code is flipping every line because you are feeding the FlipLine_edit tool the shapefile (shpLine) directly, not the layer with the selection ("lyrLines").&amp;nbsp; It is flipping the shapefile on disk itself like it is being done from ArcCatalog, not from a Desktop layer.&amp;nbsp; Try feeding it the "lyrLines" layer instead.&amp;nbsp; Only layers contain selections, not shapefile objects themselves.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 17:02:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/flip-subset-of-lines-using-arcpy-flipline-edit-in/m-p/424686#M33342</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-03-12T17:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Flip subset of lines using arcpy.FlipLine_edit in a Python script</title>
      <link>https://community.esri.com/t5/python-questions/flip-subset-of-lines-using-arcpy-flipline-edit-in/m-p/424687#M33343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Richard:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The info in your reply post solved the problem. I should have known this - doh!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks so much!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Darren&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 17:21:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/flip-subset-of-lines-using-arcpy-flipline-edit-in/m-p/424687#M33343</guid>
      <dc:creator>DarrenMcCormick</dc:creator>
      <dc:date>2014-03-12T17:21:51Z</dc:date>
    </item>
  </channel>
</rss>

