<?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 ConstructOffset in Python with ArcObjects in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/constructoffset-in-python-with-arcobjects/m-p/175012#M13472</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm scripting with Python and ArcPy in ArcGIS 10.2. I want to create a offsetline from a polylineZ. ArcPy doesn't have such a function so far I know. Therefore I'm trying to use ArcObjects within my Pythonscript. My scripting is based on following VB.Net code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; &lt;SPAN style="color: #3333ff;"&gt;pConstructCurve = New Polyline&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #3333ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pConstructCurve.ConstructOffset(pInPolyline, dOffset, esriConstructOffsetEnum.esriConstructOffsetRounded +&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #3333ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; esriConstructOffsetEnum.esriConstructOffsetSimple)&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #3333ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ConstructOffset = pConstructCurve&lt;/SPAN&gt;&lt;BR /&gt; &lt;/BLOCKQUOTE&gt;&lt;P&gt;I use snippets.py from Mark Cederholm for creating and using ArcObjects. That's going very well with exception of the statement pConstructCurve.ConstructOffset. A part of my code is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;SPAN style="color: #000099;"&gt;pFeatureSelection = Snippits.CType(pFeatureLayer, esriCarto.IFeatureSelection)&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;pSelectionSet = pFeatureSelection.SelectionSet&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;pCursor = pSelectionSet.Search (None, False)&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;pFeatureCursor = Snippits.CType(pCursor, esriGeoDatabase.IFeatureCursor)&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;pFeat = pFeatureCursor.NextFeature()&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;while pFeat:&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Maak offsetlijnen:&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dOffset = 2.00&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Maak offsetlijn aan de rechterkant&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pPolyline = Snippits.NewObj(esriGeometry.Polyline, esriGeometry.IPolyline)&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pConstructCurve = Snippits.CType(pPolyline, esriGeometry.IConstructCurve)&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pInPolyline = Snippits.CType(pFeat.Shape, esriGeometry.IPolyline)&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iOffsetHow = esriGeometry.esriConstructOffsetMitered + esriGeometry.esriConstructOffsetSimple&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&lt;BR /&gt; &lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pConstructCurve.ConstructOffset(pInPolyline, dOffset, iOffsetHow)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pNewPolyline = Snippits.CType(pConstructCurve, esriGeometry.IPolyline)&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pNewFeature = pFCOffsetLine.CreateFeature()&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iLijnsoortField = pNewFeature.Fields.FindField(sLijnsoortFieldName)&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pNewFeature.Value[iLijnsoortField] = "rechts"&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pNewFeature.Store&lt;/SPAN&gt;&lt;BR /&gt; &lt;/BLOCKQUOTE&gt;&lt;P&gt; The statement pConstructCurve.ConstructOffset doesn't return anything of a couple of points (most two) with faulty X and Y values. Sometimes an error message appears: "The Geometry has no Z values"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Questions:&lt;/P&gt;&lt;P&gt; - Is it right that AcPy doesn't have such a function?&lt;/P&gt;&lt;P&gt; - What is wrong in my scripting?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 Dec 2014 16:54:05 GMT</pubDate>
    <dc:creator>Wimde_Valk</dc:creator>
    <dc:date>2014-12-04T16:54:05Z</dc:date>
    <item>
      <title>ConstructOffset in Python with ArcObjects</title>
      <link>https://community.esri.com/t5/python-questions/constructoffset-in-python-with-arcobjects/m-p/175012#M13472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm scripting with Python and ArcPy in ArcGIS 10.2. I want to create a offsetline from a polylineZ. ArcPy doesn't have such a function so far I know. Therefore I'm trying to use ArcObjects within my Pythonscript. My scripting is based on following VB.Net code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; &lt;SPAN style="color: #3333ff;"&gt;pConstructCurve = New Polyline&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #3333ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pConstructCurve.ConstructOffset(pInPolyline, dOffset, esriConstructOffsetEnum.esriConstructOffsetRounded +&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #3333ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; esriConstructOffsetEnum.esriConstructOffsetSimple)&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #3333ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ConstructOffset = pConstructCurve&lt;/SPAN&gt;&lt;BR /&gt; &lt;/BLOCKQUOTE&gt;&lt;P&gt;I use snippets.py from Mark Cederholm for creating and using ArcObjects. That's going very well with exception of the statement pConstructCurve.ConstructOffset. A part of my code is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;SPAN style="color: #000099;"&gt;pFeatureSelection = Snippits.CType(pFeatureLayer, esriCarto.IFeatureSelection)&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;pSelectionSet = pFeatureSelection.SelectionSet&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;pCursor = pSelectionSet.Search (None, False)&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;pFeatureCursor = Snippits.CType(pCursor, esriGeoDatabase.IFeatureCursor)&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;pFeat = pFeatureCursor.NextFeature()&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;while pFeat:&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Maak offsetlijnen:&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dOffset = 2.00&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Maak offsetlijn aan de rechterkant&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pPolyline = Snippits.NewObj(esriGeometry.Polyline, esriGeometry.IPolyline)&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pConstructCurve = Snippits.CType(pPolyline, esriGeometry.IConstructCurve)&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pInPolyline = Snippits.CType(pFeat.Shape, esriGeometry.IPolyline)&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iOffsetHow = esriGeometry.esriConstructOffsetMitered + esriGeometry.esriConstructOffsetSimple&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&lt;BR /&gt; &lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pConstructCurve.ConstructOffset(pInPolyline, dOffset, iOffsetHow)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pNewPolyline = Snippits.CType(pConstructCurve, esriGeometry.IPolyline)&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pNewFeature = pFCOffsetLine.CreateFeature()&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iLijnsoortField = pNewFeature.Fields.FindField(sLijnsoortFieldName)&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pNewFeature.Value[iLijnsoortField] = "rechts"&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #000099;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pNewFeature.Store&lt;/SPAN&gt;&lt;BR /&gt; &lt;/BLOCKQUOTE&gt;&lt;P&gt; The statement pConstructCurve.ConstructOffset doesn't return anything of a couple of points (most two) with faulty X and Y values. Sometimes an error message appears: "The Geometry has no Z values"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Questions:&lt;/P&gt;&lt;P&gt; - Is it right that AcPy doesn't have such a function?&lt;/P&gt;&lt;P&gt; - What is wrong in my scripting?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 16:54:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/constructoffset-in-python-with-arcobjects/m-p/175012#M13472</guid>
      <dc:creator>Wimde_Valk</dc:creator>
      <dc:date>2014-12-04T16:54:05Z</dc:date>
    </item>
  </channel>
</rss>

