Working with Alignment.StationOffsetByPoint dictionary

I’m trying out the new Alignment.StationOffsetByPoint and looking for a way to get the minimum station in the list. Then get its corresponding offset. In the example shown, I have the stations/offsets for two points listed. I would like to take the minimum station and corresponding offset and write it to a property set property and/or file.
image

1 Like

Hi @keith.sowinski ,

Try to sort them prior to using Alignment.StationOffsetByPoint.

Here’s the concept:
Guide1

Here’s the sample:
Guide2

Cheers,
Jowenn

Thank you @JowennLua for the suggestion. I’m trying to do something a little different. In my case, I only have 1 alignment, but multiple points. I want to get the station/offset values for the multiple points based on the 1 alignment. Then, I want to get the point that has the lowest station value and it’s corresponding offset. In other words, the station values must be known before they can be sorted.

@JowennLua I think I figured this out. If you see a simpler way, I’m all ears, but this seems to work.

1 Like

Hi @keith.sowinski ,

I originally thought you got multiple alignments vs multiple points. If you aim to have 1 alignment and multiple points then what you have there is already good. Maybe, just a suggestion to make a list of station and offset and use List.GetItemAtIndex to treat them both. Here’s a sample and maybe convert to csv.

Cheers,
Jowenn

2 Likes

Thanks @JowennLua.

Another note about the Alignment.StationOffsetByPoint node: The output is raw station, so if you want the station with station equations, you’ll need a python script using the Alignment.GetStationStringWithEquations method.

Thanks for this Jowenn, Just wondering if i have to filter this list for a certain value of offset can it be possible with FilterByBoolMask or have to use some other method ?

How would that python code look like? I haven’t done much in python before and I tried on a very low level after @mzjensen webinar about Civil 3D API

Regards,
Patrick

1 Like
# 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.
align = IN [0]

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

with adoc.LockDocument():
    with adoc.Database as db:
        with db.TransactionManager.StartTransaction() as t:
            aeccAlign = align.InternalDBObject
            aeccAlign = Alignment.StationEquations
            aeccAlign = Alignment.GetStationStringWithEquations
            t.Commit()
            pass

# Assign your output to the OUT variable.
OUT = aeccAlign
1 Like