Hi here, I want to create an opening in a wall and I want to know if you have some examples for this. I tried all things that I found on internet and on the forum and nothing worked. Is there someone to help me?
Solved! Go to Solution.
Hi here, I want to create an opening in a wall and I want to know if you have some examples for this. I tried all things that I found on internet and on the forum and nothing worked. Is there someone to help me?
Solved! Go to Solution.
Solved by Mohamed_Arshad. Go to Solution.
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
Hope this Helps 🙂
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
Hope this Helps 🙂
Hi @amati_p ,
In addition to what @arshad99 said, I would advise you to start by creating an opening in Revit in UI.
Analyse the opening element using the Revit Lookup tool and get the required points.
Use the points in the NewOpening() method.
Hi @amati_p ,
In addition to what @arshad99 said, I would advise you to start by creating an opening in Revit in UI.
Analyse the opening element using the Revit Lookup tool and get the required points.
Use the points in the NewOpening() method.
Can't find what you're looking for? Ask the community or share your knowledge.