<?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: Instance with Direction (0,0,1) in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/instance-with-direction-0-0-1/m-p/6896399#M60139</link>
    <description>&lt;P&gt;did you read what I post?&lt;BR /&gt;that is no solution, and I already figure out better way than &lt;FONT size="2" face="Consolas"&gt;RotateElement&lt;/FONT&gt;.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Feb 2017 18:26:10 GMT</pubDate>
    <dc:creator>MarryTookMyCoffe</dc:creator>
    <dc:date>2017-02-22T18:26:10Z</dc:date>
    <item>
      <title>Instance with Direction (0,0,1)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/instance-with-direction-0-0-1/m-p/6882327#M60133</link>
      <description>&lt;P&gt;I have family that I can put in to a revit and then rotate it in every direction without brake it geometry, but when I do it with Api geometry brake(for 0,0,1 evry element appere as a line).&lt;/P&gt;&lt;P&gt;Is there is a way that family should be created?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;usualy I have this problem with spheres(i have lots of difrent types of valves).&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 13:01:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/instance-with-direction-0-0-1/m-p/6882327#M60133</guid>
      <dc:creator>MarryTookMyCoffe</dc:creator>
      <dc:date>2017-02-16T13:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: Instance with Direction (0,0,1)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/instance-with-direction-0-0-1/m-p/6882442#M60134</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3894260"&gt;@MarryTookMyCoffe&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;You explain that something is wrong, but there's nothing to go on.&lt;/P&gt;
&lt;P&gt;What sort of family? Category?&amp;nbsp;What template was the family created from?&lt;/P&gt;
&lt;P&gt;How did you insert it? How did you rotate it? etc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So many questions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Matt&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 13:42:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/instance-with-direction-0-0-1/m-p/6882442#M60134</guid>
      <dc:creator>matthew_taylor</dc:creator>
      <dc:date>2017-02-16T13:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Instance with Direction (0,0,1)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/instance-with-direction-0-0-1/m-p/6884930#M60135</link>
      <description>&lt;P&gt;mechanical template, &lt;span class="lia-inline-image-display-wrapper lia-image-align-right" image-alt="sc1.jpg" style="width: 200px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/323825iEA016BA76A0AB80C/image-size/small?v=v2&amp;amp;px=200" role="button" title="sc1.jpg" alt="sc1.jpg" /&gt;&lt;/span&gt;&lt;BR /&gt;category of familys: fitting, accessory, mechanical equipment, &lt;SPAN&gt;&lt;SPAN&gt;hydraulic&lt;/SPAN&gt; &lt;SPAN&gt;fittings&lt;/SPAN&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;with family build by user(like on picture on right)&amp;nbsp; and generic fitting.&lt;BR /&gt;Now Im doing it by using:&lt;/P&gt;&lt;PRE&gt;Autodesk.Revit.Creation.FamilyInstanceCreationData FICD = new Autodesk.Revit.Creation.FamilyInstanceCreationData(elementA.point / toMeters, elementA.symbol, elementA.direction, elementA.level, StructuralType.NonStructural);

//and later i Use list of it
NFI2listElemtsdata = doc.Create.NewFamilyInstances2(DataLibrary.Library_elementsdata[Jag]);&lt;/PRE&gt;&lt;P&gt;I try to insert element with direction (1,0,0) and them rotate it araund it axis but element &lt;SPAN&gt;&lt;SPAN&gt;stretched&lt;/SPAN&gt;&lt;/SPAN&gt; it self like that:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="medium.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/323822i2D409094BD0A9B8B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="medium.png" alt="medium.png" /&gt;&lt;/span&gt;I can rotate it by UI to this position from that same axis, with no problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can it be that this appear because, I use level as a host?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;pleas don't write that there is function to automatically places fittings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 08:28:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/instance-with-direction-0-0-1/m-p/6884930#M60135</guid>
      <dc:creator>MarryTookMyCoffe</dc:creator>
      <dc:date>2017-02-17T08:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: Instance with Direction (0,0,1)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/instance-with-direction-0-0-1/m-p/6885017#M60136</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3894260"&gt;@MarryTookMyCoffe&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;To be honest, I'm not much clearer on what sort or family you're trying to place, or how you're trying to rotate it. You left out the rotation code, and obscured the code in objects only understandable to you.&lt;/P&gt;
