Revit Line loads through Dynamo

Hi

I am trying to create hosted line loads for wall elements through Dynamo, but I have some difficulties. I have tried the method in this thread: “http://dynamobim.org/forums/topic/line-loads-creation-via-python/”, but I would like the line load to follow the analytical wall element - if possible.
I don’t know how to select the hosted line in Dynamo and thereby define a hosted line load.

Regards Anders

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]]
2 Likes

Hi Einar

Thank you for the help, this was exactly what I needed.

No problem! It would be nice if you share the end result when you make it work and mark it as resolved.

I got it to work!

Here is a simple example

Again thanks for the help!

1 Like

You can find a similar topic here:

Complete newbie here. Any idea as to what I did wrong? Thank you very much!

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 29, in
TypeError: expected AnalyticalModelSurface, got AnalyticalModelStick