<?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: Getting the wrong NewFamilyInstance override in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11953788#M12303</link>
    <description>&lt;P&gt;Many thanks to Kennan for the very thorough explanation!&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;I added a link to it in the blog for wider distribution and greater visibility:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2023/05/dark-icons-newfamilyinstance-and-ai-news.html#3" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2023/05/dark-icons-newfamilyinstance-and-ai-news.html#3&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&amp;nbsp;&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;</description>
    <pubDate>Wed, 10 May 2023 08:43:28 GMT</pubDate>
    <dc:creator>jeremy_tammik</dc:creator>
    <dc:date>2023-05-10T08:43:28Z</dc:date>
    <item>
      <title>Getting the wrong NewFamilyInstance override</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11933993#M12294</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've done some searching here without luck on the specific issue I'm running into, so I thought I'd turn here for help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to instance a structural column via API. I used a variation of the NewFamilyInstance() method in Autodesk.Revit.Creation.Document (NewFamilyInstance Method (XYZ, FamilySymbol, Level, StructuralType)). Everything worked great when I built the add-in locally, and all the columns came in correctly. I targeted Revit 2024. However, when packaging the add-in and getting it to one of our users in Revit 2023, they received a "Method not found" error. It was somewhat truncated by the error task dialog, but it claimed it could not find a method with the same signature as above (XYZ, FamilySymbol, Level, StructuralType).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was confused at first, but then noticed that the namespace of the function it could not find was in Autodesk.Revit.Creation.ItemFactoryBase,&amp;nbsp;&lt;EM&gt;not&amp;nbsp;&lt;/EM&gt;in Autodesk.Revit.Creation.Document. My read of the API docs is that this is correct -- but Document apparently inherits from ItemFactoryBase and then adds its own overrides. But for some reason, my user's instance of the add-in is just not able to find it.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;// "doc" here is of type Autodesk.Revit.DB.Document
