Hi,
Below is a quick (probably requires a lot of cleaning) solution to use the start and the end station while creating offset alignment. I’ve used the Alignment.CreateOffsetAlignment Method (database, offset alignment name, parent alignment name, offset, style, start station, end station) to create the offset alignments. Note the additional import [from Autodesk.Civil import *]
# 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')
clr.AddReference('Civil3DNodes')
# 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 import *
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *
# Import references for Dynamo for Civil 3D
from Autodesk.Civil.DynamoNodes import Alignment as DynAlignment
# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
adoc = Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor
civdoc = CivilApplication.ActiveDocument
align = IN[0]
alignmentstyle = IN[1]
offset = IN[2]
startstation = IN[3]
endstation = IN[4]
result = []
def cmoalignments(align,alignmentstyle,offset):
global adoc
global editor
global civdoc
try:
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
alignmentId = align.InternalObjectId
al = t.GetObject(alignmentId, OpenMode.ForRead)
alname = al.Name
bbsz = "BBSZ"
jbsz = "JBSZ"
lso = offset * -1
rso = offset * 1 # for ease of code reading
# Left offset Alignment
leftoffsetalname = alname + "-" + bbsz
leftoffsetId = Alignment.CreateOffsetAlignment(db,leftoffsetalname,alname,lso,alignmentstyle,startstation,endstation)
result.append(leftoffsetalname)
# Right Offset Alignment
rightoffsetalname = alname + "-" + jbsz
rightoffsetId = Alignment.CreateOffsetAlignment(db,rightoffsetalname,alname,rso,alignmentstyle,startstation,endstation)
result.append(rightoffsetalname)
t.Commit()
except Exception() as ex:
result.append(ex.message)
return result
# Assign your output to the OUT variable.
OUT = cmoalignments(align,alignmentstyle,offset)