<?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 rotate elements in view3D in REVIT using API in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-rotate-elements-in-view3d-in-revit-using-api/m-p/9509610#M34333</link>
    <description>&lt;P&gt;Thanks for our help, I have tested your solution but I still get the same message.&lt;/P&gt;&lt;P&gt;I am just wondering how rotate work in REVIT, is it possible to apply rotation on any axis?&lt;/P&gt;</description>
    <pubDate>Tue, 12 May 2020 11:49:54 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-05-12T11:49:54Z</dc:date>
    <item>
      <title>How to rotate elements in view3D in REVIT using API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-rotate-elements-in-view3d-in-revit-using-api/m-p/9509063#M34331</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here what I want to do : I want to create a view3D and rotate elements on the view before exporting the view&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following code :&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;var viewFamilyType&lt;BR /&gt;= new FilteredElementCollector(doc)&lt;BR /&gt;.OfClass(typeof(ViewFamilyType))&lt;BR /&gt;.OfType&amp;lt;ViewFamilyType&amp;gt;()&lt;BR /&gt;.FirstOrDefault(x =&amp;gt;&lt;BR /&gt;x.ViewFamily == ViewFamily.ThreeDimensional);&lt;BR /&gt;&lt;BR /&gt;using (var t = new Transaction(doc))&lt;BR /&gt;{&lt;BR /&gt;t.Start("Create 3D View");&lt;/P&gt;&lt;P&gt;if (viewFamilyType != null)&lt;BR /&gt;{&lt;BR /&gt;var threeDView = View3D.CreateIsometric(&lt;BR /&gt;doc, viewFamilyType.Id);&lt;BR /&gt;&lt;BR /&gt;var o = new XYZ(0, 0, 0);&lt;BR /&gt;var x = new XYZ(1, 0, 0);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// Find all Wall instances in the document by using category filter&lt;/P&gt;&lt;P&gt;RotateModel(doc, threeDView, o, x, Math.PI / 2);&lt;/P&gt;&lt;P&gt;// Export to SAT&lt;/P&gt;&lt;P&gt;var viewSet = new List&amp;lt;ElementId&amp;gt;()&lt;BR /&gt;{&lt;BR /&gt;threeDView.Id&lt;BR /&gt;};&lt;BR /&gt;var exportOptions = new SATExportOptions();&lt;BR /&gt;doc.Export(outputFolder, file, viewSet, exportOptions);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;t.RollBack();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;private static void RotateModel(Document doc, View3D view, XYZ origin, XYZ axis, double angle)&lt;BR /&gt;{&lt;BR /&gt;view.Pinned = false;&lt;/P&gt;&lt;P&gt;// Use ElementClassFilter to find all loads in the document&lt;BR /&gt;// Using typeof(Element) will yield all AreaLoad, LineLoad and PointLoad&lt;BR /&gt;var filter = new ElementClassFilter(typeof(Extrusion));&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// Use ElementClassFilter to find all loads in the document&lt;BR /&gt;// Using typeof(LoadBase) will yield all AreaLoad, LineLoad and PointLoad&lt;BR /&gt;var ox = Line.CreateBound(origin, axis);&lt;/P&gt;&lt;P&gt;var collector = new FilteredElementCollector(doc, view.Id);&lt;BR /&gt;if (!collector.IsValidObject)&lt;BR /&gt;throw new Exception("Not valid Object");&lt;/P&gt;&lt;P&gt;// Apply the filter to the elements in the active document&lt;BR /&gt;var elements = collector&lt;BR /&gt;.WhereElementIsNotElementType();&lt;BR /&gt;//.WherePasses(filter).ToList();&lt;/P&gt;&lt;P&gt;//var elements = collector.ToList();&lt;/P&gt;&lt;P&gt;foreach (var element1 in elements)&lt;BR /&gt;{&lt;BR /&gt;var element = (Extrusion) element1;&lt;BR /&gt;if (element.IsSolid &amp;amp;&amp;amp; element.IsValidObject &amp;amp;&amp;amp; !element.IsHidden(view))&lt;BR /&gt;ElementTransformUtils.RotateElement(doc, element.Id, ox, angle);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;view.Pinned = true;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get a "c'ant rotate element." I not sure I have the right methodology. Can someone help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 08:03:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-rotate-elements-in-view3d-in-revit-using-api/m-p/9509063#M34331</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-05-12T08:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to rotate elements in view3D in REVIT using API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-rotate-elements-in-view3d-in-revit-using-api/m-p/9509532#M34332</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Change line from&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;var x = new XYZ(1, 0, 0);&lt;/LI-CODE&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;LI-CODE lang="general"&gt; var x = new XYZ(0, 0, 1);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;I think this will work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, check elements in&amp;nbsp;&lt;STRONG&gt;var elements &lt;/STRONG&gt;= collector&lt;STRONG&gt;.&lt;/STRONG&gt;WhereElementIsNotElementType() is not NULL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 11:23:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-rotate-elements-in-view3d-in-revit-using-api/m-p/9509532#M34332</guid>
      <dc:creator>naveen.kumar.t</dc:creator>
      <dc:date>2020-05-12T11:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to rotate elements in view3D in REVIT using API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-rotate-elements-in-view3d-in-revit-using-api/m-p/9509610#M34333</link>
      <description>&lt;P&gt;Thanks for our help, I have tested your solution but I still get the same message.&lt;/P&gt;&lt;P&gt;I am just wondering how rotate work in REVIT, is it possible to apply rotation on any axis?&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 11:49:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-rotate-elements-in-view3d-in-revit-using-api/m-p/9509610#M34333</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-05-12T11:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to rotate elements in view3D in REVIT using API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-rotate-elements-in-view3d-in-revit-using-api/m-p/9509743#M34334</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;ElementTransformUtils.RotateElements r&lt;SPAN&gt;otates an element about the given axis and angle.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is the code I used &lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;var viewFamilyType = new FilteredElementCollector(doc).OfClass(typeof(ViewFamilyType)).OfType&amp;lt;ViewFamilyType&amp;gt;().FirstOrDefault(x =&amp;gt; x.ViewFamily == ViewFamily.ThreeDimensional);
            using (var t = new Transaction(doc))
            {
                t.Start("Create 3D View");
                if (viewFamilyType != null)
                {
                    var threeDView = View3D.CreateIsometric(doc, viewFamilyType.Id);
                    var o = new XYZ(0, 0, 0);
                    var x = new XYZ(0, 0, 1);
                    // Find all Wall instances in the document by using category filter
                    RotateModel(doc, threeDView, o, x, Math.PI / 2);
                    // Export to SAT
                    var viewSet = new List&amp;lt;ElementId&amp;gt;()
                          {
                        threeDView.Id
                          };
                    var exportOptions = new SATExportOptions();
                    doc.Export(outputFolder,"Name.sat", viewSet, exportOptions);
                }
                t.Commit();
            }&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;In the below code use appropriate filter to get the element from the family instances&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;private static void RotateModel(Document doc, View3D view, XYZ origin, XYZ axis, double angle)
        {
            view.Pinned = false;
            var filter = new ElementClassFilter(typeof(FamilyInstance)); 
            var ox = Line.CreateBound(origin, axis);
            var collector = new FilteredElementCollector(doc, view.Id);
            if (!collector.IsValidObject)
                throw new Exception("Not valid Object");
            var elements = collector.WherePasses(filter).WhereElementIsNotElementType();
            foreach (var element1 in elements)
            {
                var element = (FamilyInstance)element1;
                if (element.IsValidObject &amp;amp;&amp;amp; !element.IsHidden(view))
                    ElementTransformUtils.RotateElement(doc, element.Id, ox, angle);
            }
            view.Pinned = true;
        }&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;Also, refer the attached images(I just created a simple extrusion)&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BEFORE" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/769144i4A94E4758692407F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BEFORE.png" alt="BEFORE" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;BEFORE&lt;/span&gt;&lt;/span&gt;BEFORE&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;/////////////////////////////////////////////////////////////////////////////////////////////////////&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AFTER.png" style="width: 636px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/769146i7AE561CAD1830F51/image-dimensions/636x321?v=v2" width="636" height="321" role="button" title="AFTER.png" alt="AFTER.png" /&gt;&lt;/span&gt;AFTER&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 12:34:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-rotate-elements-in-view3d-in-revit-using-api/m-p/9509743#M34334</guid>
      <dc:creator>naveen.kumar.t</dc:creator>
      <dc:date>2020-05-12T12:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to rotate elements in view3D in REVIT using API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-rotate-elements-in-view3d-in-revit-using-api/m-p/9509808#M34335</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can't rotate walls around the X-axis, rotation around the Z-axis could fail if there are hosted elements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Further I see you want to create a SAT file, any change to export to Solidworks?&lt;/P&gt;&lt;P&gt;As I gather, solidworks has a the Y-axis as Up and not the Z-axis.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could be corrected in SolidWorks or else just export to DWG and link-rotate in AutoCAD and create SAT from there?&lt;/P&gt;&lt;P&gt;I have consultants working in SolidWorks and they can get it correctly imported AND exported.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Michel&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 12:59:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-rotate-elements-in-view3d-in-revit-using-api/m-p/9509808#M34335</guid>
      <dc:creator>TripleM-Dev.net</dc:creator>
      <dc:date>2020-05-12T12:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to rotate elements in view3D in REVIT using API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-rotate-elements-in-view3d-in-revit-using-api/m-p/9510184#M34336</link>
      <description>&lt;P&gt;Thanks, true, it is to import into SolidWorks. I'll try to rotate the model so that it is correctly oriented in SolidWorks.&lt;/P&gt;&lt;P&gt;Is you said, it can't be oriented around ? What is the reason?&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 15:06:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-rotate-elements-in-view3d-in-revit-using-api/m-p/9510184#M34336</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-05-12T15:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to rotate elements in view3D in REVIT using API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-rotate-elements-in-view3d-in-revit-using-api/m-p/9510226#M34337</link>
      <description>&lt;P&gt;Have you tried it in the UI, if you can rotate the wall around the X-axis.&lt;/P&gt;&lt;P&gt;If something can't be done in the UI, it can't be done in the API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Walls are levelbased, export the 3D view to AutoCAD, rotate there and then export to SAT from AutoCAD.&lt;/P&gt;&lt;P&gt;Or adjust the import in Solidworks&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 15:20:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-rotate-elements-in-view3d-in-revit-using-api/m-p/9510226#M34337</guid>
      <dc:creator>TripleM-Dev.net</dc:creator>
      <dc:date>2020-05-12T15:20:34Z</dc:date>
    </item>
  </channel>
</rss>

