<?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: How to Use NewFamilyInstance on Opposite Side of Wall for Wall-Mounted Famil in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-newfamilyinstance-on-opposite-side-of-wall-for-wall/m-p/7246642#M57137</link>
    <description>&lt;P&gt;It seems I didn't clean up the code sufficiently, that is a remnant of some test code. Just making a copy will work.&lt;/P&gt;</description>
    <pubDate>Sat, 22 Jul 2017 09:47:32 GMT</pubDate>
    <dc:creator>FAIR59</dc:creator>
    <dc:date>2017-07-22T09:47:32Z</dc:date>
    <item>
      <title>How to Use NewFamilyInstance on Opposite Side of Wall for Wall-Mounted Families</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-newfamilyinstance-on-opposite-side-of-wall-for-wall/m-p/7237732#M57134</link>
      <description>&lt;P&gt;I made a simple wall-mounted family&amp;nbsp;using the "Generic Model wall based.rft" template. The family is just an extrusion attached to the top side of the wall as viewed in the Ref. Level&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;wall-mounted-box.rfa:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="wall-mounted-box.rfa" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/379411i9BA6DCBBA1E5601E/image-size/large?v=v2&amp;amp;px=999" role="button" title="wall-mounted-box.PNG" alt="wall-mounted-box.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want to import this wall-mounted-box.rfa into another Family (I will call this import.rfa) that also uses the "&lt;SPAN&gt;Generic Model wall based.rft" template&lt;/SPAN&gt;. I want to place the box on the opposite side of the wall though, like the picture below. I can do this easily within the Revit UI. But I can't figure it out with the Revit API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import.rfa:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="import.rfa" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/379419iEFDAFCB23AB59433/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is code showing the methods I've tested&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;string templateFileName =
    @"C:\ProgramData\Autodesk\RAC 2016\Family Templates\English_I\Generic Model wall based.rft";
Document document = uiApplication.Application.NewFamilyDocument(templateFileName);
Family family;
using (Transaction transaction = new Transaction(document))
{
    transaction.Start("Load Family");
    document.LoadFamily(@"...\wall-mounted-box.rft", out family);
    transaction.Commit();
}
FamilySymbol symbol = document.GetElement(family.GetFamilySymbolIds().First()) as FamilySymbol;

FilteredElementCollector wallCollector = new FilteredElementCollector(document);
Wall wall = wallCollector.OfClass(typeof(Wall)).FirstElement() as Wall;

