Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create a newopening

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
amati_p
227 Views, 2 Replies

Create a newopening

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?

Labels (2)
2 REPLIES 2
Message 2 of 3
Mohamed_Arshad
in reply to: amati_p

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 🙂

 

Thanks & Regards,
Mohamed Arshad K
Message 3 of 3
naveen.kumar.t
in reply to: amati_p

Hi @amati_p ,

In addition to what @arshad99 said, 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.

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Rail Community