Hello @aniket_pachore ,
look at this VBA-Code:
Sub CreateOffsetDim()
Dim oCenterline As SketchLine
Dim oSecondLine As SketchLine
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oSk As PlanarSketch
Set oSk = oDoc.ComponentDefinition.Sketches(1)
'search first centerline
Dim oLine As SketchLine
For Each oLine In oSk.SketchLines
If oLine.Centerline Then
Set oCenterline = oLine
Exit For
End If
Next
If oCenterline Is Nothing Then Exit Sub
'search first parallel line
For Each oLine In oSk.SketchLines
If Not (oLine Is oCenterline) Then
If oLine.Geometry.Direction.IsParallelTo(oCenterline.Geometry.Direction) Then
Set oSecondLine = oLine
Exit For
End If
End If
Next
If oSecondLine Is Nothing Then Exit Sub
'create dimension
Dim oDimPt As Point2d
Set oDimPt = ThisApplication.TransientGeometry.CreatePoint2d(-1, 1)
Dim oDim As DimensionConstraint
Set oDim = oSk.DimensionConstraints.AddOffset(oSecondLine, oCenterline, oDimPt, True)
oDoc.Update
End Sub