getting issue to identify the window inside room.

getting issue to identify the window inside room.

prasannamurumkar
Advocate Advocate
1,074 Views
4 Replies
Message 1 of 5

getting issue to identify the window inside room.

prasannamurumkar
Advocate
Advocate

Hi facing issue with window if it is inside room.

tried 3 ways

1.Passes bounding box filter to room but all windows inside model getting.Means filter not applying properly.

2.tried by getting walls using boundry segment in room through loop.And then get associate element of wall.But only one window is identified.Although room has three window.Please find image. here window 2 &3 is not identified by API.The wall is getting identified of 2 &3 window but when use asssociate element api window not present in that.

 

IEnumerable<Element> associate = new FilteredElementCollector(revitDocument).OfClass(typeof(FamilyInstance)).Where(m => (m as FamilyInstance).Host == null ? false : (m as FamilyInstance).Host.Id == eleTem.Id);

here eleTem.Id is wall ID.

3.tried by "ispointinsideroom"  by giving location point of window.but window is not getting identified.

 

Is their any other way should try?

waiting for reply.

thank you.

0 Likes
Accepted solutions (1)
1,075 Views
4 Replies
Replies (4)
Message 2 of 5

jeremy_tammik
Alumni
Alumni

If the more complex approach fails, you might want to start by trying something simple.

 

The IsPointInRoom method tests whether a single XYZ point is contained in a room:

 

https://www.revitapidocs.com/2022/96e29ddf-d6dc-0c40-b036-035c5001b996.htm

 

Try to get that running and see whether it performs according to your needs.

 

If it does, you can expand it, e.g., by checking all window corner vertices, its convex hull, etc.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 5

prasannamurumkar
Advocate
Advocate

ok will try.

0 Likes
Message 4 of 5

TripleM-Dev.net
Advisor
Advisor
Accepted solution

Hi,

 

Seeing the image, the window(s) aren't located in the room, they border it.

Can't you use "ToRoom" or/and "FromRoom" for windows families hosted? ToRoom Property (Phase) 

Take all possible Windows (from level) and compare their ToRoom/FromRoom property against the desired room.

 

Ps. You can check it with a Window Schedule, and add the ToRoom/FromRoom room number.

 

Note: If the window instance is to far from the edge of the Room it may not work, and the families should use the roomcalculation point.

 

Hints to why the approaches may not work

1 - bounding box can fail if room is at a angle or non-rectangle shape (will find to many windows or not right ones)

2 - Room boundary can be created by another wall or room seperation line. Evaluate the room edges themself, and identify walls matching those edges (not relay on the object creating the edge)

3 - The windows family origin point would have to be in the room?, most common it will be in the wall..

 

- Michel

0 Likes
Message 5 of 5

prasannamurumkar
Advocate
Advocate

Thank you for reply.

For above case 

It works when used get_FromRoom and get_ToRoom api

FamilyInstance fasWin = elemWindow as FamilyInstance;

 

Room froom = fasWin.get_FromRoom(phase);

fasWin.get_ToRoom(phase)

 

and storing value of window and room in dictionary.

 

0 Likes