can anyone help me convert this vba script to python

On Error Resume Next
Dim pMxDoc As IMxDocument
Dim pMap As IMap
Dim pCurve As ICurve
Dim pFromPoint As IPoint
Dim dXFrom As Double
Dim bSrefFromMap As Boolean
'=======================
'Adjust the parameter below
'bSrefFromMap = True ==> the coordinates will be calculated in the projection of the Map
'bSrefFromMap = False ==> the coordinates will be calculated in the projection of the data
bSrefFromMap = False
'=======================
If (Not IsNull([Shape])) Then
  Set pCurve = [Shape]
  If (Not pCurve.IsEmpty) Then
    If (bSrefFromMap) Then
      Set pMxDoc = ThisDocument
      Set pMap = pMxDoc.FocusMap
      pCurve.Project pMap.SpatialReference
    End If
    Set pFromPoint = pCurve.FromPoint
    dXFrom = pFromPoint.X
  End If
End If

__esri_field_calculator_splitter__
dXFrom

thank you very much for the help

Edit: added code tags, vegaseat

What is Shape?

shape is a field in a database (a GIS field)

what is a GIS field?

GIS is the program that I would like to use this script in...so the field (shape) is a field in the GIS program ARCmap and so on

GIS is the program that I would like to use this script in...so the field (shape) is a field in the GIS program ARCmap and so on

GIS is for suckas, foo! :mrgreen:

Rumor (not mine) is that Microsoft will drop further development of VB. I am sure that VBA will hang around as their sripting language of choice a little longer. A VBA to Python translator would be "theee" project for any enterprising programmer. The only problem is that you have to glutter your brain with VBA syntax.

You can write much more clean code if you start with Python over again. VB code is usually just to "helter skelter"! Look at your application and rewrite it in Python.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.