Get Face Without Inserts

Get Face Without Inserts

mastjaso
Advocate Advocate
2,979 Views
7 Replies
Message 1 of 8

Get Face Without Inserts

mastjaso
Advocate
Advocate

Hi guys, I was wondering if there's a way of getting a wall face without the inserts (short of temporarily unloading or deleting the inserts)? I've got an add-in that bases things off wall faces and projecting points onto them, but my issue is that if I try and project a point on a window it "misses" that wall. So ideally I'd like to be able to project onto the face sans all inserts. 

 

I've been using HostObjectUtils.GetSideFaces to get the faces but wasn't sure how to make it ignore inserts (if it's possible or if you have to access that data another way).

0 Likes
Accepted solutions (2)
2,980 Views
7 Replies
Replies (7)
Message 2 of 8

aignatovich
Advisor
Advisor

Hi!

May be you need to use temporary transaction http://thebuildingcoder.typepad.com/.services/blog/6a00e553e16897883300e553fcc7418834/search?filter....

Just open transaction, remove all wall inserts, regenerate document, than perform calculations you need, than rollback your transaction

0 Likes
Message 3 of 8

mastjaso
Advocate
Advocate

Ah thanks, I did look into that but unfortunately I don't think it's possible since the walls / windows are in a linked model. Currently I'm thinking about trying to get the wall curves and create a surface out of them to project onto but I haven't had a chance to delve into how feasible or computationally intense this is (since it's gonna need to happen hundred - 1000s of times per add-in execution). I was hoping there was some built in method or class to get just the face without the inserts.

0 Likes
Message 4 of 8

matthew_taylor
Advisor
Advisor

Hi @mastjaso,

I think you need to be more specific about what an 'insert' is. Is it a native Revit opening? A placed familyinstance with a void?

 

Have you considered:

  1. (Temporarily) creating a substitute wall without 'inserts' in your model?
  2. Can you create a plane/face using the (outer) edge loops of the wall Geometry?
  3. If the 'inserts' aren't visible at a given detail level, then you may be able to get the Geometry at that detail level (using Options).
  4. If the 'inserts' aren't visible in a given view, then you may be able to get the Geometry from that view (using Options).
  5. (Temporarily) filling the holes with an in-place solid.

Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
0 Likes
Message 5 of 8

aignatovich
Advisor
Advisor

Hi!

We still don't know, what you want to achieve. For example, for planar walls you may get side face, create transform object with face.Origin, face.XVector, face.YVector, then get Transform.Inverse. You may transform face outer boundary curveloop and your point to this coordinate system (all z coordinates of outer boundary should be zeros, you may consider this polygon as flat). Removing z coordinate of your point you'll get projection to planar plane, then you may easily determine if the point lies in your polygon with a lot of approaches, for example, you may use NetTopologySuite library or realize algorithm by yourself. This will work very fast, you may easily perform thousands calculations

0 Likes
Message 6 of 8

mastjaso
Advocate
Advocate

Hi, thanks for the reply, unfortunately other deadlines have kept me from actually attempting any of these solutions yet. Basically I'm going to have walls of possibly any type (planar or curved) and I want to get their blank face as if there were no doors or windows to project a point on to. I'm going to ignore the case of specific wall openings because I don't think that's likely to arrive in this use case.

 

I was thinking of using the outer curve loops and constructing a surface to project onto, however, I've got to do some testing, I'm not sure if the outer curve loops would include the cutout of a door (since it's touching the bottom edge of the wall) but for now, I'm thinking the simplest solution might be @matthew_taylor's suggestion to use a 3D view with no doors or windows loaded in it, I completely forgot that was an option for getting geometry. 

I'll be sure to report back on what I end up trying and how well it works though.

 

Cheers,

J

 

0 Likes
Message 7 of 8

jeremytammik
Autodesk
Autodesk
Accepted solution

Dear Mastjaso,

 

Thank you for your query, and thank you very much Alexander and Matt for your help and valuable input.

 

I searched The Building Coder for the word 'gross', as in gross versus net surface area of a wall, and found some hits on discussions that may be of use to you if you continue this investigation:

 

 

Oh, and be sure to check out the SpatialElementGeometryCalculator add-in:

 

 

It demonstrates use of SpatialElementGeometryCalculator to determine net and gross wall area per room and lists other relevant The Building Coder discussions.

 

I hope this helps.

 

Best regards,

 

Jeremy



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

Message 8 of 8

FAIR59
Advisor
Advisor
Accepted solution

Tucked away in the ExporterIFCUtils are the 2 methods you need. They work without transaction and also on walls in linked files.

ExporterIFCUtils.HasElevationProfile(wall)

ExporterIFCUtils.GetElevationProfile(wall)

 

You need to check first if the wall has a profile  [ .HasElevationProfile(wall) ], because the GetElavationProfile method will throw an Exception if the wall has no profile.

 

To use the methods, add  RevitAPIIFC.dll as a reference.

 

using Autodesk.Revit.DB.IFC;

if (ExporterIFCUtils.HasElevationProfile(wall))
{
    	IList<CurveLoop> profile = ExporterIFCUtils.GetElevationProfile(wall);
}