<?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: NewFamilyInstance not setting level of family instance in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11466651#M16940</link>
    <description>&lt;P&gt;Unfortunately, your options are somewhat limited because RevitAPI content has such complex relationships to levels depending on object type. In my experience, you have a couple of options:&lt;/P&gt;&lt;P&gt;1. Use the Create.NewFamilyInstance overload that takes a Level.&lt;/P&gt;&lt;P&gt;2. Place per usual, then set the Level Parameter of your element - this, unfortunately, is not always possible and can be stored in many different parameters depending on what type of object you are placing, but for FamilyInstance,&amp;nbsp; I believe it is the ParameterTypeId.LevelParam, (or the BuiltinParameter.LEVEL_PARAM for older versions of Revit).&lt;/P&gt;&lt;P&gt;**Note that to do option 2 you will likely also need to update the Offset-from-level parameter after your element is placed to update the Z coordinate of your element**&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good Luck and Please post a solution if you manage to figure out a reliable way.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Oct 2022 18:11:04 GMT</pubDate>
    <dc:creator>rhanzlick</dc:creator>
    <dc:date>2022-10-06T18:11:04Z</dc:date>
    <item>
      <title>NewFamilyInstance not setting level of family instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11405934#M16936</link>
      <description>&lt;P&gt;I'm placing a FamilySymbol into my Revit model and have encountered a strange error that only lead to more questions. Since my family is face-based, I'm using the `NewFamilyInstance Method (Face, XYZ, XYZ, FamilySymbol) ` function. However, this doesn't set the `LevelId` property of the new instance (it's set to -1, and appears blank in the UI - the property itself is present in the UI however).&lt;/P&gt;&lt;P&gt;If I query&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;instance.&lt;/SPAN&gt;&lt;SPAN&gt;get_Parameter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;BuiltInParameter&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;FAMILY_LEVEL_PARAM&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;I get a very low ElementId of -1001352. If I check my document for that ID (doc.GetElement), I get null returned.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried setting the levelId parameter, but unfortunately `instance.levelId` is read-only.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then started looking into other elements in my model and noticed that walls and rooms do have a levelId, but things like&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;wall.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;returns null? Shouldn't that and `wall.LevelId` be the same (where the latter has a valid levelId for me)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then tried to set the `FAMILY_LEVEL_PARAM`&amp;nbsp; for the wall (and other elements like the room) following this post &lt;A href="https://thebuildingcoder.typepad.com/blog/2011/01/family-instance-missing-level-property.html," target="_blank" rel="noopener"&gt;https://thebuildingcoder.typepad.com/blog/2011/01/family-instance-missing-level-property.html,&lt;/A&gt;&lt;/P&gt;&lt;P&gt;but because&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;wall.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;returns `null`, I can't call `.Set()` on it, since it throws the `object reference not set to an instance of an object.` error (no idea why it worked in the referenced post by thebuildingcoder).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, I'm mainly looking for a way to successfully set the levelId of my inserted family, does anyone have any hints? Explanations on the weird difference between elements' FAMILY_LEVEL_PARAM and levelId would also be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm on Revit 2023 and the model I used is the one from the "My First Plugin" tutorial here &lt;A href="https://knowledge.autodesk.com/search-result/caas/simplecontent/content/my-first-revit-plug-overview.html" target="_blank" rel="noopener"&gt;https://knowledge.autodesk.com/search-result/caas/simplecontent/content/my-first-revit-plug-overview.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 12:35:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11405934#M16936</guid>
      <dc:creator>grubdex</dc:creator>
      <dc:date>2022-09-07T12:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: NewFamilyInstance not setting level of family instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11406679#M16937</link>
      <description>&lt;P&gt;When you got the id from&amp;nbsp;BuiltInParameter.FAMILY_LEVEL_PARAM, I think you must have used&amp;nbsp;&lt;EM&gt;parameter.Id&lt;/EM&gt;, which returns the Id of the parameter, which for&amp;nbsp;BuiltInParameter.FAMILY_LEVEL_PARAM is&amp;nbsp;&lt;SPAN&gt;-1001352. To get its value as an element Id call&amp;nbsp;&lt;EM&gt;parameter.AsElementId()&lt;/EM&gt;.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 16:56:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11406679#M16937</guid>
      <dc:creator>mhannonQ65N2</dc:creator>
      <dc:date>2022-09-07T16:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: NewFamilyInstance not setting level of family instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11417749#M16938</link>
      <description>&lt;P&gt;Thanks for your reply! Unfortunately, that doesn't solve my main issue of setting the level of the newly placed elements. Does anyone know how to set that?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 09:01:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11417749#M16938</guid>
      <dc:creator>grubdex</dc:creator>
      <dc:date>2022-09-13T09:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: NewFamilyInstance not setting level of family instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11430898#M16939</link>
      <description>&lt;P&gt;Does anyone have an answer for how to set the level of a family instance?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 13:38:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11430898#M16939</guid>
      <dc:creator>grubdex</dc:creator>
      <dc:date>2022-09-19T13:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: NewFamilyInstance not setting level of family instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11466651#M16940</link>
      <description>&lt;P&gt;Unfortunately, your options are somewhat limited because RevitAPI content has such complex relationships to levels depending on object type. In my experience, you have a couple of options:&lt;/P&gt;&lt;P&gt;1. Use the Create.NewFamilyInstance overload that takes a Level.&lt;/P&gt;&lt;P&gt;2. Place per usual, then set the Level Parameter of your element - this, unfortunately, is not always possible and can be stored in many different parameters depending on what type of object you are placing, but for FamilyInstance,&amp;nbsp; I believe it is the ParameterTypeId.LevelParam, (or the BuiltinParameter.LEVEL_PARAM for older versions of Revit).&lt;/P&gt;&lt;P&gt;**Note that to do option 2 you will likely also need to update the Offset-from-level parameter after your element is placed to update the Z coordinate of your element**&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good Luck and Please post a solution if you manage to figure out a reliable way.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2022 18:11:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11466651#M16940</guid>
      <dc:creator>rhanzlick</dc:creator>
      <dc:date>2022-10-06T18:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: NewFamilyInstance not setting level of family instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11480113#M16941</link>
      <description>&lt;P&gt;Thanks for the reply! I'm wondering which overload would take a level? I don't see an obvious candidate in the docs, at least not one that would also work with a face-based familySymbol.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For option 2, do you happen to have a short code sample as to how you'd set the parameters using ParameterTypeId.LevelParam or BuiltinParameter.LEVEL_PARAM? At least the latter seems to be readonly for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 13:23:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11480113#M16941</guid>
      <dc:creator>grubdex</dc:creator>
      <dc:date>2022-10-13T13:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: NewFamilyInstance not setting level of family instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11480445#M16942</link>
      <description>&lt;P&gt;For Face-Based, you may have some luck with the SCHEDULE_LEVEL_PARAM, then adjusting INSTANCE_ELEVATION_PARAM accordingly.&lt;/P&gt;&lt;P&gt;Additionally, this may not be specifically discussing a face-based FamilyInstance, but may provide some useful info as well:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/change-the-reference-level-of-a-family-instance/td-p/8003191" target="_blank"&gt;https://forums.autodesk.com/t5/revit-api-forum/change-the-reference-level-of-a-family-instance/td-p/8003191&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 15:23:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11480445#M16942</guid>
      <dc:creator>rhanzlick</dc:creator>
      <dc:date>2022-10-13T15:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: NewFamilyInstance not setting level of family instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11484636#M16943</link>
      <description>&lt;P&gt;Not sure why it worked for you, but for both the&lt;/P&gt;&lt;PRE&gt;SCHEDULE_LEVEL_PARAM&lt;/PRE&gt;&lt;P&gt;as well as the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;FAMILY_LEVEL_PARAM&lt;/PRE&gt;&lt;P&gt;I'm getting a InvalidOperationException: The parameter is read-only. Also tried regenerating the document before attepmting to set those parameters, but that didn't help either.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried setting the element using the level, i.e. with&lt;/P&gt;&lt;P&gt;NewFamilyInstance Method (XYZ, FamilySymbol, XYZ, Element, StructuralType)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the level as the Element input type, but that only set the host tot he level, the schedule level remained null and readonly (note that readonly refers to the API alone, I can change the Schedule Level as I want in the UI).&lt;/P&gt;&lt;P&gt;I'm on Revit 2023, maybe that is the issue, not sure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Oct 2022 10:33:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11484636#M16943</guid>
      <dc:creator>grubdex</dc:creator>
      <dc:date>2022-10-15T10:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: NewFamilyInstance not setting level of family instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11512673#M16944</link>
      <description>&lt;P&gt;Just as an udpate: So far, I've tried the following methods to create a new Family Instance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NewFamilyInstance Method (Face, XYZ, XYZ, FamilySymbol)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NewFamilyInstance Method (Reference, XYZ, XYZ, FamilySymbol)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NewFamilyInstance Method (XYZ, FamilySymbol, XYZ, Element, StructuralType)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;None of them set the level (I passed the level explicitly to the last of the bunch as `element`, which set the level as host but not as, well, level). All of them had the Level and Schedule Level parameters as readonly, so I couldn't change them after creation. Pretty annoying if you ask me. If anyone knows a solution, please let me know&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 13:05:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11512673#M16944</guid>
      <dc:creator>grubdex</dc:creator>
      <dc:date>2022-10-27T13:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: NewFamilyInstance not setting level of family instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11513091#M16945</link>
      <description>&lt;P&gt;Thanks for the followup. It looks like you've exhausted many of the methods readily available. Perhaps&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;&amp;nbsp;has some wisdom on whether or not this is specifically possible (or knows of a workaround) via the API?&lt;/P&gt;&lt;P&gt;Sorry I couldn't be more help!&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 15:15:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11513091#M16945</guid>
      <dc:creator>rhanzlick</dc:creator>
      <dc:date>2022-10-27T15:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: NewFamilyInstance not setting level of family instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11513601#M16946</link>
      <description>&lt;P&gt;Maybe you can find some additional hints in this recent post?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2022/10/element-level-and-ifc-properties-.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2022/10/element-level-and-ifc-properties-.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 19:00:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11513601#M16946</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2022-10-27T19:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: NewFamilyInstance not setting level of family instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11520801#M16947</link>
      <description>&lt;P&gt;So as a byproduct of finding out that the NewFamilyInstance overloads exist in &lt;A href="https://www.revitapidocs.com/2023/0c0d640b-7810-55e4-3c5e-cd295dede87b.htm" target="_blank" rel="noopener"&gt;different&lt;/A&gt; &lt;A href="https://www.revitapidocs.com/2023/451ee414-cea0-e9bd-227b-c73bc93507dd.htm" target="_blank" rel="noopener"&gt;places&amp;nbsp;&lt;/A&gt;with only partial overlap for whatever reason, I finally found the overloads that take a level that people have been mentioning here and there in the forums. Here is an update on what I found out, also based on the link provided by Jeremy Tammik.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The heart of the code to try this is as follows, I'm also attaching the model in question&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="csharp"&gt;//these params are hardcoded for quick testing
