I am trying to create a bounding box for any given ploygon using Revit API. Can someone help?
namespace Revit_SquarePlacement.Command
{
[Transaction(TransactionMode.Manual)]
class cmd_Training : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
{
try
{
UIApplication UIAPP = commandData.Application;
UIDocument UIDoc = UIAPP.ActiveUIDocument;
Autodesk.Revit.DB.Document ActiveDoc = UIDoc.Document;
//Creating Bounding Box
Reference oRef = UIDoc.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element);
Element oLineEle = ActiveDoc.GetElement(oRef.ElementId);
Line oLine = oLineEle as Wall;
if (oWall != null)
{
LocationCurve WallocCurve = oWall.Location as LocationCurve;
Line oLine = WallocCurve.Curve as Line;
XYZ LineStartPoint = oLine.GetEndPoint(0);
XYZ LineEndPoint = oLine.GetEndPoint(1);
}
I tried finding the start and end point of a line and using that I tried getting min and max value of the line in order to get a bounding box. How should I move forward?