The “target mapping’ feature in Autodesk Civil 3D 2022 has changed, which affects how custom subassemblies are written. This feature now allows a subassembly to target object types in addition to alignments and profiles associated with the corridor that it requires to define its geometry.
There are four changes to the way you write a custom subassembly:
A subassembly can now target an offset target and elevation target (instead of an alignment and a profile), which are represented by new parameter types in ParamLogicalNameType. If you want to support the new target types in your subassemblies, you need to replace:
To get the offset and elevation target collections from the corridorState object, use ParamsOffsetTarget and ParamsElevationTarget instead of ParamsAlignment and ParamsProfile. All the offset targets (including network pipe offset targets) are in ParamsOffsetTarget, and all elevation targets (including network pipe elevation targets) are in ParamsElevationTarget. Here’s an example from the BasicLaneTransition.vb sample in the Sample VB.NET Subassembly section below:
Dim oParamsLong As ParamLongCollection oParamsLong = corridorState.ParamsLong Dim oParamsOffsetTarget As ParamOffsetTargetCollection oParamsOffsetTarget = corridorState.ParamsOffsetTarget
Targets are now objects, instead of alignment or profile IDs. Now WidthOffsetTarget is defined for offset targets, and SlopeElevationTarget is defined for elevation targets, so you can declare targets as objects instead of IDs. Here’s an example from the BasicLaneTransition.vb sample in the Sample VB.NET Subassembly section below:
Dim offsetTarget As WidthOffsetTarget 'width or offset target offsetTarget = Nothing Dim elevationTarget As SlopeElevationTarget 'slope or elevation target elevationTarget = Nothing
The CalcAlignmentOffsetToThisAlignment() utility method now calculate the offset from this alignment to the offset target. This method no longer returns the station value; it now returns the XY coordinate of the offset target at the point perpendicular to the alignment’s station.
You can also now use the SlopeElevationTarget.GetElevation method to get an elevation on an elevation target directly, instead of using CalcAlignmentOffsetToThisAlignment(). Here’s an example from the BasicLaneTransition.vb sample in the Sample VB.NET Subassembly section below:
'get elevation on elevationTarget Try dOffsetElev = elevationTarget.GetElevation(oCurrentAlignmentId, _ corridorState.CurrentStation, Utilities.GetSide(vSide)) Catch Utilities.RecordWarning(corridorState, _ CorridorError.LogicalNameNotFound, _ "TargetHA", "BasicLaneTransition") dOffsetElev = corridorState.CurrentElevation + vWidth * vSlope End Try