M

PointLoad.Create

Description:
Creates a new custom hosted point load within the project using data at point.
Overloads (2):
Create(Document,ElementId,XYZ,XYZ,XYZ,PointLoadType)
public static PointLoad Create(
	Document document,
	ElementId hostElemId,
	XYZ point,
	XYZ forceVector,
	XYZ momentVector,
	PointLoadType symbol
)
Return Value nullNothingnullptr If successful, returns the newly created PointLoad, null Nothing nullptr a null reference ( Nothing in Visual Basic) otherwise.
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();
}