Creates a new custom hosted point load within the project using data at point.
Namespace: Autodesk.Revit.DB.StructureAssembly: RevitAPI (in RevitAPI.dll) Version: 26.4.0.0 (26.4.0.0)
Syntax
C#
public static PointLoad Create(
Document document,
ElementId hostElemId,
XYZ point,
XYZ forceVector,
XYZ momentVector,
PointLoadType symbol
)
Parameters
- document Document
-
Document to which new point load will be added.
- hostElemId ElementId
-
The AnalyticalElement host element for the point Load.
- point XYZ
-
The position of point load, measured in decimal feet.
- forceVector XYZ
-
The applied 3d force vector.
- momentVector XYZ
-
The applied 3d moment vector.
- symbol PointLoadType
-
The symbol of the PointLoad. Set null to use default type.
Return Value
PointLoad
If successful, returns the newly created PointLoad,
null otherwise.
Exceptions
Example
C#
Document document = commandData.Application.ActiveUIDocument.Document;
UIDocument activeDoc = commandData.Application.ActiveUIDocument;
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();
}
VB
Dim document As Document = commandData.Application.ActiveUIDocument.Document
Dim activeDoc As UIDocument = commandData.Application.ActiveUIDocument
Dim eRef As Reference = activeDoc.Selection.PickObject(ObjectType.Element, "Please select the analytical element")
Dim selectedElementId As ElementId = Nothing
If eRef IsNot Nothing AndAlso eRef.ElementId IsNot ElementId.InvalidElementId Then selectedElementId = eRef.ElementId
Dim location As XYZ = activeDoc.Selection.PickPoint("Point Load location")
Using transaction As Transaction = New Transaction(document, "Create custom PointLoad")
transaction.Start()
Dim pointLoad As PointLoad = Nothing
If PointLoad.IsPointInsideHostBoundaries(document, selectedElementId, location) Then pointLoad = PointLoad.Create(document, selectedElementId, location, New XYZ(1, 0, 0), New XYZ(1, 0, 0), Nothing)
transaction.Commit()
See Also
Reference