FamilyInstance column = doc.Create.NewFamilyInstance(location, familySymbol, baseLevel, StructuralType.Column);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To make matters more confusing, my IDE (Visual Studio Professional 2022, with ReSharper) seems to think this override of NewFamilyInstance is actually a member of ItemFactoryBase:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="johnfechtelRZ8SW_0-1682963874948.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1209011i442EBBBAE2DC3DDD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="johnfechtelRZ8SW_0-1682963874948.png" alt="johnfechtelRZ8SW_0-1682963874948.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried a variety of methods to force the correct override here but without much success. Has anyone come up against this before, and is there a solution?&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 18:01:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11933993#M12294</guid>
      <dc:creator>john.fechtelRZ8SW</dc:creator>
      <dc:date>2023-05-01T18:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the wrong NewFamilyInstance override</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11935320#M12295</link>
      <description>&lt;P&gt;What is the exact data type declaration for your variables location, familySymbol and baseLevel?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this the opverload you are after?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://www.revitapidocs.com/2022/9cdda5d9-85f7-4445-1e84-5fda77d41f74.htm" target="_blank"&gt;https://www.revitapidocs.com/2022/9cdda5d9-85f7-4445-1e84-5fda77d41f74.htm&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Autodesk.Revit.Creation.Document.NewFamilyInstance (XYZ, FamilySymbol, Level, StructuralType)&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In that case, it may help clarify things to ensure that your argument types really are XYZ, FamilySymbol and Level, respectively.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As opposed to `&lt;U&gt;var&lt;/U&gt;`, for instance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 06:04:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11935320#M12295</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-05-02T06:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the wrong NewFamilyInstance override</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11935859#M12296</link>
      <description>&lt;P&gt;Hi Jeremy,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I should have included more context. Here is a portion of the function:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt; public bool MakeColumn(Document doc, Family inFamily, MMStructuralElement element)
        {
            var familySymbol = doc.GetElement(inFamily.GetFamilySymbolIds().First()) as FamilySymbol;

            Autodesk.Revit.DB.Level baseLevel;
            GetLevelByName(doc, element.BaseLevel.LevelName, out baseLevel);

            Autodesk.Revit.DB.Level topLevel;
            GetLevelByName(doc, element.TopLevel.LevelName, out topLevel);

            if (baseLevel == null || topLevel == null || familySymbol == null)
            {
                Console.WriteLine("Error in MakeColumn on element " + element.ProductId);
                return false;
            }

            if (!familySymbol.IsActive)
            {
                familySymbol.Activate();
            }

            XYZ location = Util.Point3dToXYZ(element.Coordinates[0], 2, true);

            FamilyInstance column = doc.Create.NewFamilyInstance(location, familySymbol, baseLevel, StructuralType.Column);
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- location is an Autodesk.Revit.DB.XYZ&lt;/P&gt;&lt;P&gt;- familySymbol is being declared as a var ... as an Autodesk.Revit.DB.FamilySymbol&lt;/P&gt;&lt;P&gt;- baseLevel is declared as an Autodesk.Revit.DB.Level&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are correct, that is the overload I'm after.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 10:52:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11935859#M12296</guid>
      <dc:creator>john.fechtelRZ8SW</dc:creator>
      <dc:date>2023-05-02T10:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the wrong NewFamilyInstance override</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11936380#M12297</link>
      <description>&lt;P&gt;In Revit 2024, the method you are using is defined in the Autodesk.Revit.Creation.ItemFactoryBase class, the Autodesk.Revit.Creation.Document class just inherits the method from Autodesk.Revit.Creation.ItemFactoryBase class, which means&amp;nbsp; Autodesk.Revit.Creation.ItemFactoryBase.NewFamilyInstance() is invoked underneath (the C# compiler generated code).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KennanChen_1-1683036478456.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1209567i2476C5AD8D6D92EE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KennanChen_1-1683036478456.png" alt="KennanChen_1-1683036478456.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;While in older versions of Revit, the "same" method is defined directly in&amp;nbsp;Autodesk.Revit.Creation.Document class.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The use of the method looks the same but they result in different compiled code when linked with different RevitAPI.dll, which means the dll compiled against Revit 2024 cannot be used in Revit 2023 if you use this method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is an API compatibility issue, so the common solution is to build different dlls targeting to different versions of Revit.&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 14:09:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11936380#M12297</guid>
      <dc:creator>Kennan.Chen</dc:creator>
      <dc:date>2023-05-02T14:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the wrong NewFamilyInstance override</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11936461#M12298</link>
      <description>&lt;P&gt;To show the problem in a clear way, I created a simple plugin to use this method and compiled against different versions of Revit and analyzed the IL code C# compiler generated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;C# source code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KennanChen_2-1683037685051.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1209580i21A43793AE29A8EA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KennanChen_2-1683037685051.png" alt="KennanChen_2-1683037685051.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IL code compiled against Revit 2024:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KennanChen_4-1683037827397.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1209585iB3C8F09F380468E0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KennanChen_4-1683037827397.png" alt="KennanChen_4-1683037827397.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IL code compiled against Revit 2023:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KennanChen_5-1683037888851.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1209586i2FE0B65028A054D6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KennanChen_5-1683037888851.png" alt="KennanChen_5-1683037888851.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 14:31:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11936461#M12298</guid>
      <dc:creator>Kennan.Chen</dc:creator>
      <dc:date>2023-05-02T14:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the wrong NewFamilyInstance override</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11936487#M12299</link>
      <description>&lt;P&gt;BTW, similar API changes is rarely seen but indeed happened before.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this weird code in my project:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KennanChen_6-1683038511393.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1209587i0D94E198BEC68854/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KennanChen_6-1683038511393.png" alt="KennanChen_6-1683038511393.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 14:43:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11936487#M12299</guid>
      <dc:creator>Kennan.Chen</dc:creator>
      <dc:date>2023-05-02T14:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the wrong NewFamilyInstance override</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11936629#M12300</link>
      <description>&lt;P&gt;Another hacky solution might be using Reflection to force invoke the method from Autodesk.Revit.Creation.Document class.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I modified the demo source code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KennanChen_0-1683041714364.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1209603iF555538BACDDCE7C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KennanChen_0-1683041714364.png" alt="KennanChen_0-1683041714364.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that the above code was written by hand and I had not done a single test.&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 15:40:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11936629#M12300</guid>
      <dc:creator>Kennan.Chen</dc:creator>
      <dc:date>2023-05-02T15:40:32Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the wrong NewFamilyInstance override</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11936658#M12301</link>
      <description>&lt;P&gt;If Reflection is acceptable, you can also use "dynamic" to call this method in a more simple way.&lt;/P&gt;&lt;P&gt;By using "dynamic", you choose not to make the C# compiler aware of which method you are calling at compile time, which can also make the generated IL code to call this method from Autodesk.Revit.Creation.Document class.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KennanChen_1-1683042502254.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1209612iE474643FDA816CF7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KennanChen_1-1683042502254.png" alt="KennanChen_1-1683042502254.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Same as above, test it yourself!&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 15:51:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11936658#M12301</guid>
      <dc:creator>Kennan.Chen</dc:creator>
      <dc:date>2023-05-02T15:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the wrong NewFamilyInstance override</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11936971#M12302</link>
      <description>&lt;P&gt;Thanks, Kennan! I hadn't found the 2024 changelog but this puts the pieces together for me. Much appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 17:59:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11936971#M12302</guid>
      <dc:creator>john.fechtelRZ8SW</dc:creator>
      <dc:date>2023-05-02T17:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the wrong NewFamilyInstance override</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11953788#M12303</link>
      <description>&lt;P&gt;Many thanks to Kennan for the very thorough explanation!&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;I added a link to it in the blog for wider distribution and greater visibility:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2023/05/dark-icons-newfamilyinstance-and-ai-news.html#3" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2023/05/dark-icons-newfamilyinstance-and-ai-news.html#3&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&amp;nbsp;&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;</description>
      <pubDate>Wed, 10 May 2023 08:43:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/getting-the-wrong-newfamilyinstance-override/m-p/11953788#M12303</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-05-10T08:43:28Z</dc:date>
    </item>
  </channel>
</rss>

