This script creates a smooth path for a pipe using a 3D sketch and then a circle at one end to define the profile for the sweep.  The sweep can then be manually completed.


# create the part and get the yz plane
MyPart = Part('Test')
YZPlane = MyPart.GetPlane('YZ-Plane')
 
# create the route for the pipe
PipeRoute = MyPart.Add3DSketch('Pipe Route')
PipeRoute.AddBspline([0, 0, 0,    5, 0, 0,    10, 5, 5,    15, 10, 5,    15, 15, 15])
 
# create the pipe profile as a circle on the yz plane
StartProfile = MyPart.AddSketch('Start Profile', YZPlane)
StartProfile.AddCircle(0, 0, 5, False)