<?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: Pick FamilySymbol from Project Browser? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/pick-familysymbol-from-project-browser/m-p/11395288#M17078</link>
    <description>&lt;P&gt;Thanks for the answer!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you happen to have any pointers or examples of how to develop modeless forms with the Revit API by chance? Would be much appreciated, thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 01 Sep 2022 13:41:11 GMT</pubDate>
    <dc:creator>grubdex</dc:creator>
    <dc:date>2022-09-01T13:41:11Z</dc:date>
    <item>
      <title>Pick FamilySymbol from Project Browser?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pick-familysymbol-from-project-browser/m-p/11390552#M17073</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want my user to select a FamilySymbol that's already loaded from the UI (more specifically, the Project Browser) that I then further process in my own code. I'm aware that there are different methods for filtering the already existing custom families/loading families from file and so on, but is there a way to prompt the user to pick one from the project browser? Ideally, it would NOT require the user to make conscious decisions on where to click before starting the add-in.&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;</description>
      <pubDate>Tue, 30 Aug 2022 13:44:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pick-familysymbol-from-project-browser/m-p/11390552#M17073</guid>
      <dc:creator>grubdex</dc:creator>
      <dc:date>2022-08-30T13:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: Pick FamilySymbol from Project Browser?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pick-familysymbol-from-project-browser/m-p/11390979#M17074</link>
      <description>&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you can ask users to select element(s) instance from their view then manage to get the &lt;SPAN&gt;FamilySymbol&lt;/SPAN&gt;, but i don't think it's possible from the browser.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 16:50:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pick-familysymbol-from-project-browser/m-p/11390979#M17074</guid>
      <dc:creator>Yien_Chao</dc:creator>
      <dc:date>2022-08-30T16:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Pick FamilySymbol from Project Browser?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pick-familysymbol-from-project-browser/m-p/11391713#M17075</link>
      <description>&lt;P&gt;It's not the usual workflow but now in 2023 you have the selection changed event which also applies to project browser. The below prompts user to select from browser before adding a selection changed event.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The handler filters for the class of FamilySymbol* and shows a dialogue if the result yields more than 0 results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that not every thing in the project browser is a FamilySymbol so ElementType class will cover more aspects such as system families.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You would have to continue execution in the handler and perhaps raise an external event to get an editable document status (I suspect the selection changed event doesn't give you that).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can also use e.GetDocument below instead of casting sender 's' to UIApplication to get the Document.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Public Function Obj_220831a(commandData As ExternalCommandData, ByRef message As String, elements As ElementSet) As Result
        Dim IntUIApp As UIApplication = commandData.Application
        Dim IntUIDoc As UIDocument = commandData.Application.ActiveUIDocument
        Dim IntDoc As Document = IntUIDoc.Document

        TaskDialog.Show("Select", "Pick family symbol from project browser")
        AddHandler IntUIApp.SelectionChanged, AddressOf SelectionChanged


        Return Result.Succeeded
    End Function

    Public Sub SelectionChanged(s As Object, e As Autodesk.Revit.UI.Events.SelectionChangedEventArgs)
        Dim UIapp As UIApplication = s
        Dim J As ISet(Of ElementId) = e.GetSelectedElements
        Dim J0 As List(Of ElementId) = J.ToList

        Dim FEC As New FilteredElementCollector(UIapp.ActiveUIDocument.Document, J0)
        Dim F0 As New ElementClassFilter(GetType(FamilySymbol))
        Dim Els As List(Of Element) = FEC.WherePasses(F0).ToElements

        If Els.Count &amp;gt; 0 Then
            TaskDialog.Show("Selection", Els(0).Name)
            RemoveHandler UIapp.SelectionChanged, AddressOf SelectionChanged
        End If
    End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 23:34:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pick-familysymbol-from-project-browser/m-p/11391713#M17075</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2022-08-30T23:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Pick FamilySymbol from Project Browser?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pick-familysymbol-from-project-browser/m-p/11392335#M17076</link>
      <description>&lt;P&gt;Thanks for your reply. In your opinion, what would be a workflow that is more common?&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 08:17:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pick-familysymbol-from-project-browser/m-p/11392335#M17076</guid>
      <dc:creator>grubdex</dc:creator>
      <dc:date>2022-08-31T08:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: Pick FamilySymbol from Project Browser?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pick-familysymbol-from-project-browser/m-p/11392831#M17077</link>
      <description>&lt;P&gt;It really depends on what your add-in is being used for i.e is it modal or modeless interaction is it working with a few categories of elements or many?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is often the case you have to create dialogues that replicate the ones Revit inherently has which is a bit annoying but doesn't take that long with WPF for something such as FamilySymbol selection. That would allow a modal interaction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You aim to stay within the IExternalCommand context in a modal way to start with but if that isn't possible then you have to get back into a similar context via raising &lt;A href="https://www.revitapidocs.com/2023/05089477-4612-35b2-81a2-89c4f44370ea.htm" target="_blank" rel="noopener"&gt;ExternalEvents&lt;/A&gt; from modeless forms etc. There are also other methods of obtaining a valid context to work with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 12:51:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pick-familysymbol-from-project-browser/m-p/11392831#M17077</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2022-08-31T12:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: Pick FamilySymbol from Project Browser?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pick-familysymbol-from-project-browser/m-p/11395288#M17078</link>
      <description>&lt;P&gt;Thanks for the answer!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you happen to have any pointers or examples of how to develop modeless forms with the Revit API by chance? Would be much appreciated, thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 13:41:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pick-familysymbol-from-project-browser/m-p/11395288#M17078</guid>
      <dc:creator>grubdex</dc:creator>
      <dc:date>2022-09-01T13:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: Pick FamilySymbol from Project Browser?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pick-familysymbol-from-project-browser/m-p/11395718#M17079</link>
      <description>&lt;P&gt;There are samples in the SDK:&lt;/P&gt;&lt;P&gt;...\Samples\ModelessDialog\ModelessForm_ExternalEvent&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is for Windows Forms but same approach would be used for WPF.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 16:13:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pick-familysymbol-from-project-browser/m-p/11395718#M17079</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2022-09-01T16:13:12Z</dc:date>
    </item>
  </channel>
</rss>

