<?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 Distance calculation by projection method in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/distance-calculation-by-projection-method/m-p/8143828#M48606</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted to find out the distance between the point on a horizontal line and the ceiling( having slope) so i used following code-&lt;/P&gt;&lt;P&gt;IList&amp;lt;Reference&amp;gt;&amp;nbsp;ceilreferences = HostObjectUtils.&lt;SPAN style="color: #191970; font-weight: bold;"&gt;GetBottomFaces&lt;/SPAN&gt;(ceil);&lt;BR /&gt;Face lface=&lt;SPAN style="font-weight: bold;"&gt;null&lt;/SPAN&gt;;&lt;BR /&gt;&amp;nbsp; &lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;foreach&lt;/SPAN&gt;&amp;nbsp;(Reference myRef&amp;nbsp;&lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;in&lt;/SPAN&gt;&amp;nbsp;ceilreferences)&lt;BR /&gt;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; lface = ceil.&lt;SPAN style="color: #191970; font-weight: bold;"&gt;GetGeometryObjectFromReference&lt;/SPAN&gt;(myRef)&amp;nbsp;&lt;SPAN style="color: #008b8b; font-weight: bold;"&gt;as&lt;/SPAN&gt;&amp;nbsp;Face;&lt;BR /&gt;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IntersectionResult faceIntersectResult = lface.&lt;SPAN style="color: #191970; font-weight: bold;"&gt;Project&lt;/SPAN&gt;(point);&lt;/P&gt;&lt;P&gt;double distanceFromPointToCeil = faceIntersectResult .Distance;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this code is not giving me exact distance between point and ceiling (having slope). At starting of slope this difference between distance is very less and as you proceed along X direction difference increases.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find attached image.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if there is any other method to find this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Jul 2018 12:30:27 GMT</pubDate>
    <dc:creator>milindnalgirkar</dc:creator>
    <dc:date>2018-07-20T12:30:27Z</dc:date>
    <item>
      <title>Distance calculation by projection method</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-calculation-by-projection-method/m-p/8143828#M48606</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted to find out the distance between the point on a horizontal line and the ceiling( having slope) so i used following code-&lt;/P&gt;&lt;P&gt;IList&amp;lt;Reference&amp;gt;&amp;nbsp;ceilreferences = HostObjectUtils.&lt;SPAN style="color: #191970; font-weight: bold;"&gt;GetBottomFaces&lt;/SPAN&gt;(ceil);&lt;BR /&gt;Face lface=&lt;SPAN style="font-weight: bold;"&gt;null&lt;/SPAN&gt;;&lt;BR /&gt;&amp;nbsp; &lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;foreach&lt;/SPAN&gt;&amp;nbsp;(Reference myRef&amp;nbsp;&lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;in&lt;/SPAN&gt;&amp;nbsp;ceilreferences)&lt;BR /&gt;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; lface = ceil.&lt;SPAN style="color: #191970; font-weight: bold;"&gt;GetGeometryObjectFromReference&lt;/SPAN&gt;(myRef)&amp;nbsp;&lt;SPAN style="color: #008b8b; font-weight: bold;"&gt;as&lt;/SPAN&gt;&amp;nbsp;Face;&lt;BR /&gt;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IntersectionResult faceIntersectResult = lface.&lt;SPAN style="color: #191970; font-weight: bold;"&gt;Project&lt;/SPAN&gt;(point);&lt;/P&gt;&lt;P&gt;double distanceFromPointToCeil = faceIntersectResult .Distance;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this code is not giving me exact distance between point and ceiling (having slope). At starting of slope this difference between distance is very less and as you proceed along X direction difference increases.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find attached image.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if there is any other method to find this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 12:30:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-calculation-by-projection-method/m-p/8143828#M48606</guid>
      <dc:creator>milindnalgirkar</dc:creator>
      <dc:date>2018-07-20T12:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: Distance calculation by projection method</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-calculation-by-projection-method/m-p/8181469#M48607</link>
      <description>&lt;P&gt;So, basically, you are looking for the&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;Distance Between Two Points in a Specific Direction&lt;/H4&gt;
&lt;P&gt;I discussed that here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2017/01/distances-switches-kiss-ing-and-a-dino.html#2" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2017/01/distances-switches-kiss-ing-and-a-dino.html#2&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="point_dist_along_vector.png" style="width: 451px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/531825iB486A15C94771736/image-size/large?v=v2&amp;amp;px=999" role="button" title="point_dist_along_vector.png" alt="point_dist_along_vector.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are some more related discussions on projecting points:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2014/09/planes-projections-and-picking-points.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2014/09/planes-projections-and-picking-points.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 06:02:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-calculation-by-projection-method/m-p/8181469#M48607</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-08-07T06:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: Distance calculation by projection method</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-calculation-by-projection-method/m-p/8182162#M48608</link>
      <description>&lt;P&gt;Hello jeremy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have horizontal line and slopped ceiling on it. We wanted to find out the distance - Distance between- the point on horizontal line and projected point ( in vertical direction )on slopped ceiling bottom face.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can refer the attached screenshot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 12:03:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-calculation-by-projection-method/m-p/8182162#M48608</guid>
      <dc:creator>milindnalgirkar</dc:creator>
      <dc:date>2018-08-07T12:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Distance calculation by projection method</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-calculation-by-projection-method/m-p/8182828#M48609</link>
      <description>&lt;P&gt;Thank you for the improved explanation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Probably the easiest way to go, especially if you want to avoid using any trigonometry, is to use the ReferenceIntersector class to project a vertical ray upward from A into the ceiling:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.revitapidocs.com/2018/36f82b40-1065-2305-e260-18fc618e756f.htm" target="_blank"&gt;http://www.revitapidocs.com/2018/36f82b40-1065-2305-e260-18fc618e756f.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a sample that uses that and points to some further related reading:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2017/03/rvtfader-avf-ray-tracing-and-signal-attenuation.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2017/03/rvtfader-avf-ray-tracing-and-signal-attenuation.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally, I would prefer a trigonometrical approach.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is probably also pretty easy to implement and more efficient to execute.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you provide a minimal reproducible sample with a model containing just one ceiling and a model line or two defining the point A plus code to extract the relevant ceiling face, I&amp;nbsp;will see whether I can suggest anything for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 15:27:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-calculation-by-projection-method/m-p/8182828#M48609</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-08-07T15:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: Distance calculation by projection method</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-calculation-by-projection-method/m-p/8182842#M48610</link>
      <description>&lt;P&gt;Another approach would be to use the Face.Intersect(Curve) method:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.revitapidocs.com/2018/9a487e3d-bbb4-34b9-307d-2e4f63fddab6.htm" target="_blank"&gt;http://www.revitapidocs.com/2018/9a487e3d-bbb4-34b9-307d-2e4f63fddab6.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a vertical line from A upwards, and intersect that with the ceiling face.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 15:31:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-calculation-by-projection-method/m-p/8182842#M48610</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-08-07T15:31:33Z</dc:date>
    </item>
  </channel>
</rss>

