works, here's the code
Dim oEmbankmentTypeTarget As WidthOffsetTarget
Try
oEmbankmentTypeTarget = oParamsOffsetTarget.Value("TargetHA1")
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
Using lock As DocumentLock = acDoc.LockDocument
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
'' Open the Block table for read
Dim acBlkTbl As BlockTable
acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead)
'' Open the Block table record Model space for write
Dim acBlkTblRec As BlockTableRecord
acBlkTblRec = CType(acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), _
OpenMode.ForWrite), BlockTableRecord)
Dim obj As DBObject = acTrans.GetObject(oEmbankmentTypeTarget.TargetId, OpenMode.ForWrite)
If TypeOf obj Is Polyline Then
Dim oPoly2dOrig As Polyline = CType(obj, Polyline)
'get the index where the current station is closest to
Dim x, y, z As Double
corridorState.SoeToXyz(corridorState.CurrentAlignmentId, corridorState.CurrentStation, 0, 0, x, y, z)
Dim oPt3D_CL As New Point3d(x, y, z)
'get vertex index (fraction)
Dim dVertex As Double = oPoly2dOrig.GetParameterAtPoint(oPoly2dOrig.GetClosestPointTo(oPt3D_CL, True))
'get polyline width
dSegmentWidth = oPoly2dOrig.GetStartWidthAt(Truncate(dVertex))
End If
End Using
End Using
Stantec
Dell Precision 5530, Prism M320PU, C3D 14/17/19