0

I try to create a line load on a wall in Revit 2024 using python. But I'm getting an error. I have attached my code and error image below, can anybody help in solving this.

import clr
import Autodesk.Revit.DB
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import LineLoad
doc = __revit__.ActiveUIDocument.Document

all_eq = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElementType().ToElements()
locCrvs = [] #Create an empty list to store the curves
lLoad = []


t = Transaction(doc, "Transaction Name")
t.Start()

for w in all_eq:
    locCrvs = w.Location.Curve
    EleID = w.Id
    lLoad.append(LineLoad.Create(doc, EleID, locCrvs, XYZ(0,0,-1), XYZ(0,1,0), None))
t.Commit()

and there is a error occur: hostElemId is not permitted for this type of load.

I am using the Create Method in the Revit API Docs to create the line load

(Reference: https://www.revitapidocs.com/2024/6f4e235f-8aed-5f41-6d85-024e556dcb17.htm)

I dont know whether it is the problem of the input of LineLoadType? But i have no idea what should I input for the LineLoadType.

1 Answer 1

0

The error message that you share, hostElemId is not permitted for this type of load, indicates that the element you are trying to equip with a load does not support that operation. Please research which elements can be equipped with loads and how to do so manually in the end user interface first. It will provide more detailed error messages and better instructions and support on optimal workflows and best practices to achieve your goal. Once you have succeeded with your task manually in the UI, you can explore the resulting BIM using RevitLookup to find out how to achive the same result programmatically via the API.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for your reply. I have now figured out that line loads can only be applied to analytical panels in Revit 2024. I modified my code to use the analytical panel ID of a wall instead of the wall element ID as the hostElemID, and I was successful in applying the load to an analytical panel of a wall. However, I still facing a problem. When I filter all the analytical panels of walls, I have no idea how to determine which wall each analytical panel belongs to. I tried using Revit Lookup to check walls and its analytical panels, but I couldn't find a connection between them.
Well, since that is a different question, I would raise a new issue for that. I'm sorry I cannot tell off-hand. You might also want to check out the Revit MEP and API discussion forums. That question has very probably already been discussed and solved there in the past.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.