<?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: Duct hanger - place  family instance Revit API in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/duct-hanger-place-family-instance-revit-api/m-p/10986089#M20427</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12088765"&gt;@Or.levi&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for raising this question.&lt;/P&gt;&lt;P&gt;I believe you need to get the level on which your host element resides first, in this case the level of the duct.&lt;/P&gt;&lt;P&gt;// get ducts's level for hanger creation&lt;BR /&gt;Level level = document.GetElement(duct.LevelId) as Level;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the level object you need to pass to the NewFamilyInstance overload.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can refer to&amp;nbsp;&lt;STRONG&gt;&lt;A href="https://www.revitapidocs.com/2022/168d4c67-73dd-d7c8-4969-12846eeaddfa.htm" target="_blank" rel="noopener"&gt;https://www.revitapidocs.com/2022/168d4c67-73dd-d7c8-4969-12846eeaddfa.htm&lt;/A&gt;&lt;/STRONG&gt;for more details.&lt;/P&gt;&lt;P&gt;Let me know if you get the solution,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 05 Mar 2022 18:02:52 GMT</pubDate>
    <dc:creator>caroline.gitonga</dc:creator>
    <dc:date>2022-03-05T18:02:52Z</dc:date>
    <item>
      <title>Duct hanger - place  family instance Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/duct-hanger-place-family-instance-revit-api/m-p/10985962#M20426</link>
      <description>&lt;P&gt;hey,&lt;/P&gt;&lt;P&gt;i'm trying to place a family using the API (c#).&lt;/P&gt;&lt;P&gt;When using the NewFamiltInstace overloaded method that takes (location, symbol,host, level, structural) - i'm expecting to get the instance of the hanger family in the level i have inserted, and in the elevation of the host ( the duct).&lt;/P&gt;&lt;P&gt;instead - i get the duct hanger in the ground floor no matter what i'm doing, can any one understand why, and what sholud i do to get it in the desired level?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;the code from my transaction:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using (Transaction trans = new Transaction(doc, "Place Family"))
{
trans.Start();


int indx = 0;
foreach (XYZ hanger_xyz in hangerCoordinates)
{

if (!hangerSymbol.IsActive)
{
hangerSymbol.Activate();
}

doc.Create.NewFamilyInstance(hanger_xyz, hangerSymbol,duct,level, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);

}

trans.Commit();
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Orlevi_0-1646494927344.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1032812i2014FCFD6703CAA1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Orlevi_0-1646494927344.png" alt="Orlevi_0-1646494927344.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2022 15:42:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/duct-hanger-place-family-instance-revit-api/m-p/10985962#M20426</guid>
      <dc:creator>Or.levi</dc:creator>
      <dc:date>2022-03-05T15:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: Duct hanger - place  family instance Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/duct-hanger-place-family-instance-revit-api/m-p/10986089#M20427</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12088765"&gt;@Or.levi&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for raising this question.&lt;/P&gt;&lt;P&gt;I believe you need to get the level on which your host element resides first, in this case the level of the duct.&lt;/P&gt;&lt;P&gt;// get ducts's level for hanger creation&lt;BR /&gt;Level level = document.GetElement(duct.LevelId) as Level;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the level object you need to pass to the NewFamilyInstance overload.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can refer to&amp;nbsp;&lt;STRONG&gt;&lt;A href="https://www.revitapidocs.com/2022/168d4c67-73dd-d7c8-4969-12846eeaddfa.htm" target="_blank" rel="noopener"&gt;https://www.revitapidocs.com/2022/168d4c67-73dd-d7c8-4969-12846eeaddfa.htm&lt;/A&gt;&lt;/STRONG&gt;for more details.&lt;/P&gt;&lt;P&gt;Let me know if you get the solution,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2022 18:02:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/duct-hanger-place-family-instance-revit-api/m-p/10986089#M20427</guid>
      <dc:creator>caroline.gitonga</dc:creator>
      <dc:date>2022-03-05T18:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: Duct hanger - place  family instance Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/duct-hanger-place-family-instance-revit-api/m-p/10986193#M20428</link>
      <description>&lt;P&gt;hey @&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11981988" target="_self"&gt;&lt;SPAN class=""&gt;caroline.gitonga&lt;/SPAN&gt;&lt;/A&gt;&lt;BR /&gt;thank you for your response!&lt;BR /&gt;unfortunately it did not change the situation.&lt;BR /&gt;The duct hangers are still being placed only in the ground floor for some reason.&lt;BR /&gt;i also tried inserting name for the level by user input like so -&lt;BR /&gt;&lt;BR /&gt;&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;// get user input for desired level
string inputLevelName = Microsoft.VisualBasic.Interaction.InputBox("Please insert the EXACT name of the desired level", "Insert Level", "");
//Get Level(in order to create hanger element)
Level level = new FilteredElementCollector(doc)
.OfCategory(BuiltInCategory.OST_Levels)
.WhereElementIsNotElementType()
.Cast&amp;lt;Level&amp;gt;()
.First(x =&amp;gt; x.Name == inputLevelName);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;[still did not work..]&amp;nbsp;&lt;/P&gt;&lt;P&gt;any idea why?&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Orlevi_0-1646511890726.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1032832iC6129C97D2E8E69C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Orlevi_0-1646511890726.png" alt="Orlevi_0-1646511890726.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2022 20:25:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/duct-hanger-place-family-instance-revit-api/m-p/10986193#M20428</guid>
      <dc:creator>Or.levi</dc:creator>
      <dc:date>2022-03-05T20:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: Duct hanger - place  family instance Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/duct-hanger-place-family-instance-revit-api/m-p/10989628#M20429</link>
      <description>&lt;P&gt;figured it out.&amp;nbsp;&lt;/P&gt;&lt;P&gt;After testing all of the 11 overloaded methods for newFamilyInstance and their required arguments, and snooping around with RevitLookUp, i&amp;nbsp; managed to get the right overloded method which is:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;&amp;nbsp;&amp;nbsp; FamilyInstance familyInstance = doc.Create.NewFamilyInstance(face, hanger_xyz, new XYZ(0, 1, 0), hangerSymbol);&lt;/LI-CODE&gt;&lt;P&gt;face==&amp;gt; as a&amp;nbsp; Referemce object (extracted it from a face Face that i got from a GeoElement that i got from the desired level's floor)&lt;/P&gt;&lt;P&gt;hanger_xyz==&amp;gt;an XYZ location&lt;/P&gt;&lt;P&gt;new XYZ(0,1,0)==&amp;gt; a direction of the family as it is when it's attached to a cielling host ( got it from revitLookUp)&lt;/P&gt;&lt;P&gt;hangerSymbol ==&amp;gt; the familysymbol.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;cheers!&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 21:00:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/duct-hanger-place-family-instance-revit-api/m-p/10989628#M20429</guid>
      <dc:creator>Or.levi</dc:creator>
      <dc:date>2022-03-07T21:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: Duct hanger - place  family instance Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/duct-hanger-place-family-instance-revit-api/m-p/11230008#M20430</link>
      <description>Good day, Or.levi&lt;BR /&gt;&lt;BR /&gt;I am a total noob when with C#, and I would like to write a transaction similar to yours except with flow arrows for pipe. I was wondering if you wouldn't mind sharing all your code from the duct selection to the transaction so I could adopt my coding to work pipe and my flow arrow families.</description>
      <pubDate>Sun, 12 Jun 2022 17:11:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/duct-hanger-place-family-instance-revit-api/m-p/11230008#M20430</guid>
      <dc:creator>Chris-VC_Studio</dc:creator>
      <dc:date>2022-06-12T17:11:47Z</dc:date>
    </item>
  </channel>
</rss>

