Message 1 of 8

Not applicable
07-26-2021
03:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
Last night I was trying to make a split roof function which creates different roofs for each top face.
At the moment it is working around half of the time because sometimes it can't find the geometry of the face reference. Most of the times the workaround is to draw the roof again and use the function again. But I can't figure out what causes the error.
The code looks kind of like this:
var host = _doc.GetElement(RoofReference) as HostObject;
var topReferences = HostObjectUtils.GetTopFaces(host);
foreach (var r in topReferences)
{
var face = host.GetGeometryObjectFromReference(r) as PlanarFace;
var curveLoop = face.GetEdgesAsCurveLoops().First();
}
The value of face can sometimes be null.
I don't know the cause of this.
Can somebody give me an explanation why this occurs.
Or maybe a different method I can use.
Thanks anyway,
Jens Slofstra
Solved! Go to Solution.