<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Geometry from HostObjectUtils.GetTopFaces returns null in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/geometry-from-hostobjectutils-gettopfaces-returns-null/m-p/10497560#M24588</link>
    <description>&lt;P&gt;Is the Face a Planarface?&lt;/P&gt;</description>
    <pubDate>Mon, 26 Jul 2021 20:25:50 GMT</pubDate>
    <dc:creator>RPTHOMAS108</dc:creator>
    <dc:date>2021-07-26T20:25:50Z</dc:date>
    <item>
      <title>Geometry from HostObjectUtils.GetTopFaces returns null</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/geometry-from-hostobjectutils-gettopfaces-returns-null/m-p/10496036#M24585</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;Last night I was trying to make a split roof function which creates different roofs for each top face.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code looks kind of like this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;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();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The value of face can sometimes be null.&lt;/P&gt;&lt;P&gt;I don't know the cause of this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can somebody give me an explanation why this occurs.&lt;/P&gt;&lt;P&gt;Or maybe a different method I can use.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks anyway,&lt;/P&gt;&lt;P&gt;Jens Slofstra&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 10:17:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/geometry-from-hostobjectutils-gettopfaces-returns-null/m-p/10496036#M24585</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-26T10:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry from HostObjectUtils.GetTopFaces returns null</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/geometry-from-hostobjectutils-gettopfaces-returns-null/m-p/10496148#M24586</link>
      <description>&lt;P&gt;Is it still functioning the way you want it to? Or is it not creating the second part of the roof? If its functioning the way you want it too you can just check to make sure the face isn't equal to null then it wouldn't give you that error.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 10:57:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/geometry-from-hostobjectutils-gettopfaces-returns-null/m-p/10496148#M24586</guid>
      <dc:creator>zrodgersTSSSU</dc:creator>
      <dc:date>2021-07-26T10:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry from HostObjectUtils.GetTopFaces returns null</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/geometry-from-hostobjectutils-gettopfaces-returns-null/m-p/10496155#M24587</link>
      <description>&lt;P&gt;Thanks for the quick reply.&lt;/P&gt;&lt;P&gt;But it isn't generating the roof because it can't get the curveloops of the face with the value null.&lt;/P&gt;&lt;P&gt;An option is to check if the face is null and the skip it but I would rather not.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 11:00:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/geometry-from-hostobjectutils-gettopfaces-returns-null/m-p/10496155#M24587</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-26T11:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry from HostObjectUtils.GetTopFaces returns null</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/geometry-from-hostobjectutils-gettopfaces-returns-null/m-p/10497560#M24588</link>
      <description>&lt;P&gt;Is the Face a Planarface?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 20:25:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/geometry-from-hostobjectutils-gettopfaces-returns-null/m-p/10497560#M24588</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-07-26T20:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry from HostObjectUtils.GetTopFaces returns null</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/geometry-from-hostobjectutils-gettopfaces-returns-null/m-p/10498708#M24589</link>
      <description>&lt;P&gt;Hi RPTHOMAS108,&lt;/P&gt;&lt;P&gt;Yes every face of a roof is a planar face.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 08:13:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/geometry-from-hostobjectutils-gettopfaces-returns-null/m-p/10498708#M24589</guid>
      <dc:creator>jens.slofstra!</dc:creator>
      <dc:date>2021-07-27T08:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry from HostObjectUtils.GetTopFaces returns null</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/geometry-from-hostobjectutils-gettopfaces-returns-null/m-p/10499012#M24590</link>
      <description>&lt;P&gt;I take your response to mean that the roofs you are dealing with have only Planar faces.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If not already done so I would compare the references from&amp;nbsp;HostObjectUtils.GetTopFaces to what you get from picking such faces (Selection.PickObject) in terms of the string representation from&amp;nbsp;Reference.ConvertToStableRepresentation. This may give clues as to why geometry object is not returned from&amp;nbsp;Element.GetGeometryObjectFromReference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 11:05:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/geometry-from-hostobjectutils-gettopfaces-returns-null/m-p/10499012#M24590</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-07-27T11:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry from HostObjectUtils.GetTopFaces returns null</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/geometry-from-hostobjectutils-gettopfaces-returns-null/m-p/10499444#M24591</link>
      <description>&lt;P&gt;Hi RPTHOMAS18,&lt;/P&gt;&lt;P&gt;I've tried your suggestion and this is the result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HostObjectUtils.GetTopFaces(host) returns:&lt;/P&gt;&lt;P&gt;13cfd193-d686-402c-b3b8-105795423c1f-00327c00:13:SURFACE&lt;BR /&gt;13cfd193-d686-402c-b3b8-105795423c1f-00327c00:14:SURFACE&lt;BR /&gt;13cfd193-d686-402c-b3b8-105795423c1f-00327c00:15:SURFACE&lt;BR /&gt;**face** was null.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PickObject(ObjectType.Face) returns:&lt;/P&gt;&lt;P&gt;13cfd193-d686-402c-b3b8-105795423c1f-00327c00:13:SURFACE&lt;BR /&gt;13cfd193-d686-402c-b3b8-105795423c1f-00327c00:14:SURFACE&lt;BR /&gt;13cfd193-d686-402c-b3b8-105795423c1f-00327c00:16:SURFACE&lt;BR /&gt;13cfd193-d686-402c-b3b8-105795423c1f-00327c00:50:SURFACE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So two of the four are not the same when the face is picked.&lt;/P&gt;&lt;P&gt;But now I am stuck because how can I find the face which returned null and make it not return null?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 13:56:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/geometry-from-hostobjectutils-gettopfaces-returns-null/m-p/10499444#M24591</guid>
      <dc:creator>jens.slofstra!</dc:creator>
      <dc:date>2021-07-27T13:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry from HostObjectUtils.GetTopFaces returns null</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/geometry-from-hostobjectutils-gettopfaces-returns-null/m-p/10500682#M24593</link>
      <description>&lt;P&gt;That is strange I understand as follows:&lt;/P&gt;&lt;P&gt;13 &amp;amp; 14 are common to both methods&lt;/P&gt;&lt;P&gt;15 doesn't exist for the second method are you saying it returns a null face when used with GetGeometryObjectFromReference?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;16 &amp;amp; 50 only exist for the second method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have an example file you can share for this?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 21:42:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/geometry-from-hostobjectutils-gettopfaces-returns-null/m-p/10500682#M24593</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-07-27T21:42:33Z</dc:date>
    </item>
  </channel>
</rss>