using (Transaction transaction = new Transaction(document))
{
    tx.Start("Instantiate Family");
    symbol.Activate();
    // METHOD 1: Default wall host
    FamilyInstance familyInstance = document.FamilyCreate.NewFamilyInstance(new XYZ(0,0,0), symbol, wall, StructuralType.NonStructural);
    
    // METHOD 2: try setting referenceDirection
    document.FamilyCreate.NewFamilyInstance(new XYZ(0,0,0), symbol, new XYZ(0,-1,0), wall, StructuralType.NonStructural);
&lt;BR /&gt;    // METHOD 3: Try flipping the FamilyInstance&lt;BR /&gt;    familyInstance.flipFacing();&lt;BR /&gt;&lt;BR /&gt;    // setup for METHOD 4/5
    Reference reference = HostObjectUtils.GetSideFaces(wall, ShellLayerType.Interior).First();
    
    // METHOD 4: use reference to face with method from this site
    // http://adndevblog.typepad.com/aec/2015/06/revitapi-create-familyinstance-on-a-wall-face.html
    document.FamilyCreate.NewFamilyInstance(reference, new XYZ(0, 0, 0), new XYZ(0, -1, 0), symbol);
    
    // METHOD 5: Get the face to place on
    // I just grabbed the index-2 face arbitrarily since this method doesn't work anyways
    Options opt = new Options();
    opt.ComputeReferences = true;
    Face face = (wall.get_Geometry(opt).First() as Solid).Faces.get_Item(2);
    document.FamilyCreate.NewFamilyInstance(face, new XYZ(0, 0, 0), new XYZ(0, -1, 0), symbol);
    
    tx.Commit();
}
SaveAsOptions saveAsOptions = new SaveAsOptions();
saveAsOptions.OverwriteExistingFile = true;
document.SaveAs(@"...\import.rft", saveAsOptions);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;METHOD 1 and METHOD 2 just places the box on the default side of the wall which is the top. Looks exactly like the wall-mounted-box.rfa picture.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;METHOD 3 doesn't work because familyInstance.CanFlipFacing is false.&lt;/P&gt;&lt;P&gt;Here are the properties I grabbed from FamilyInstances I creating using the Revit UI.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;default orientation on top of wall:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="default orientation on top of wall" style="width: 512px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/379422iF384A1B66508302D/image-size/large?v=v2&amp;amp;px=999" role="button" title="2017-07-18" alt="2017-07-18" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;opposite orientation on bottom of wall:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="opposite orientation on bottom of wall" style="width: 529px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/379421i41EE38FDF7DFCA6D/image-size/large?v=v2&amp;amp;px=999" role="button" title="2017-07-18" alt="2017-07-18" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;METHOD 5 says "Family cannot be placed as hosted on an input face reference, because its FamilyPlacementType is not WorkPlaneBased"&lt;/P&gt;&lt;P&gt;METHOD 4 also says that FamilyPlacementType is not WorkPlaneBase.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I do this?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 08:22:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-newfamilyinstance-on-opposite-side-of-wall-for-wall/m-p/7237732#M57134</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-19T08:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to Use NewFamilyInstance on Opposite Side of Wall for Wall-Mounted Famil</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-newfamilyinstance-on-opposite-side-of-wall-for-wall/m-p/7242288#M57135</link>
      <description>&lt;P&gt;You can mirror the family twice,&amp;nbsp;first&amp;nbsp; X-axis,&amp;nbsp;then&amp;nbsp;Y-axis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;			FamilyInstance temp=null;
			using (Transaction t = new Transaction(doc,"place instance"))
			{
				t.Start();
			
			using (SubTransaction st = new SubTransaction(doc))
			{
				st.Start();
				temp = doc.FamilyCreate.NewFamilyInstance(new XYZ(0,0,0), symb, new XYZ(1,0,0), wall,StructuralType.NonStructural);
				st.Commit();
			}
			IList&amp;lt;ElementId&amp;gt; mirrored = null;
			using (SubTransaction st = new SubTransaction(doc))
			{
				st.Start();
				mirrored = ElementTransformUtils.MirrorElements(doc,new List&amp;lt;ElementId&amp;gt;(){temp.Id},new Plane(XYZ.BasisY,XYZ.Zero),true);
			 	doc.Delete(temp.Id);
				st.Commit();
			}
			List&amp;lt;ElementId&amp;gt; mirrored2 = new List&amp;lt;ElementId&amp;gt;();
			foreach (var id in mirrored)
			{
				Element e = doc .GetElement(id);
				if (e==null) continue;
				mirrored2.Add(id);
			}
			using (SubTransaction st = new SubTransaction(doc))
			{
				st.Start();
				mirrored = ElementTransformUtils.MirrorElements(doc,mirrored2,new Plane(XYZ.BasisX,XYZ.Zero),true);
			 	doc.Delete(mirrored2);
				st.Commit();
			}
			t.Commit();
			}
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2017 15:00:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-newfamilyinstance-on-opposite-side-of-wall-for-wall/m-p/7242288#M57135</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-07-20T15:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to Use NewFamilyInstance on Opposite Side of Wall for Wall-Mounted Famil</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-newfamilyinstance-on-opposite-side-of-wall-for-wall/m-p/7245913#M57136</link>
      <description>&lt;P&gt;Thanks Fair59, it works. I'm just wondering, how come you have to check for e==null? Will it ever be null from the output of MirrorElements()? You are just trying to create a copy of mirrored in mirrored2 right?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 18:46:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-newfamilyinstance-on-opposite-side-of-wall-for-wall/m-p/7245913#M57136</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-21T18:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to Use NewFamilyInstance on Opposite Side of Wall for Wall-Mounted Famil</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-newfamilyinstance-on-opposite-side-of-wall-for-wall/m-p/7246642#M57137</link>
      <description>&lt;P&gt;It seems I didn't clean up the code sufficiently, that is a remnant of some test code. Just making a copy will work.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jul 2017 09:47:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-newfamilyinstance-on-opposite-side-of-wall-for-wall/m-p/7246642#M57137</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-07-22T09:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to Use NewFamilyInstance on Opposite Side of Wall for Wall-Mounted Families</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-newfamilyinstance-on-opposite-side-of-wall-for-wall/m-p/13401166#M57138</link>
      <description>&lt;P&gt;I am facing the issue, Can't place inserts outside of hosts. These elements won't be copied.&lt;BR /&gt;I am using face top edge then get its 1st endpoint for placement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2025 06:33:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-newfamilyinstance-on-opposite-side-of-wall-for-wall/m-p/13401166#M57138</guid>
      <dc:creator>Annonymous24</dc:creator>
      <dc:date>2025-04-01T06:33:29Z</dc:date>
    </item>
  </channel>
</rss>

