<?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: Bulk reloading families in a template from a slightly different location in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11633402#M15011</link>
    <description>&lt;P&gt;So I almost got this working using &lt;STRONG&gt;out &lt;/STRONG&gt;(it threw me off because all examples I saw used&lt;STRONG&gt; ref&lt;/STRONG&gt;...). This code fully compiles and reloads a good chunk of families.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, now I got another issue. Revit says Some Families may be no longer valid and command can not be executed... How can I skip those culprits?&amp;nbsp; I tried doing in the &lt;STRONG&gt;for&lt;/STRONG&gt; loop&amp;nbsp;&lt;EM&gt;if (el != null)&amp;nbsp;&lt;/EM&gt; but got the same error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EATREVITPOOPCAD_1-1671606743075.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1154814i275C249E429B5E1C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EATREVITPOOPCAD_1-1671606743075.png" alt="EATREVITPOOPCAD_1-1671606743075.png" /&gt;&lt;/span&gt;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;using Autodesk.Revit.Attributes;
using System;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace _Reload_Upgraded_Family
{
    class FamilyOption : IFamilyLoadOptions
    {
        public bool OnFamilyFound(
          bool familyInUse,
          out bool overwriteParameterValues)
        {
            overwriteParameterValues = true;
            return true;
        }

        public bool OnSharedFamilyFound(
          Family sharedFamily,
          bool familyInUse,
          out FamilySource source,
          out bool overwriteParameterValues)
        {
            source = FamilySource.Family;
            overwriteParameterValues = true;
            return true;
        }
    }

    [Transaction(TransactionMode.Manual)]
    [Regeneration(RegenerationOption.Manual)]

    public class Command : IExternalCommand
    {
    public Result Execute(
        ExternalCommandData commandData,
        ref string message,
        ElementSet elements
    )
    {
        UIApplication app = commandData.Application;
        Document doc = app.ActiveUIDocument.Document;
        UIDocument uidoc = new UIDocument(doc);

        FilteredElementCollector collector = new FilteredElementCollector(doc);
        ICollection&amp;lt;Element&amp;gt; famElements = collector.OfClass(typeof(Family)).ToElements();

        StringBuilder report = new StringBuilder();

        Transaction trans = new Transaction(doc, "Loading Upgraded Families");

        foreach (Element el in famElements)
        {
            Family f = el as Family;
    
            report.AppendLine(f.Name.ToString());

            if(f.IsEditable)
            {

                    Document familyDoc = doc.EditFamily(f);
                    string fPathCurrent = familyDoc.PathName;
                    string fPathNew = "";
                    string curVersion = "2023";

                    if (fPathCurrent.Contains("\\Revit\\2017\\Families_"))
                    {
                        fPathNew = fPathCurrent.Replace("2017", curVersion);
                        report.AppendLine(fPathNew);
                    }

                    else if (fPathCurrent.Contains("\\Revit\\2018\\Families_"))
                    {
                        fPathNew = fPathCurrent.Replace("2018", curVersion);
                        report.AppendLine(fPathNew);
                    }

                    else if (fPathCurrent.Contains("\\Revit\\2019\\Families_"))
                    {
                        fPathNew = fPathCurrent.Replace("2019", curVersion);
                        report.AppendLine(fPathNew);
                    }

                    else if (fPathCurrent.Contains("\\Revit\\2020\\Families_"))
                    {
                        fPathNew = fPathCurrent.Replace("2020", curVersion);
                        report.AppendLine(fPathNew);
                    }

                    else if (fPathCurrent.Contains("\\Revit\\2021\\Families_"))
                    {
                        fPathNew = fPathCurrent.Replace("2021", curVersion);
                        report.AppendLine(fPathNew);
                    }

                    else
                        report.AppendLine(fPathCurrent);

                    if(fPathNew != "")
                    {
                        //TaskDialog.Show("Debug", "Upgrading Family");
                        if (File.Exists(fPathNew))
                        {
                            trans.Start();
                            Family f2; 
                            doc.LoadFamily(fPathNew, new FamilyOption(), out f2);
                            trans.Commit();
                        }
                    }
             }
        }

        string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
        File.WriteAllText(desktop + @"\FamilyExport.txt", report.ToString() + "\n\nTotal: " + famElements.Count().ToString());

        //TaskDialog.Show("Family Names", sb.ToString() + "\n\nTotal: " + famElements.Count().ToString());

        TaskDialog.Show("Family Names", "\n\nTotal: " + famElements.Count().ToString());

        return Result.Succeeded;
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Dec 2022 07:32:16 GMT</pubDate>
    <dc:creator>EATREVITPOOPCAD</dc:creator>
    <dc:date>2022-12-21T07:32:16Z</dc:date>
    <item>
      <title>Bulk reloading families in a template from a slightly different location</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11623721#M15001</link>
      <description>&lt;P&gt;I have to go through a template and reload all families from a slightly different location. At the moment all of the families loaded in the template go something like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;server\Revit_Library\2022\family1.rfa&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;server\Revit_Library\2022\family2.rfa&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;server\Revit_Library\2022\family3.rfa&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and I need to change them to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;server\Revit_Library\2023\family1.rfa&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;server\Revit_Library\2023\family2.rfa&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;server\Revit_Library\2023\family3.rfa&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a better way to do this instead of UI? It would be too difficult in a short amount of time (I think) for me to code something that would do this, but I wonder If there is a way I could see that data outside of Revit. (Like if open a Revit file with 7 zip you can change some stuff that way...)&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2022 21:59:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11623721#M15001</guid>
      <dc:creator>EATREVITPOOPCAD</dc:creator>
      <dc:date>2022-12-15T21:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk reloading families in a template from a slightly different location</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11624397#M15002</link>
      <description>&lt;P&gt;Dear EatRevitPoopCad,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I searched the Internet for 'revit api reload family path' and see some promising results there:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://duckduckgo.com/?q=revit+api+reload+family+path" target="_blank"&gt;https://duckduckgo.com/?q=revit+api+reload+family+path&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Examining them more closely, it seems that only Sean's answer here in the forum is relevant and helpful:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/family-reload-from/td-p/9521770" target="_blank"&gt;https://forums.autodesk.com/t5/revit-api-forum/family-reload-from/td-p/9521770&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;nbsp;Try using the overloaded. Ersionnof the LoadFamily() method that allows you to specify options like overwrite Parameters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think he means overloaded version of &lt;U&gt;LoadFamily&lt;/U&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.revitapidocs.com/2023/cb950c8e-f440-c6db-8563-d1dd16ef3fee.htm" target="_blank"&gt;https://www.revitapidocs.com/2023/cb950c8e-f440-c6db-8563-d1dd16ef3fee.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add an IFamilyLoadOptions instance to your call. Note the remarks:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="remarksSection" class="section"&gt;
&lt;P&gt;&amp;gt; If the family is not loaded, or if the family is loaded but unchanged, the situation will never trigger and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://www.revitapidocs.com/2023/515baa3b-3a13-bb28-6c94-a84651b4dbfb.htm" target="_blank"&gt;OnFamilyFound(Boolean, Boolean )&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://www.revitapidocs.com/2023/7bb3a582-a7c0-1f3d-ebe3-33a1bfa443fc.htm" target="_blank"&gt;OnSharedFamilyFound(Family, Boolean, FamilySource , Boolean )&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;will not be called. Only if the family is loaded and changed should the interface methods be called.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think if you have more than a couple of dozen families to update, you will be faster doing it with the API than by hand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe you can whip up a quick macro instead of a full-fledged add-in.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 16 Dec 2022 07:51:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11624397#M15002</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2022-12-16T07:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk reloading families in a template from a slightly different location</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11626231#M15003</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/824630"&gt;@jeremy_tammik&lt;/a&gt;&amp;nbsp;you're doing God's work helping people such as my self&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&amp;nbsp;Looked up Revit macros, never knew they were c# code... Will do a leap of faith and tackle this via API&lt;/P&gt;</description>
      <pubDate>Sat, 17 Dec 2022 01:41:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11626231#M15003</guid>
      <dc:creator>EATREVITPOOPCAD</dc:creator>
      <dc:date>2022-12-17T01:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk reloading families in a template from a slightly different location</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11626363#M15004</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/824630"&gt;@jeremy_tammik&lt;/a&gt;&amp;nbsp;This is why I was going to do this manually...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something strange but the macro IDE says I did not implement&amp;nbsp;&lt;STRONG&gt;IFamilyLoadOptions &lt;/STRONG&gt;correctly, but this is what I saw in an example and API docs seem to say the same thing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;'MW_Module.FamilyOption' does not implement interface member 'Autodesk.Revit.DB.IFamilyLoadOptions.OnSharedFamilyFound(Autodesk.Revit.DB.Family, bool, out Autodesk.Revit.DB.FamilySource, out bool)' (CS0535) it\Macros\2023\Revit\AppHookup\MW_Module\Source\MW_Module\ThisApplication.cs:25,8&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;'MW_Module.FamilyOption' does not implement interface member 'Autodesk.Revit.DB.IFamilyLoadOptions.OnFamilyFound(bool, out bool)' (CS0535) -&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;using System;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Reflection;
using System.ComponentModel;
using System.Collections;
using System.Windows;

using System.IO;

namespace MW_Module
{
    [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
    [Autodesk.Revit.DB.Macros.AddInId("B3515362-619A-49B7-AC79-3428485161C5")]

	
    public partial class ThisApplication
	{
    	
		private void Module_Startup(object sender, EventArgs e)
		{

		}

		private void Module_Shutdown(object sender, EventArgs e)
		{

		}

		#region Revit Macros generated code
		private void InternalStartup()
		{
			this.Startup += new System.EventHandler(Module_Startup);
			this.Shutdown += new System.EventHandler(Module_Shutdown);
		}
		#endregion
		
		public void Hello_World()
		{
			TaskDialog.Show("Hello","World");
		}
		
		public void Repath_All_Fam()
		{
			
			Document doc = this.ActiveUIDocument.Document;   
    		UIApplication uiapp = new UIApplication(doc.Application);
	
	        FilteredElementCollector collector = new FilteredElementCollector(doc);
	        ICollection&amp;lt;Element&amp;gt; elements = collector.OfClass(typeof(Family)).ToElements();
	
	        StringBuilder sb = new StringBuilder();
	
	        foreach (Element el in elements)
	        {
	        	Family f = el as Family;
	        	Document famDoc = doc.EditFamily(f);
	        	sb.AppendLine(f.Name.ToString() + "\n" + famDoc.PathName);
	        	famDoc.Close();
	        }
	
	        TaskDialog.Show("part 1", sb.ToString());
	        
	       
	 
		}
	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another issue I am having is getting Family File Path... kind of been just shooting darts at the board. Can't find any family information about the file path with the Lookup Revit plugin.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Dec 2022 04:52:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11626363#M15004</guid>
      <dc:creator>EATREVITPOOPCAD</dc:creator>
      <dc:date>2022-12-17T04:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk reloading families in a template from a slightly different location</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11626620#M15005</link>
      <description>&lt;P&gt;Thank you for your kind appreciation. I do my best and pray we all do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IFamilyLoadOptions defines an interface, indicated by the capital I prefix:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://duckduckgo.com/?q=.net+interface" target="_blank"&gt;https://duckduckgo.com/?q=.net+interface&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to implement a class that derives from it and implements the required members.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.google.com/search?q=IFamilyLoadOptions&amp;amp;as_sitesearch=thebuildingcoder.typepad.com" target="_blank"&gt;https://www.google.com/search?q=IFamilyLoadOptions&amp;amp;as_sitesearch=thebuildingcoder.typepad.com&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Dec 2022 10:33:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11626620#M15005</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2022-12-17T10:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk reloading families in a template from a slightly different location</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11627272#M15006</link>
      <description>&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2011/06/reloading-a-family.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2011/06/reloading-a-family.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the article I post I was reading. Apologize for looking like a lost cause.&amp;nbsp;It was late at night and I pasted the wrong code in my previous post... But my question still remains the same.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems I implemented a family option class way I am supposed to but the error says I did not - and gives me the same required implementation variables&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;'MW_Module.FamilyOption' does not implement interface member 'Autodesk.Revit.DB.IFamilyLoadOptions.OnSharedFamilyFound(Autodesk.Revit.DB.Family, bool, out Autodesk.Revit.DB.FamilySource, out bool)' (CS0535) it\Macros\2023\Revit\AppHookup\MW_Module\Source\MW_Module\ThisApplication.cs:25,8&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;'MW_Module.FamilyOption' does not implement interface member 'Autodesk.Revit.DB.IFamilyLoadOptions.OnFamilyFound(bool, out bool)' (CS0535) -&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;using System;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Reflection;
using System.ComponentModel;
using System.Collections;
using System.Windows;

using System.IO;

namespace MW_Module
{
    [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
    [Autodesk.Revit.DB.Macros.AddInId("B3515362-619A-49B7-AC79-3428485161C5")]

	
    class FamilyOption : IFamilyLoadOptions
	{
	  public bool OnFamilyFound(
	    bool familyInUse,
	    ref bool overwriteParameterValues )
	  {
	    overwriteParameterValues = true;
	    return true;
	  }
	 
	  public bool OnSharedFamilyFound(
	    Family sharedFamily,
	    bool familyInUse,
	    ref FamilySource source,
	    ref bool overwriteParameterValues )
	  {
	    return true;
	  }
	}
    
    public partial class ThisApplication
	{
    	
		private void Module_Startup(object sender, EventArgs e)
		{

		}

		private void Module_Shutdown(object sender, EventArgs e)
		{

		}

		#region Revit Macros generated code
		private void InternalStartup()
		{
			this.Startup += new System.EventHandler(Module_Startup);
			this.Shutdown += new System.EventHandler(Module_Shutdown);
		}
		#endregion
		
		public void Hello_World()
		{
			TaskDialog.Show("Hello","World");
		}
		
		public void Repath_All_Fam()
		{
			
			Document doc = this.ActiveUIDocument.Document;   
    		UIApplication uiapp = new UIApplication(doc.Application);
	
	        FilteredElementCollector collector = new FilteredElementCollector(doc);
	        ICollection&amp;lt;Element&amp;gt; elements = collector.OfClass(typeof(Family)).ToElements();
	
	        StringBuilder sb = new StringBuilder();
	
	        foreach (Element el in elements)
	        {
	        	Family f = el as Family;
	        	sb.AppendLine(f.Name.ToString());
	        	
	        	//Document famDoc = doc.EditFamily(f);
	        	//sb.AppendLine(f.Name.ToString() + "\n" + famDoc.PathName);
	        	//famDoc.Close();
	        }
	
	        TaskDialog.Show("Family Names", sb.ToString());
	        
	       
	 
		}
	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Dec 2022 21:25:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11627272#M15006</guid>
      <dc:creator>EATREVITPOOPCAD</dc:creator>
      <dc:date>2022-12-17T21:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk reloading families in a template from a slightly different location</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11632399#M15007</link>
      <description>&lt;P&gt;It looks like you're using&amp;nbsp;&lt;EM&gt;ref&lt;/EM&gt; instead of&amp;nbsp;&lt;EM&gt;out&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 18:03:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11632399#M15007</guid>
      <dc:creator>mhannonQ65N2</dc:creator>
      <dc:date>2022-12-20T18:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk reloading families in a template from a slightly different location</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11632835#M15008</link>
      <description>&lt;P&gt;That was my thought too. However when I change &lt;STRONG&gt;out&lt;/STRONG&gt; to &lt;STRONG&gt;ref&amp;nbsp;&lt;/STRONG&gt;I get another error for the same lines of code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;The out parameter 'overwriteParameterValues' must be assigned to before control leaves the current method (CS0177) - C:\ProgramData\Autodesk\Revit\Macros\2023\Revit\AppHookup\MW_Module\Source\MW_Module\ThisApplication.cs:37,6

The out parameter 'overwriteParameterValues' must be assigned to before control leaves the current method (CS0177) - C:\ProgramData\Autodesk\Revit\Macros\2023\Revit\AppHookup\MW_Module\Source\MW_Module\ThisApplication.cs:37,6&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;My understanding is that when you create an interface you use &lt;STRONG&gt;out&lt;/STRONG&gt;&amp;nbsp;for variables that would be declared later but when you implement them you use &lt;STRONG&gt;ref&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am going to try this in Visual Studio instead of Revit's macro IDE, maybe I will see something I don't here. If not, I will save this battle for next year when upgrading the library and do this old fashion way for now...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: &amp;gt;.&amp;lt; man now is not the time for&amp;nbsp;&lt;A href="https://thebuildingcoder.typepad.com/blog/2011/06/reloading-a-family.html" target="_blank" rel="nofollow noopener noreferrer"&gt;thebuildingcoder website&lt;/A&gt;&amp;nbsp;to be down&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 22:08:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11632835#M15008</guid>
      <dc:creator>EATREVITPOOPCAD</dc:creator>
      <dc:date>2022-12-20T22:08:27Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk reloading families in a template from a slightly different location</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11633068#M15009</link>
      <description>&lt;P&gt;&lt;A title="out parameter modifier (C# Reference)" href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/out-parameter-modifier" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;out&lt;/STRONG&gt;&lt;/A&gt; and &lt;A title="ref (C# Reference)--Passing an argument by reference" href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/ref#passing-an-argument-by-reference" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;ref&lt;/STRONG&gt;&lt;/A&gt; are not related to interfaces and implementations. An &lt;STRONG&gt;out&lt;/STRONG&gt; parameter is effectively a second return value. Therefore, you need to assign it a value before you return.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 01:22:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11633068#M15009</guid>
      <dc:creator>mhannonQ65N2</dc:creator>
      <dc:date>2022-12-21T01:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk reloading families in a template from a slightly different location</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11633150#M15010</link>
      <description>&lt;P&gt;I see, gotta do some reading lol thank you&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 02:31:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11633150#M15010</guid>
      <dc:creator>EATREVITPOOPCAD</dc:creator>
      <dc:date>2022-12-21T02:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk reloading families in a template from a slightly different location</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11633402#M15011</link>
      <description>&lt;P&gt;So I almost got this working using &lt;STRONG&gt;out &lt;/STRONG&gt;(it threw me off because all examples I saw used&lt;STRONG&gt; ref&lt;/STRONG&gt;...). This code fully compiles and reloads a good chunk of families.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, now I got another issue. Revit says Some Families may be no longer valid and command can not be executed... How can I skip those culprits?&amp;nbsp; I tried doing in the &lt;STRONG&gt;for&lt;/STRONG&gt; loop&amp;nbsp;&lt;EM&gt;if (el != null)&amp;nbsp;&lt;/EM&gt; but got the same error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EATREVITPOOPCAD_1-1671606743075.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1154814i275C249E429B5E1C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EATREVITPOOPCAD_1-1671606743075.png" alt="EATREVITPOOPCAD_1-1671606743075.png" /&gt;&lt;/span&gt;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;using Autodesk.Revit.Attributes;
using System;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace _Reload_Upgraded_Family
{
    class FamilyOption : IFamilyLoadOptions
    {
        public bool OnFamilyFound(
          bool familyInUse,
          out bool overwriteParameterValues)
        {
            overwriteParameterValues = true;
            return true;
        }

        public bool OnSharedFamilyFound(
          Family sharedFamily,
          bool familyInUse,
          out FamilySource source,
          out bool overwriteParameterValues)
        {
            source = FamilySource.Family;
            overwriteParameterValues = true;
            return true;
        }
    }

    [Transaction(TransactionMode.Manual)]
    [Regeneration(RegenerationOption.Manual)]

    public class Command : IExternalCommand
    {
    public Result Execute(
        ExternalCommandData commandData,
        ref string message,
        ElementSet elements
    )
    {
        UIApplication app = commandData.Application;
        Document doc = app.ActiveUIDocument.Document;
        UIDocument uidoc = new UIDocument(doc);

        FilteredElementCollector collector = new FilteredElementCollector(doc);
        ICollection&amp;lt;Element&amp;gt; famElements = collector.OfClass(typeof(Family)).ToElements();

        StringBuilder report = new StringBuilder();

        Transaction trans = new Transaction(doc, "Loading Upgraded Families");

        foreach (Element el in famElements)
        {
            Family f = el as Family;
    
            report.AppendLine(f.Name.ToString());

            if(f.IsEditable)
            {

                    Document familyDoc = doc.EditFamily(f);
                    string fPathCurrent = familyDoc.PathName;
                    string fPathNew = "";
                    string curVersion = "2023";

                    if (fPathCurrent.Contains("\\Revit\\2017\\Families_"))
                    {
                        fPathNew = fPathCurrent.Replace("2017", curVersion);
                        report.AppendLine(fPathNew);
                    }

                    else if (fPathCurrent.Contains("\\Revit\\2018\\Families_"))
                    {
                        fPathNew = fPathCurrent.Replace("2018", curVersion);
                        report.AppendLine(fPathNew);
                    }

                    else if (fPathCurrent.Contains("\\Revit\\2019\\Families_"))
                    {
                        fPathNew = fPathCurrent.Replace("2019", curVersion);
                        report.AppendLine(fPathNew);
                    }

                    else if (fPathCurrent.Contains("\\Revit\\2020\\Families_"))
                    {
                        fPathNew = fPathCurrent.Replace("2020", curVersion);
                        report.AppendLine(fPathNew);
                    }

                    else if (fPathCurrent.Contains("\\Revit\\2021\\Families_"))
                    {
                        fPathNew = fPathCurrent.Replace("2021", curVersion);
                        report.AppendLine(fPathNew);
                    }

                    else
                        report.AppendLine(fPathCurrent);

                    if(fPathNew != "")
                    {
                        //TaskDialog.Show("Debug", "Upgrading Family");
                        if (File.Exists(fPathNew))
                        {
                            trans.Start();
                            Family f2; 
                            doc.LoadFamily(fPathNew, new FamilyOption(), out f2);
                            trans.Commit();
                        }
                    }
             }
        }

        string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
        File.WriteAllText(desktop + @"\FamilyExport.txt", report.ToString() + "\n\nTotal: " + famElements.Count().ToString());

        //TaskDialog.Show("Family Names", sb.ToString() + "\n\nTotal: " + famElements.Count().ToString());

        TaskDialog.Show("Family Names", "\n\nTotal: " + famElements.Count().ToString());

        return Result.Succeeded;
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 07:32:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11633402#M15011</guid>
      <dc:creator>EATREVITPOOPCAD</dc:creator>
      <dc:date>2022-12-21T07:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk reloading families in a template from a slightly different location</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11633498#M15012</link>
      <description>&lt;P&gt;You say that&amp;nbsp;&lt;SPAN&gt;Revit says, Some Families may be no longer valid and command can not be executed.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;'Revit &lt;U&gt;says&lt;/U&gt;' is not really clearly defined... Do you mean that an &lt;U&gt;exception is thrown&lt;/U&gt;?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If so, you can add an &lt;U&gt;exception handler&lt;/U&gt; to encapsulate that and handle it. In this case, if you just wish to skip the offending family and continue with the others, you can ignore the exception:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://duckduckgo.com/?q=.net+exception+handling&amp;amp;atb=v343-1&amp;amp;ia=web" target="_blank"&gt;https://duckduckgo.com/?q=.net+exception+handling&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 08:33:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11633498#M15012</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2022-12-21T08:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk reloading families in a template from a slightly different location</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11634591#M15013</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/824630"&gt;@jeremy_tammik&lt;/a&gt;&amp;nbsp;that is exactly what I meant! Appreciate your patience, very satisfying to watch 200+ families reload in 5 minutes&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the for loop I added&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;try { // Loop contents } catch{} &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 16:58:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11634591#M15013</guid>
      <dc:creator>EATREVITPOOPCAD</dc:creator>
      <dc:date>2022-12-21T16:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk reloading families in a template from a slightly different location</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11634638#M15014</link>
      <description>&lt;P&gt;Strange exception since I would expect it relates to hosting or dimensioning&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now you just need to reload the nested families perhaps, also close the documents or they remain open after editing. You may notice the impact of that when you eventually close Revit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a good reason for templates with minimal loaded families but not always easy to achieve in practice I suppose.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 17:27:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11634638#M15014</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2022-12-21T17:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk reloading families in a template from a slightly different location</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11634756#M15015</link>
      <description>&lt;P&gt;Hmm I didn’t close document &lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt; will do that. I guess because running on a decent machine it hasn’t affected performance yet.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I think it has something to do with nested families also. Basically what I will do is run this command in all of the families in our library first, and then in the template. It should take care of most of the nested families, however for the few that aren’t (when hosting family was upgraded first, then nested) those I can just look in the report generated and update manually.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;the 200 families in the template isn’t even crazy this type of template considering only few doors, windows and etc are actually loaded. Most of it are essential building blocks to streamline our typical construction type. Who ever made it before me put a lot of thought into it. At least it seems like that.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 18:33:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11634756#M15015</guid>
      <dc:creator>EATREVITPOOPCAD</dc:creator>
      <dc:date>2022-12-21T18:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk reloading families in a template from a slightly different location</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11634769#M15016</link>
      <description>&lt;P&gt;Yeah it is kind of crazy they didn't think about having an option for relative paths for this kind of thing. In reality the path is stored in the family but not overly important in terms of the existence of that family i.e. it is only really important that when the family is edited from the project it doesn't end up being saved back in the older library. For that you would have thought relative paths from the template location would have been more practical.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 18:37:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11634769#M15016</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2022-12-21T18:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk reloading families in a template from a slightly different location</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11634887#M15017</link>
      <description>&lt;P&gt;A relative path would really help LOL. And yes, that's the only reason we update all of the paths, basically to avoid this possible user error&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 19:56:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11634887#M15017</guid>
      <dc:creator>EATREVITPOOPCAD</dc:creator>
      <dc:date>2022-12-21T19:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk reloading families in a template from a slightly different location</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11634948#M15018</link>
      <description>&lt;P&gt;Something interesting I noticed when I closed each opened family document, the plugin got noticeably slower than leaving all of the families open in purgatory. I guess it takes time to close it. I will obviously still have it close just because it's the right thing to... Later on I will add a timer and see how much slower it actually is, maybe I am just going crazy&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 20:25:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/bulk-reloading-families-in-a-template-from-a-slightly-different/m-p/11634948#M15018</guid>
      <dc:creator>EATREVITPOOPCAD</dc:creator>
      <dc:date>2022-12-21T20:25:35Z</dc:date>
    </item>
  </channel>
</rss>

