Getting the outline of door/window opening in a floor plan

Getting the outline of door/window opening in a floor plan

l.virone
Enthusiast Enthusiast
892 Views
1 Reply
Message 1 of 2

Getting the outline of door/window opening in a floor plan

l.virone
Enthusiast
Enthusiast

Hi,

 

I'm a beginner in the API and I'd like to have an opinion on a problem I'm encountering.

I want to get a curveloop of the outline of a door/window opening in the host wall in a floor plan.

Goal : Draw a floor whose shape includes the room + the doors/windows in the room.

 

I've tried the method : ExporterIFCUtils.GetInstanceCutoutFromWall but i didn't achieved to get the loop on a floorview, only on an elevation/section view.

 

Currently, i'm trying to draw the opening using some values but i don't think it's the right method to use (code below).

 

CurveLoop get_instance_loop(FamilyInstance door)
        {
            Document doc = door.Document;
            CurveLoop loop = null;

            Wall wall = door.Host as Wall;
            double door_width = door.Symbol.LookupParameter("Width").AsDouble();
            double wall_width = wall.WallType.Width;

            LocationPoint pos = door.Location as LocationPoint;
            XYZ orientation = wall.Orientation;

            //Create a rectangle using the values

            return loop;
        }

 

 

What do you think ? Am i on the right path ?

 

Tks,

Lorenzo

 

0 Likes
893 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk

Welcome to the Revit API.

 

That is a pretty advanced question, already, and a good approach for very simple cases.

 

For more complicated real-world cases, you can retrieve the element geometry for a specific view.

 

Depending on what view you choose, different geometry will be returned.

 

You can even see what geometry is returned for which view using RevitLookup.

    

For instance, the RoomEditor retrieves a 2D outline from an element from the projection of a 3D view:

 

https://github.com/jeremytammik/RoomEditorApp

 

My more recent element outline app makes use of the plan view instead and gets a different result:

 

https://github.com/jeremytammik/ElementOutline

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes