GetCrossSlopeAtStation method doesn't work in a for loop

Hi,
I want to list the cross slopes in every round station of my alignment via a python script but I’m struggling with that. For an individual station I managed to make it, but using it in a for loop I always get an error message.

# Load the Python Standard and DesignScript Libraries
import sys
import clr

# Add Assemblies for AutoCAD and Civil3D
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')

# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *

# Import references from Civil3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *

# The inputs to this node will be stored as a list in the IN variables.
A = IN[0]   # Alignment
O = IN[1]   # Offset value
S = IN[2]   # Surface

adoc = Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor

with adoc.LockDocument():
    with adoc.Database as db:

        with db.TransactionManager.StartTransaction() as t:
            
            # starting station
            SS = A.InternalDBObject.StartingStation
            # ending station
            ES = A.InternalDBObject.EndingStation
            
            # sequence from starting station to ending station, incrementing by 1
            r = range(int(SS),int(ES))
            
            #DesignedCrossSlopeLeft = A.InternalDBObject.GetCrossSlopeAtStation(4444, 1, 0)
            
            # listing the actual cross slope value in every station
            DesignedCrossSlopeLeft = []
            for i in r:
                DesignedCrossSlopeLeft.append(A.InternalDBObject.GetCrossSlopeAtStation(i, 1, 0)
            
            t.Commit()
            pass

# Assign your output to the OUT variable.
OUT = DesignedCrossSlopeLeft

A Parenthesis is missing DesignedCrossSlopeLeft.append(A.InternalDBObject.GetCrossSlopeAtStation(i, 1, 0))

1 Like