<?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: Interior Elevation perpendicualr view to the wall in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-perpendicualr-view-to-the-wall/m-p/12761107#M5396</link>
    <description>I tell you in Spanish “SOS UN GRANDE!!” thank you very much for your answer, I was lost and I didn't know how to solve it.</description>
    <pubDate>Wed, 08 May 2024 18:52:20 GMT</pubDate>
    <dc:creator>manuel.serafin6ZWQC</dc:creator>
    <dc:date>2024-05-08T18:52:20Z</dc:date>
    <item>
      <title>Interior Elevation perpendicualr view to the wall</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-perpendicualr-view-to-the-wall/m-p/12760995#M5394</link>
      <description>&lt;P&gt;I am working on the development of a tool that inserts interior elevations. The tool places an elevation in the center of the room or if the user decides to place an interior elevation in each of the walls of the room (taking the boundary segments). The problem I am having is that at the moment of inserting the interior elevations in each one I am not getting it to be perpendicual to the wall (Image 1 is how it should be and image 2 is how it is being).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Image 1:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="manuelserafin6ZWQC_1-1715189818136.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1359831iB19FC209A520725D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="manuelserafin6ZWQC_1-1715189818136.png" alt="manuelserafin6ZWQC_1-1715189818136.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Image 2:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="manuelserafin6ZWQC_0-1715189753513.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1359830iB373FCBD5490AF5A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="manuelserafin6ZWQC_0-1715189753513.png" alt="manuelserafin6ZWQC_0-1715189753513.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the part of the code I am working with:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;        private void CreateElevationBySegment(Document doc, Room room)
        {
            Transaction t = new Transaction(doc, "Create Elevation by Segment");
            t.Start();

            try
            {
                ViewFamilyType vft = new FilteredElementCollector(doc)
                    .OfClass(typeof(ViewFamilyType))
                    .Cast&amp;lt;ViewFamilyType&amp;gt;()
                    .FirstOrDefault(x =&amp;gt; x.ViewFamily == ViewFamily.Elevation &amp;amp;&amp;amp; x.Name.Contains("Interior"));

                if (vft == null)
                {
                    MessageBox.Show("No interior elevation view type was found.");
                    t.RollBack();
                    return;
                }

                List&amp;lt;Wall&amp;gt; walls = GetRoomWalls(room);
                foreach (Wall wall in walls)
                {
                    XYZ wallCenter = GetWallCenter(wall);
                    XYZ wallDirection = GetWallDirection(wall);
                    XYZ perpendicularDirection = new XYZ(-wallDirection.Y, wallDirection.X, 0);

                    ElevationMarker marker = ElevationMarker.CreateElevationMarker(doc, vft.Id, wallCenter, 1);
                    ViewSection elevationView = marker.CreateElevation(doc, activeView.Id, 0);

                    double angle = Math.Atan2(perpendicularDirection.Y, perpendicularDirection.X);
                    Line rotationAxis = Line.CreateBound(wallCenter, wallCenter + XYZ.BasisZ);
                    ElementTransformUtils.RotateElement(doc, elevationView.Id, rotationAxis, angle);
                }

                t.Commit();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to create elevations: " + ex.Message);
                t.RollBack();
            }
        }

        private XYZ GetWallDirection(Wall wall)
        {
            LocationCurve curve = wall.Location as LocationCurve;
            XYZ start = curve.Curve.GetEndPoint(0);
            XYZ end = curve.Curve.GetEndPoint(1);
            return (end - start).Normalize();
        }

        private XYZ GetWallCenter(Wall wall)
        {
            LocationCurve wallLocation = wall.Location as LocationCurve;
            if (wallLocation != null &amp;amp;&amp;amp; wallLocation.Curve is Line)
            {
                Line line = wallLocation.Curve as Line;
                return (line.GetEndPoint(0) + line.GetEndPoint(1)) / 2;
            }
            return null;
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any support you can give me.&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 17:39:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-perpendicualr-view-to-the-wall/m-p/12760995#M5394</guid>
      <dc:creator>manuel.serafin6ZWQC</dc:creator>
      <dc:date>2024-05-08T17:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Interior Elevation perpendicualr view to the wall</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-perpendicualr-view-to-the-wall/m-p/12761086#M5395</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12474185"&gt;@manuel.serafin6ZWQC&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I didn't catch it directly but you're rotating the view and not the marker.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;ElevationMarker marker = ElevationMarker.CreateElevationMarker(doc, vft.Id, wallCenter, 1);
                    ViewSection elevationView = marker.CreateElevation(doc, activeView.Id, 0);

                    double angle = Math.Atan2(perpendicularDirection.Y, perpendicularDirection.X);
                    Line rotationAxis = Line.CreateBound(wallCenter, wallCenter + XYZ.BasisZ);
                    ElementTransformUtils.RotateElement(doc, elevationView.Id, rotationAxis, angle);
// elevationView.Id =&amp;gt; this is the view, replace with marker.id&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Getting the view correcly sized and pointing to the right side of the wall will need some work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Michel&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 18:40:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-perpendicualr-view-to-the-wall/m-p/12761086#M5395</guid>
      <dc:creator>TripleM-Dev.net</dc:creator>
      <dc:date>2024-05-08T18:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: Interior Elevation perpendicualr view to the wall</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-perpendicualr-view-to-the-wall/m-p/12761107#M5396</link>
      <description>I tell you in Spanish “SOS UN GRANDE!!” thank you very much for your answer, I was lost and I didn't know how to solve it.</description>
      <pubDate>Wed, 08 May 2024 18:52:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-perpendicualr-view-to-the-wall/m-p/12761107#M5396</guid>
      <dc:creator>manuel.serafin6ZWQC</dc:creator>
      <dc:date>2024-05-08T18:52:20Z</dc:date>
    </item>
  </channel>
</rss>

