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: 

Getting wall surrounding curtain wal

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
R.van.den.Bor
1287 Views, 7 Replies

Getting wall surrounding curtain wal

Hi there,

 

Does anybody know how to get the wall a curtain wall is in. With a window you can simply ask for it's host, however a curtain wall doesn't have these parameters since it's not considered being a hosted element.  

 

So what I want is to get the wall a selected curtain wall is in (or the wall 'surrounding' the curtain wall or being the closest to the curtain wall). 

 

Anyone ?

 

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
7 REPLIES 7
Message 2 of 8
Joe.Ye
in reply to: R.van.den.Bor

Hi Remy Not quite sure what's your scenario. With regard to get the element close to another element, there are two options. 1. Document.FindReferencesWithContextByDirection() method 2. Use the ElementIntersectsElementFilter or ElementIntersectsSolidFilter filter to filter out the element nearby to a specified element or a given solid. For more information about these methods, classes, refer to RevitAPI.chm or out online developer guide.


Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Message 3 of 8
R.van.den.Bor
in reply to: Joe.Ye

Hello Joe Ye,

 

I have a wall. In this wall I have used curtain walls. I want to replace the curtain walls for windows. In order to do so I need to know the ID of the wall the curtain wall is in. And since a curtain wall isn't considered being hosted, It doesn't tell me in what wall it's placed. (where for example a window and door have this hosted information)

 

The aproach I thought of taking was

1) Select te curtain wall and get it's location adn wall it is in

2) delete the curtain wall

3) place a windows family on the same ocation the curtain wall was in using doc.Create.NewFamilyInstance(points, symbol, host, host.Level, _non_rst);

 

I don't know if there is a way of placing a windows at a certain location, wothout having to use the host information?

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 4 of 8
Joe.Ye
in reply to: R.van.den.Bor

 

Thanks Remy for the udpate. It is clear now.

Are your curtain wall totally embeded in one ordinary wall? or stand side by side with two ordinary walls?

After you delete the curtain wall, there will be a hole in the wall.  Can this hole be filled automatically by Revit?  Or the two walls beside the curtain wall are seperate?

 

 

You can use the XRay solution or the intersecting filter to filter out the "Host" wall from the selected curtain wall according to their position relationship.

 

If the host wall is one wall, using the above method, you can get the "host" wall. So just use this host wall to create window calling doc.Create.NewFamilyInstance(points, symbol, host, host.Level, _non_rst).

 

Revit API doesn't allow developers to create window/door without the host wall.   If the "host" walls of the curtain wall are two separate walls, you can extend one wall to connect the other wall's end, and then create window in the extended wall by doc.Create.NewFamilyInstance(points, symbol, host, host.Level, _non_rst).

 

 

 

 



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Message 5 of 8
R.van.den.Bor
in reply to: Joe.Ye

Thank you for your reply Joe,

 

I mean indeed my curtain wall is totally embedded in one wall. 

Like I wrote, I first get its location, then delete the curtain wall leaving the wall without a hole. THen place a window to the prior curtain wall location with the doc.Create.NewFamilyInstance(points, symbol, host, host.Level, _non_rst) method.

 

So the only two things I can't figure out:

1: How do I get the ID of the wall the curtain wall was embedded in?

You say use the Xray method.. DO you have an example of it? I tried googling but didn't find a topic about it.

2: When I take my sample project and put in the hardcode ID of the wall, the routine works. BUT, the window is placed 'inside' the wall and I have to manually select the "Cut" tool to let the window cut the wall. I read something about placing the window at exactly the same wall coordinates.

 

 

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 6 of 8
Joe.Ye
in reply to: R.van.den.Bor

Hi Remy, The simplest way to find the "Host" wall of the curtain wall, is via the ElementIntersectsElementFilter class. See the following code fragment. It can select the "host" wall. Selection sel = this.ActiveUIDocument.Selection; Reference ref1 = sel.PickObject(ObjectType.Element,"Please pick a curtain wall"); Wall w = doc.GetElement(ref1) as Wall; ElementIntersectsElementFilter filter = new ElementIntersectsElementFilter(w,false); FilteredElementCollector collector = new FilteredElementCollector(doc); collector.WherePasses(filter); string msg; foreach(Element elem in collector) { if(elem.Id.IntegerValue != w.Id .IntegerValue) sel.Elements.Add(elem); } With regard to the XRay solution, in Revit 2014, the worker class is ReferenceIntersector class. In the SDK samples you can search for ReferenceIntersector string, AvoidObstruction sample and FindReferencesByDirection sample shows the usage. To put the window within the wall, you need to use the point coordinates within the wall in the plan view. Attached a code fragment for your reference.


Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Message 7 of 8
R.van.den.Bor
in reply to: Joe.Ye

Thanx Joe Ye, sometimes things are so easy 🙂
Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 8 of 8
rhanzlick
in reply to: R.van.den.Bor

This is a rather old thread, but I am having good luck with the ElementIntersectsElementFilter:

 

ElementIntersectsElementFilter intersect = new ElementIntersectsElementFilter(selectedWall);
List<Wall> connectedWalls = new FilteredElementCollector(doc).OfClass(typeof(Wall)).WherePasses(intersect).Select(x => x as Wall).ToList();

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community