Ok in this case replace the foreach loop with this new one:
For Each c As Curve In ListCurve If TypeOf c Is Line Then Dim l As Line = TryCast(c, Line) Dim ts As Transform = Nothing Dim ptOrigin As XYZ = XYZ.Zero Dim ptYAxis As XYZ = XYZ.BasisY If l.Direction.Z = 1 OrElse l.Direction.Z = -1 Then ts = Transform.CreateRotationAtPoint(ptYAxis, Math.PI / 2 * l.Direction.Z, l.Origin) Dim tc As Line = TryCast(c.CreateTransformed(ts), Line) ca.Append(tc) Else ca.Append(c) End If Else Dim ts As Transform = Nothing Dim a As Arc = TryCast(c, Arc) Dim ptOrigin As XYZ = XYZ.Zero Dim ptYAxis As XYZ = XYZ.BasisY If a.Normal.Z = 0 Then ts = Transform.CreateRotationAtPoint(ptYAxis, Math.PI / 2 * a.Normal.X, c.GetEndPoint(1)) Dim tc As Arc = TryCast(c.CreateTransformed(ts), Arc) ca.Append(tc) Else ca.Append(c) End If End If Next
You may need to do some trimming after the creation of the Detail Item. Please don't forget to mark this reply as an answer.