HI @amati_p
Kindly Refer the below code
//Selection of Wall
Reference refer = uiDoc.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element);
//Get Wall
Wall wall = doc.GetElement(refer) as Wall;
//Diagonal Corner Points of the Rectangle
XYZ p1 = new XYZ(500 / 304.8, 0, 500 / 304.8);
XYZ p2 = new XYZ(1500 / 304.8, 0, 2000 / 304.8);
//Create Opening
using (Transaction createOpening=new Transaction(doc,"Create Opening"))
{
createOpening.Start();
doc.Create.NewOpening(wall, p1, p2);
createOpening.Commit();
}
Other References
https://help.autodesk.com/view/RVT/2014/ESP/?guid=GUID-CA1FB5D9-49BE-40D6-B9AA-BFDE21B10C8D
https://www.revitapidocs.com/2021.1/06a216d4-2cf6-ec8f-df5b-10f007b70531.htm
https://spiderinnet.typepad.com/blog/2013/05/revit-net-creations-api-create-floor-and-opening-2nd-tr...
Hope this Helps 🙂
Mohamed Arshad K
Software Developer (CAD & BIM)