<?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: Need help with simple translation (VBA -&amp;gt; Pyhton) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/need-help-with-simple-translation-vba-amp-gt/m-p/474962#M37205</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Are they multipart features? You may need to strip out each part first to access the X,Y geometry. If you are translating anyways, I would suggest using cursors instead of field calculator.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, VBA is supported in 10.0 still, you just need to authorize the VBA license. It's a good idea to start switching though, since 10.1 will be the last version you can even use VBA from what I understand; after which it will be fully deprecated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 16 Jul 2012 21:51:29 GMT</pubDate>
    <dc:creator>MathewCoyle</dc:creator>
    <dc:date>2012-07-16T21:51:29Z</dc:date>
    <item>
      <title>Need help with simple translation (VBA -&amp;gt; Pyhton)</title>
      <link>https://community.esri.com/t5/python-questions/need-help-with-simple-translation-vba-amp-gt/m-p/474961#M37204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need help from someone to translate a small piece of code from VBA to Phython, due to the fact that the company I am working for has upgraded from ArcGIS 9.3.1 to 10.0 and VBA is no longer supported.&amp;nbsp; The code block is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;static x0 as double, y0 as double&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dim pPoint as IPoint&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;set pPoint = [Shape]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;x = pPoint.X&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;y = pPoint.Y&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;d = sqr((x-x0)^2 + (y-y0)^2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;x0 = x&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;y0= y&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is used with the calculate field tool inside model builder and as far as I can tell retrieves info about two points and calculates the difference in distance between them. I have attempted a few translations on my own with little success using !shape.firstpoint.x!, !shape.firstpoint.y!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately my knowledge is lacking and I need some assistance.&amp;nbsp; If you are able to help, that would be greatly appreciated!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jordan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jul 2012 19:44:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-with-simple-translation-vba-amp-gt/m-p/474961#M37204</guid>
      <dc:creator>JordanWalker</dc:creator>
      <dc:date>2012-07-16T19:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with simple translation (VBA -&gt; Pyhton)</title>
      <link>https://community.esri.com/t5/python-questions/need-help-with-simple-translation-vba-amp-gt/m-p/474962#M37205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Are they multipart features? You may need to strip out each part first to access the X,Y geometry. If you are translating anyways, I would suggest using cursors instead of field calculator.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, VBA is supported in 10.0 still, you just need to authorize the VBA license. It's a good idea to start switching though, since 10.1 will be the last version you can even use VBA from what I understand; after which it will be fully deprecated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jul 2012 21:51:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-with-simple-translation-vba-amp-gt/m-p/474962#M37205</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-07-16T21:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with simple translation (VBA -&gt; Pyhton)</title>
      <link>https://community.esri.com/t5/python-questions/need-help-with-simple-translation-vba-amp-gt/m-p/474963#M37206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;They are point files with thousands of GPS fixes from cattle collars.&amp;nbsp; However, I think I may be onto something with the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;def calc_distance(shape, x0, y0):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; point = shape.getPart(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; X = point.X&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Y = point.Y &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; d = math.sqrt(pow(X-x0,2) + pow(Y-y0,2)) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return d&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Expression:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;calc_distance(!SHAPE!, 0, 0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will try it out today.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2012 14:06:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-with-simple-translation-vba-amp-gt/m-p/474963#M37206</guid>
      <dc:creator>JordanWalker</dc:creator>
      <dc:date>2012-07-17T14:06:08Z</dc:date>
    </item>
  </channel>
</rss>