FamilySymbol switchFamilySymbol = doc.GetElement(new ElementId(361776)); 
Element host = doc.GetElement(new ElementId(353023));
var level = doc.GetElement(new ElementId(30)) as Level;
var pos = new XYZ(0.910480147, 4.925404783, 3.937007874);
var orientation = new XYZ(-1, 0, 0);
// end hardcoded
using( var trans = new Transaction( doc ) )
{
    trans.Start( "test placement" );
    pos = new XYZ(pos.X-15, pos.Y, pos.Z);
    var lvlAndHost = doc.Create.NewFamilyInstance(pos,
        switchFamilySymbol, host, level, StructuralType.NonStructural);
    //-- see explanation below for why this exists --
    doc.Regenerate();
    var setPos = withLvl.Location as LocationPoint;
    setPos.Point = pos ;
    // -- end see explanation --
    // try with setting the level as host element, recommended in tammik's link.
    pos = new XYZ(pos.X+2, pos.Y, pos.Z);
    var lvlAsHost= doc.Create.NewFamilyInstance(pos, switchFamilySymbol, level,
        StructuralType.NonStructural);
    // try with using the level as host directly, plus orientation
    pos = new XYZ(pos.X+2, pos.Y, pos.Z);
    var lvlAsHostAndOrient = doc.Create.NewFamilyInstance(pos, switchFamilySymbol, orientation,
        level, StructuralType.NonStructural);
    // try with using the host element directly
    pos = new XYZ(pos.X+2, pos.Y, pos.Z);
    var hostElement = doc.Create.NewFamilyInstance(pos, switchFamilySymbol, orientation,
        host, StructuralType.NonStructural);  
    // try with using the faceref, as always
    pos = new XYZ(pos.X+2, pos.Y, pos.Z);
    // for the wall in question, the exterior and interior shell layers are mixed up, which is why we use .Exterior here
    var reference = HostObjectUtils.GetSideFaces(wall, ShellLayerType.Exterior);
    var faceRef =
        doc.Create.NewFamilyInstance(reference, pos, 
            orientation, switchFamilySymbol);
    // try with using the level as ref
    pos = new XYZ(pos.X+2, pos.Y, pos.Z);
    reference = new Reference(level);
    var levelRef =
        doc.Create.NewFamilyInstance(reference, pos, 
            orientation, switchFamilySymbol);
    trans.Commit(); 
}&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;&lt;P&gt;And here is, again, where things get a bit weird. From the floor plan, everything seems as expected - all elements are aligned to the wall, though the two instances that didn't get passed the orientation are the wrong way around&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="grubdex_0-1667234357545.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1134155i7872758992E5135D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="grubdex_0-1667234357545.png" alt="grubdex_0-1667234357545.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;However, if we look at the cross-section, every single placement besides the one taking the face reference of the wall (2nd to last) places the element on the very bottom of the host. Even more interesting, I'm NOT able to change the elevation of any of these bottom-wall instances (no problem though with the one that has the correct height set). Since I'm not able to do it in the GUI, I'm obviously also not able to do it using the API (this is the "to-be-explained" block in the source code above)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="grubdex_1-1667234433037.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1134156iE838CC031E3F3D89/image-size/medium?v=v2&amp;amp;px=400" role="button" title="grubdex_1-1667234433037.png" alt="grubdex_1-1667234433037.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As for the host and level parameters, here's a quick overview of what the individual functions set (numbers correspond to the order of functions in the source code above)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;A href="https://www.revitapidocs.com/2023/168d4c67-73dd-d7c8-4969-12846eeaddfa.htm" target="_blank" rel="noopener"&gt;NewFamilyInstance(XYZ, FamilySymbol, Element, Level, StructuralType) &lt;/A&gt;&lt;OL&gt;&lt;LI&gt;Level set to Level 1, Host set to Wall, Elevation set to 0 and unchangeable&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://www.revitapidocs.com/2023/9cdda5d9-85f7-4445-1e84-5fda77d41f74.htm" target="_blank" rel="noopener"&gt;NewFamilyInstance(XYZ, FamilySymbol, Level, StructuralType) &lt;/A&gt;&lt;OL&gt;&lt;LI&gt;Level set to Level 1, Host is None, Elevation set to 0 and unchangeable&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://www.revitapidocs.com/2023/7febcfdb-dbfa-317a-1c5e-882621f3e846.htm" target="_blank" rel="noopener"&gt;NewFamilyInstance(XYZ, FamilySymbol, XYZ, Element, StructuralType) (passing the level as host element)&lt;/A&gt;&lt;OL&gt;&lt;LI&gt;Level set to None, Host set to Level 1, Elevation set to 0 and unchangeable&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://www.revitapidocs.com/2023/7febcfdb-dbfa-317a-1c5e-882621f3e846.htm" target="_blank" rel="noopener"&gt;NewFamilyInstance(XYZ, FamilySymbol, XYZ, Element, StructuralType) (passing the wall as host element)&lt;/A&gt;&lt;OL&gt;&lt;LI&gt;Level set to None, Host set to Wall, Elevation set to 0 and unchangeable&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://www.revitapidocs.com/2023/be4b822c-829a-7e7b-8c03-a3a324bfb75b.htm" target="_blank" rel="noopener"&gt;NewFamilyInstance(Reference, XYZ, XYZ, FamilySymbol) (passing a reference to the wall face as reference)&lt;/A&gt;&lt;OL&gt;&lt;LI&gt;Level set to None, Host set to Wall, Elevation set to 0 and unchangeable (but once setting the Schedule Level in the GUI, the elevation immediately shows the correct value and can also be altered in the properties, the instance itself has been at the correct spot height from the beginning in the actual model though, and could also be moved in Z-direction, which was not true for any of the other instances)&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://www.revitapidocs.com/2023/be4b822c-829a-7e7b-8c03-a3a324bfb75b.htm" target="_blank" rel="noopener"&gt;NewFamilyInstance(Reference, XYZ, XYZ, FamilySymbol) &lt;/A&gt;(passing a reference to the level as reference)&lt;OL&gt;&lt;LI&gt;Level set to Level 1, Host set to Level 1, Elevation set to 0, and unchangeable.&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bonus weird stuff: Although a good chunk of these instances has the wall as their host, for some reason I'm able to move all elements freely in the XY-plane, except for the one instance that also happens to have the correct height. And no, they're not losing their association with their host (see screenshot below).&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="grubdex_2-1667235515168.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1134173iF408C0181E62D1C9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="grubdex_2-1667235515168.png" alt="grubdex_2-1667235515168.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Bonus Bonus weird stuff: I'm not able to pick a new host in the GUI for the first 4 options tried (works for the last two)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="grubdex_0-1667236954147.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1134189i1143E93139C9EC09/image-size/medium?v=v2&amp;amp;px=400" role="button" title="grubdex_0-1667236954147.png" alt="grubdex_0-1667236954147.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Weirded out yet? Well, there's more (I keep editing these in as I find them): When I snoop these instances, all but the last two have their Host and HostFace set to None - even if in the GUI it shows a Host in the instance's properties&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="grubdex_1-1667237974569.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1134209i9557CB0D6B9C420A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="grubdex_1-1667237974569.png" alt="grubdex_1-1667237974569.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;So to summarise: Either I'm fundamentally misunderstanding the creation of new family instances, or the creation of new family instances is severely broken. Since this functionality really seems like a core functionality for developers to use the API in the first place, I'm quite surprised to find it in such a broken state.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 11:00:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11520801#M16947</guid>
      <dc:creator>grubdex</dc:creator>
      <dc:date>2022-11-02T11:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: NewFamilyInstance not setting level of family instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11520934#M16948</link>
      <description>&lt;P&gt;Wow, thanks very much for the thorough exploration and documentation. Sorry if I was unclear earlier, I also did not realize the Create.NewFamilyInstance existed in multiple locations! I will test out these methods you've outlined myself and follow up if I find any workarounds, but at the moment I would guess that your understanding is more complete than most - and therefore highlights some potential bug fixes to be made in the API. In any case, I believe the "Pick New Workplane" (Pick New Host For Existing FamilyInstance) which is trivially possible through the UI is certainly (and sorely) missing via the API.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2022 17:51:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11520934#M16948</guid>
      <dc:creator>rhanzlick</dc:creator>
      <dc:date>2022-10-31T17:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: NewFamilyInstance not setting level of family instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11523409#M16949</link>
      <description>&lt;P&gt;Thank you for your investigation and raising this. I &lt;A href="https://autodesk.slack.com/archives/C0SR6NAP8/p1667295142766399" target="_blank"&gt;passed&lt;/A&gt; it on to the development team for you, and they raised a ticket&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="c-link" tabindex="-1" href="https://jira.autodesk.com/browse/REVIT-198548" target="_blank" rel="noopener noreferrer" data-stringify-link="https://jira.autodesk.com/browse/REVIT-198548" data-sk="tooltip_parent" data-remove-tab-index="true"&gt;REVIT-198548&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for further exploration (all links internal only, for my own reference). I keep you posted and hopefully be able to report something useful soon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 17:03:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11523409#M16949</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2022-11-01T17:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: NewFamilyInstance not setting level of family instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11561158#M16950</link>
      <description>&lt;P&gt;Dear Grubdex,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your patience.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The development team replied:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the customer's RVT file, they are placing the Lighting Switches / Two Way Switch family. They noticed that when placing this family via the API, the "Schedule Level" instance parameter is present but blank, whereas when the family is placed via the UI the "Schedule Level" Instance parameter is set to the host level of the host element. (So, levelId 30 for a wall on Level 1.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried placing the switch via the UI. I chose Placement / Place on Face in the placement editor ribbon. When clicking on a face of a wall, I can see the "Schedule Level" ID getting set from the FamilyInstance constructor.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When placing via the API, NewFamilyInstance(Face, XYZ, XYZ, FamilySymbol) is the overload that lets me place the switch on the face at a particular location/height.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, the FamilyInstance constructor's callstack does not pass along the valid Level ID to be set in the new family instance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Schedule Level is left blank.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using a modified version of Grubdex's sample code, I was able to place the "Lighting Switches / Two Way Switch" family on levels and walls in HOTEL_2.rvt. I tested in Revit development version and in Revit 2023.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I had to manually place one "Two Way Switch" before the API could place additional switches, too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can confirm that the "Schedule Level" parameter is left empty (no level selected) when using the NewFamilyInstance APIs that Grubdex tried in the sample code. However, all new family instances I created that had "Schedule Level" parameter editable in the UI could also be edited by the API. To set "Schedule Level" via the API, I just needed to get/set parameter "BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM" with a valid level ID.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;newFamilyInstance.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM).Set(level2id);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the forum post from Grubdex there was some questioning about which NewFamilyInstance API was the right for placing switches in walls. I believe that NewFamilyInstance Method (Face, XYZ, XYZ, FamilySymbol) makes the most sense in this context, as the Two Way Switch family is face-based. To get the wall face that would host the switch, I used wall.get_Geometry() like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;  List&amp;lt;Face&amp;gt; faces = new List&amp;lt;Face&amp;gt;();
  Options geomOptions = new Options();
  geomOptions.ComputeReferences = true;
  GeometryElement wallGeom = wall.get_Geometry(geomOptions);
  foreach (GeometryObject geomObj in wallGeom)
  {
    Solid geomSolid = geomObj as Solid;
    if (null != geomSolid)
    {
      foreach (Face geomFace in geomSolid.Faces)
      {
        faces.Add(geomFace);
      }
      break;
    }
  }			    
  var faceRef = doc.Create.NewFamilyInstance(faces[0], pos, orientation, switchFamilySymbol);
  
  // Set the "Schedule Level" parameter to Level 2
  faceRef.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM).Set(level2id);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did not have success using HostObjectUtils.GetSideFaces() to get the wall face.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my C# macro which places a Two Way Switch in a wall from HOTEL_2.rvt. With Revit 2023, you can open the attached hotel_2_macro_r2023.rvt to play with it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;  public void PlaceSwitchAndUpdateScheduleLevel()
  {
    Document doc = Document;
    
    //these params are hardcoded for quick testing
    FamilySymbol switchFamilySymbol = doc.GetElement(new ElementId(361776)) as FamilySymbol; 
    Wall wall = doc.GetElement(new ElementId(353023)) as Wall;;
    ElementId level2id = new ElementId(9946);
    var pos = new XYZ(-14.0, 4.925404783, 3.937007874);
    var orientation = new XYZ(-1, 0, 0);
    // end hardcoded
    
    using( var trans = new Transaction( doc ) )
    {
      trans.Start( "test placement" );
      
      List&amp;lt;Face&amp;gt; faces = new List&amp;lt;Face&amp;gt;();
      Options geomOptions = new Options();
      geomOptions.ComputeReferences = true;
      GeometryElement wallGeom = wall.get_Geometry(geomOptions);
      foreach (GeometryObject geomObj in wallGeom)
      {
        Solid geomSolid = geomObj as Solid;
        if (null != geomSolid)
        {
          foreach (Face geomFace in geomSolid.Faces)
          {
            faces.Add(geomFace);
          }
          break;
        }
      }			    
      var faceRef = doc.Create.NewFamilyInstance(faces[0], pos, orientation, switchFamilySymbol);
      
      // Set the "Schedule Level" parameter to Level 2
      faceRef.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM).Set(level2id);
      
      trans.Commit(); 
    }
  }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please see the responses above regarding placing a light switch family on a wall face and setting the "Schedule Level" parameter. I only focused on the simple goal of placing a switch on a wall, and did not dig into the other "tricky issues."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&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>Fri, 18 Nov 2022 05:51:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newfamilyinstance-not-setting-level-of-family-instance/m-p/11561158#M16950</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2022-11-18T05:51:58Z</dc:date>
    </item>
  </channel>
</rss>

