Hei Anders,
You have to use this metohod: http://www.revitapidocs.com/2017/2e299798-26c8-9e42-47de-d496151d1e3d.htm
C#:
public static LineLoad Create(
Document aDoc,
AnalyticalModelSurface host,
int curveIndex,
XYZ forceVector1,
XYZ momentVector1,
LineLoadType symbol
)
In python you can do something like this:
LineLoad.Create( aDoc,host, curveIndex, forceVector1, momentVector1, symbol)
The challenge here is to find the correct curveIndex. The surfaces boundary curves are stored in a certain order, and you need to find which index the curve you need has. You can use Dynamo for that, in this example I found the index of the line with the largest z-value in the midpoint of the lines.
with this script for finding the boundary curves:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
element = UnwrapElement(IN[0])
curveloops = element.GetLoops(AnalyticalLoopType.External)
if len(curveloops) < 2:
OUT = [curve.ToProtoType() for curve in curveloops[0]]