&lt;P&gt;When you place the familyinstance using the UI, what is it hosted on? If it's not hosted on anything, you'll want to use a different NewFamilyInstance overload.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you search for "rotate a column" in the SDK, you'll see an example of how to rotate a familyinstance. If you're newly creating the element, you may need to insert the familyinstance, then either do doc.regenerate&amp;nbsp;or put the rotation&amp;nbsp;in a separate transaction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're still having trouble, I suggest posting a family, test model (with correct manual placement), and most importantly a minimum reproducible test case as Jeremy points out here:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Matt&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 09:11:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/instance-with-direction-0-0-1/m-p/6885017#M60136</guid>
      <dc:creator>matthew_taylor</dc:creator>
      <dc:date>2017-02-17T09:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: Instance with Direction (0,0,1)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/instance-with-direction-0-0-1/m-p/6885772#M60137</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did some research of how NewFamilyInstance method work, I made a variation of simple family that is just block.&lt;BR /&gt;I check almost every combination of family parameters. I did a simple code to test my theories:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;            // Retrieve elements from database

            FilteredElementCollector colLevel= new FilteredElementCollector(doc).OfClass(typeof(Level));
            FilteredElementCollector colview = new FilteredElementCollector(doc).OfClass(typeof(View));
            FilteredElementCollector col = new FilteredElementCollector(doc)
                .OfCategory(BuiltInCategory.OST_PipeAccessory)
                .OfClass(typeof(FamilySymbol));

            // Filtered element collector is iterable
            FamilySymbol familysymbol = null;
            foreach (FamilySymbol e in col){if(e.Id.IntegerValue == 661863){familysymbol = e;}}
           // if(familysymbol == null){familysymbol = col.FirstElement() as FamilySymbol;}

            // Modify document within a transaction
            Line line = Line.CreateBound(new XYZ(15, 0, 0), new XYZ(15, 1, 0));
            Line line2 = Line.CreateBound(new XYZ(0, 0, 0), new XYZ(1, 0, 0));
            
            Autodesk.Revit.Creation.FamilyInstanceCreationData ficData = new Autodesk.Revit.Creation.FamilyInstanceCreationData(new XYZ(15, 0, 0), familysymbol, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
            ficData.Axis = line;
            ficData.RotateAngle = 90 * Math.PI / 180;
            
            List&amp;lt;Autodesk.Revit.Creation.FamilyInstanceCreationData&amp;gt; dgdf = new List&amp;lt;Autodesk.Revit.Creation.FamilyInstanceCreationData&amp;gt;();
            dgdf.Add(ficData);

            using (Transaction tx = new Transaction(doc))
            {
                tx.Start("Transaction Name");
                FamilyInstance fInstance = doc.Create.NewFamilyInstance(line as Curve, familysymbol, colLevel.FirstElement() as Level, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);

                FamilyInstance fInstance2 = doc.Create.NewFamilyInstance(new XYZ(5, 0, 0), familysymbol, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
                line2 = Line.CreateBound(new XYZ(5, 0, 0), new XYZ(5, 1, 0));
                fInstance2.Location.Rotate(line2, 90 * Math.PI/180);

                FamilyInstance fInstance3 = doc.Create.NewFamilyInstance(new XYZ(10, 0, 0), familysymbol, new XYZ(0,0,-1), colview.FirstElement(), Autodesk.Revit.DB.Structure.StructuralType.NonStructural);

                doc.Create.NewFamilyInstances2(dgdf);

                FamilyInstance fInstance4 = doc.Create.NewFamilyInstance(new XYZ(20, 0, 0), familysymbol, new XYZ(0, 0, -1),null , Autodesk.Revit.DB.Structure.StructuralType.NonStructural);

                doc.Regenerate();
                tx.Commit();
            }&lt;/PRE&gt;&lt;P&gt;and i went to conclusion that it is impossible to put any family with any kind of type or category, with direction new XYZ(0,0,1). That's my answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;on plus side I discover that I can in put a Axis and RotateAngle to FamilyInstanceCreationData. Now i only need to do is a method that take right direction and change it for XYplane direction and set axis as&amp;nbsp;&lt;SPAN&gt;&lt;SPAN&gt;perpendicular&lt;/SPAN&gt;&lt;/SPAN&gt; to it and rotate by the right angle.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 14:16:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/instance-with-direction-0-0-1/m-p/6885772#M60137</guid>
      <dc:creator>MarryTookMyCoffe</dc:creator>
      <dc:date>2017-02-17T14:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: Instance with Direction (0,0,1)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/instance-with-direction-0-0-1/m-p/6895214#M60138</link>
      <description>&lt;P&gt;Actualy you can rotate families of Category Mechanical Equipment, Pipe Accessories and Pipe Fittings to direction (0,0,1).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Place the family with&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;instance =&amp;nbsp;doc.Create.NewFamilyInstance( _location, _Symbol, &lt;FONT color="#2b91af" face="Consolas" size="2"&gt;StructuralType&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;.NonStructural&lt;/FONT&gt;);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and rotate using the ElementTransformUtils&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;ElementTransformUtils&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;.RotateElement(doc, instance.Id, &lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;Line&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;.CreateBound(_location, _location.Add(&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;XYZ&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;.BasisY)), -&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;Math&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;.PI / 2);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 12:24:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/instance-with-direction-0-0-1/m-p/6895214#M60138</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-02-22T12:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Instance with Direction (0,0,1)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/instance-with-direction-0-0-1/m-p/6896399#M60139</link>
      <description>&lt;P&gt;did you read what I post?&lt;BR /&gt;that is no solution, and I already figure out better way than &lt;FONT size="2" face="Consolas"&gt;RotateElement&lt;/FONT&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 18:26:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/instance-with-direction-0-0-1/m-p/6896399#M60139</guid>
      <dc:creator>MarryTookMyCoffe</dc:creator>
      <dc:date>2017-02-22T18:26:10Z</dc:date>
    </item>
  </channel>
</rss>

