Create Method (Document, ElementId, XYZ, XYZ, XYZ, PointLoadType)


Creates a new custom hosted point load within the project using data at point.

Namespace: Autodesk.Revit.DB.Structure
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since:  2024

Syntax

C#
public static PointLoad Create(
	Document document,
	ElementId hostElemId,
	XYZ point,
	XYZ forceVector,
	XYZ momentVector,
	PointLoadType symbol
)
Visual Basic
Public Shared Function Create ( _
	document As Document, _
	hostElemId As ElementId, _
	point As XYZ, _
	forceVector As XYZ, _
	momentVector As XYZ, _
	symbol As PointLoadType _
) As PointLoad
Visual C++
public:
static PointLoad^ Create(
	Document^ document, 
	ElementId^ hostElemId, 
	XYZ^ point, 
	XYZ^ forceVector, 
	XYZ^ momentVector, 
	PointLoadType^ symbol
)

Parameters

document
Type: Autodesk.Revit.DBDocument
Document to which new point load will be added.
hostElemId
Type: Autodesk.Revit.DBElementId
The AnalyticalElement host element for the point Load.
point
Type: Autodesk.Revit.DBXYZ
The position of point load, measured in decimal feet.
forceVector
Type: Autodesk.Revit.DBXYZ
The applied 3d force vector.
momentVector
Type: Autodesk.Revit.DBXYZ
The applied 3d moment vector.
symbol
Type: Autodesk.Revit.DB.StructurePointLoadType
The symbol of the PointLoad. Set a null reference (Nothing in Visual Basic) to use default type.

Return Value

If successful, returns the newly created PointLoad, a null reference (Nothing in Visual Basic) otherwise.

Examples

CopyC#
Document document = commandData.Application.ActiveUIDocument.Document;
UIDocument activeDoc = commandData.Application.ActiveUIDocument;

//select object for adding a point load
Reference eRef = activeDoc.Selection.PickObject(ObjectType.Element, "Please select the analytical element");
ElementId selectedElementId = null;
if (eRef != null && eRef.ElementId != ElementId.InvalidElementId)
   selectedElementId = eRef.ElementId;

XYZ location = activeDoc.Selection.PickPoint("Point Load location");

using (Transaction transaction = new Transaction(document, "Create custom PointLoad"))
{
   transaction.Start();
   PointLoad pointLoad = null;

   if (PointLoad.IsPointInsideHostBoundaries(document, selectedElementId, location))
      pointLoad = PointLoad.Create(document, selectedElementId, location, new XYZ(1, 0, 0), new XYZ(1, 0, 0), null);

   transaction.Commit();
}

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentException hostElemId is not permitted for this type of load. -or- Thrown when work plane is not valid.
Autodesk.Revit.ExceptionsArgumentNullException A non-optional argument was null
Autodesk.Revit.ExceptionsArgumentsInconsistentException Thrown when force and moment vectors are equal zero.
Autodesk.Revit.ExceptionsInvalidOperationException Thrown if type could not be set for newly created point load.

See Also

ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →