<?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 Why don't work ReferenceIntersector in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/why-don-t-work-referenceintersector/m-p/7782722#M52413</link>
    <description>&lt;P&gt;I try get point on toposurface with my function:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Function GetPointOnTopoSurface(doc As Document, p As XYZ, Dir As Integer) As XYZ

        ' Find a 3D view to use for the ReferenceIntersector constructor
        Dim collector As New FilteredElementCollector(doc)
        Dim isNotTemplate As Func(Of View3D, Boolean) = Function(v3) Not (v3.IsTemplate)
        'Dim view3D As View3D = collector.OfClass(GetType(View3D)).Cast(Of View3D)().First(isNotTemplate)
        Dim view3D As View3D = collector.OfClass(GetType(View3D)).Cast(Of View3D)().Where(Function(x) x.Name = doc.ActiveView.Name).First(isNotTemplate)

        '---------------------------&lt;BR /&gt;        'Draw line 
        Dim q As New XYZ(p.X, p.Y, p.Z + Dir * 150)
        Dim l As Line = Line.CreateBound(p, q)
        drawCurveDoc(doc, l)
        '---------------------------

        Dim pTop As XYZ = p

        ' Project in the negative Z direction down to the floor.
        Dim rayDirection As New XYZ(0, 0, Dir)

        Dim filter As New ElementClassFilter(GetType(TopographySurface))



        Dim refIntersector As New ReferenceIntersector(filter, FindReferenceTarget.All, view3D)

        If IsNothing(refIntersector.FindNearest(pTop, rayDirection)) Then
            Return p
        End If

        Dim referenceWithContext As ReferenceWithContext = refIntersector.FindNearest(pTop, rayDirection)
        Dim reference As Reference = referenceWithContext.GetReference()
        Dim intersection As XYZ = reference.GlobalPoint


        Return intersection



    End Function&lt;/PRE&gt;&lt;P&gt;I use Dir = 1 and Dir = -1. Function find some points. But some points don't find.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Feb 2018 07:54:31 GMT</pubDate>
    <dc:creator>AndrewButenko</dc:creator>
    <dc:date>2018-02-16T07:54:31Z</dc:date>
    <item>
      <title>Why don't work ReferenceIntersector</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/why-don-t-work-referenceintersector/m-p/7782722#M52413</link>
      <description>&lt;P&gt;I try get point on toposurface with my function:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Function GetPointOnTopoSurface(doc As Document, p As XYZ, Dir As Integer) As XYZ

        ' Find a 3D view to use for the ReferenceIntersector constructor
        Dim collector As New FilteredElementCollector(doc)
        Dim isNotTemplate As Func(Of View3D, Boolean) = Function(v3) Not (v3.IsTemplate)
        'Dim view3D As View3D = collector.OfClass(GetType(View3D)).Cast(Of View3D)().First(isNotTemplate)
        Dim view3D As View3D = collector.OfClass(GetType(View3D)).Cast(Of View3D)().Where(Function(x) x.Name = doc.ActiveView.Name).First(isNotTemplate)

        '---------------------------&lt;BR /&gt;        'Draw line 
        Dim q As New XYZ(p.X, p.Y, p.Z + Dir * 150)
        Dim l As Line = Line.CreateBound(p, q)
        drawCurveDoc(doc, l)
        '---------------------------

        Dim pTop As XYZ = p

        ' Project in the negative Z direction down to the floor.
        Dim rayDirection As New XYZ(0, 0, Dir)

        Dim filter As New ElementClassFilter(GetType(TopographySurface))



        Dim refIntersector As New ReferenceIntersector(filter, FindReferenceTarget.All, view3D)

        If IsNothing(refIntersector.FindNearest(pTop, rayDirection)) Then
            Return p
        End If

        Dim referenceWithContext As ReferenceWithContext = refIntersector.FindNearest(pTop, rayDirection)
        Dim reference As Reference = referenceWithContext.GetReference()
        Dim intersection As XYZ = reference.GlobalPoint


        Return intersection



    End Function&lt;/PRE&gt;&lt;P&gt;I use Dir = 1 and Dir = -1. Function find some points. But some points don't find.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2018 07:54:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/why-don-t-work-referenceintersector/m-p/7782722#M52413</guid>
      <dc:creator>AndrewButenko</dc:creator>
      <dc:date>2018-02-16T07:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: Why don't work ReferenceIntersector</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/why-don-t-work-referenceintersector/m-p/7783104#M52414</link>
      <description>&lt;P&gt;Dear Andrew,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code looks perfectly all right to me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe you should create a complete minimal reproducible case to prove the problem exists:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I could pass that on to the development team for analysis.&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;</description>
      <pubDate>Fri, 16 Feb 2018 11:06:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/why-don-t-work-referenceintersector/m-p/7783104#M52414</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-02-16T11:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: Why don't work ReferenceIntersector</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/why-don-t-work-referenceintersector/m-p/8152669#M52415</link>
      <description>&lt;P&gt;I have the exact same problem. Maybe the reference intersector does not work on topos?&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Tue, 24 Jul 2018 20:09:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/why-don-t-work-referenceintersector/m-p/8152669#M52415</guid>
      <dc:creator>Admin.CTI</dc:creator>
      <dc:date>2018-07-24T20:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: Why don't work ReferenceIntersector</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/why-don-t-work-referenceintersector/m-p/8153317#M52416</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I figured it out. If the ray hits the topoline between mesh(triangls), then the function assumes that the topo does not exist.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 05:19:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/why-don-t-work-referenceintersector/m-p/8153317#M52416</guid>
      <dc:creator>AndrewButenko</dc:creator>
      <dc:date>2018-07-25T05:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why don't work ReferenceIntersector</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/why-don-t-work-referenceintersector/m-p/9353641#M52417</link>
      <description>&lt;P&gt;Thank you. I actually solved in another way that i cannot remember. But thanks for the support.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 20:16:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/why-don-t-work-referenceintersector/m-p/9353641#M52417</guid>
      <dc:creator>Admin.CTI</dc:creator>
      <dc:date>2020-03-02T20:16:45Z</dc:date>
    </item>
  </channel>
</rss>

