<?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 calculate the center point of elbow? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9806648#M31113</link>
    <description>&lt;P&gt;Dear&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1103138"&gt;@Revitalizer&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your great solution. I am very appreciate your kindly help&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Oct 2020 08:45:29 GMT</pubDate>
    <dc:creator>Sino.Pacific</dc:creator>
    <dc:date>2020-10-16T08:45:29Z</dc:date>
    <item>
      <title>How to calculate the center point of elbow?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9803893#M31106</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to get to center point of an elbow. I have check all the data of the elbow from Revit Lookup tool but did not find anything. So is there anyway I can get that information ?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Image05.png" style="width: 441px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/831594iDA1088285FC57C43/image-dimensions/441x314?v=v2" width="441" height="314" role="button" title="Image05.png" alt="Image05.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you so much for your help&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sino&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 04:59:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9803893#M31106</guid>
      <dc:creator>Sino.Pacific</dc:creator>
      <dc:date>2020-10-15T04:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the center point of elbow?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9804339#M31107</link>
      <description>&lt;P&gt;Yes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a pretty simple geometrical exercise.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have the full information about the start and end point, specifically including location and direction == face normal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The start and end point directions are not parallel. Therefore, they define a 2D plane. The centre point will normally lie in that plane, so you just have a (simpler) 2D task to solve, not 3D.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the 2D plane, you can determine the normal vector to the start and end directions. Extend those two normal vectors to define infinite lines and determine their intersection. That is your centre point.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 09:18:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9804339#M31107</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-10-15T09:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the center point of elbow?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9804400#M31108</link>
      <description>&lt;P&gt;Dear&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your answer. But I just finally find out that actually the elbow has the center point information under the Geometry information:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 443px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/831707iF18859002438A7E2/image-dimensions/443x221?v=v2" width="443" height="221" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my working code is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;  static public XYZ GetCenterofElbow (FamilyInstance selectedDuct)
        {
            XYZ output = null; 
            List&amp;lt;Connector&amp;gt; allConnectors = selectedDuct.MEPModel.ConnectorManager.Connectors.Cast&amp;lt;Connector&amp;gt;().ToList();
            
            Connector connectorA = allConnectors[0]; 
            Connector connectorB = allConnectors[0];

            GeometryElement geometryElement = selectedDuct.get_Geometry(new Options());
            List&amp;lt;GeometryInstance&amp;gt; ginsList = selectedDuct.get_Geometry(new Options()).Where(o =&amp;gt; o is GeometryInstance).Cast&amp;lt;GeometryInstance&amp;gt;().ToList();

            foreach (GeometryInstance gins in ginsList)
            {
                foreach (GeometryObject ge in gins.GetInstanceGeometry())
                {
                    try
                    {
                        Arc centerArc = ge as Arc;
                        output = centerArc.Center; 
                    }
                    catch (Exception)
                    {
                       
                    }
                }
            }

            return output; 


        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 09:47:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9804400#M31108</guid>
      <dc:creator>Sino.Pacific</dc:creator>
      <dc:date>2020-10-15T09:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the center point of elbow?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9804517#M31109</link>
      <description>&lt;P&gt;Thank you for letting us know that simple solution!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Oh dear. I wasted some effort, then.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I implemented a geometrical solution for you based on the elbow connectors and their coordinate systems:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Connector Origin:&amp;nbsp;&lt;A href="https://www.revitapidocs.com/2020/28a9cf5e-9191-f9ce-74c8-622a681201f6.htm" target="_blank"&gt;https://www.revitapidocs.com/2020/28a9cf5e-9191-f9ce-74c8-622a681201f6.htm&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;CoordinateSystem property returning a Transform object:&amp;nbsp;&lt;A href="https://www.revitapidocs.com/2020/cb6d725d-654a-f6f3-fed0-96cc618a42f1.htm" target="_blank"&gt;https://www.revitapidocs.com/2020/cb6d725d-654a-f6f3-fed0-96cc618a42f1.htm&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;New GetElbowConnectors and&amp;nbsp;GetElbowCentre methods in The Building Coder samples:&amp;nbsp;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdRectDuctCorners.cs#L240-L319" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdRectDuctCorners.cs#L240-L319&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;    /// &amp;lt;summary&amp;gt;
    /// Return elbow connectors.
    /// Return null if the given element is not a 
    /// family instance with exactly two connectors.
    /// &amp;lt;/summary&amp;gt;
    List&amp;lt;Transform&amp;gt; GetElbowConnectors( Element e )
    {
      List&amp;lt;Transform&amp;gt; xs = null;
      FamilyInstance fi = e as FamilyInstance;
      if( null != fi )
      {
        MEPModel m = fi.MEPModel;
        if( null != m )
        {
          ConnectorManager cm = m.ConnectorManager;
          if( null != cm )
          {
            ConnectorSet cs = cm.Connectors;
            if( 2 == cs.Size )
            {
              xs = new List&amp;lt;Transform&amp;gt;( 2 );
              bool first = true;
              foreach( Connector c in cs )
              {
                if( first )
                {
                  xs[0] = c.CoordinateSystem;
                }
                else
                {
                  xs[1] = c.CoordinateSystem;
                }
              }
            }
          }
        }
      }
      return xs;
    }
    
    /// &amp;lt;summary&amp;gt;
    /// Return elbow centre point.
    /// Return null if the start and end points 
    /// and direction vectors are not all coplanar.
    /// &amp;lt;/summary&amp;gt;
    XYZ GetElbowCentre( Element e )
    {
      XYZ pc = null;
      List&amp;lt;Transform&amp;gt; xs = GetElbowConnectors( e );
      if( null != xs )
      {
        // Get start and end point and direction

        XYZ ps = xs[ 0 ].Origin;
        XYZ vs = xs[ 0 ].BasisZ;

        XYZ pe = xs[ 1 ].Origin;
        XYZ ve = xs[ 1 ].BasisZ;

        XYZ vd = pe - ps;

        // For a regular elbow, Z vector is normal 
        // of the 2D plane spanned by the coplanar
        // start and end points and direction vectors.

        XYZ vz = vs.CrossProduct( vd );

        if( !vz.IsZeroLength() )
        {
          XYZ vxs = vs.CrossProduct( vz );
          XYZ vxe = ve.CrossProduct( vz );
          pc = Util.LineLineIntersection( 
            ps, vxs, pe, vxe );
        }
      }
      return pc;
    }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would you like to test my code and see whether it returns the same result?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 10:48:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9804517#M31109</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-10-15T10:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the center point of elbow?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9804600#M31110</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;there may be elbow families which consist of two 45°-segments, connected by a cylindrical part between them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case, there would be two arcs with different center points, so the connector based approach seems more flexible for different family content.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Revitalizer&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 11:43:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9804600#M31110</guid>
      <dc:creator>Revitalizer</dc:creator>
      <dc:date>2020-10-15T11:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the center point of elbow?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9804617#M31111</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1020147-pelletofenrohr-90-bogen-mit-kesselanschluss-muffe~2.jpg" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/831746i17B928D05A4D9D0E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="1020147-pelletofenrohr-90-bogen-mit-kesselanschluss-muffe~2.jpg" alt="1020147-pelletofenrohr-90-bogen-mit-kesselanschluss-muffe~2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Source: &lt;A href="https://www.ofenseite.com/1020147-pelletofenrohr-90-bogen-mit-kesselanschluss-muffe" target="_blank"&gt;https://www.ofenseite.com/1020147-pelletofenrohr-90-bogen-mit-kesselanschluss-muffe&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Revitalizer&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 11:52:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9804617#M31111</guid>
      <dc:creator>Revitalizer</dc:creator>
      <dc:date>2020-10-15T11:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the center point of elbow?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9804623#M31112</link>
      <description>&lt;P&gt;In this case, there isn't any arc at all.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 11:53:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9804623#M31112</guid>
      <dc:creator>Revitalizer</dc:creator>
      <dc:date>2020-10-15T11:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the center point of elbow?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9806648#M31113</link>
      <description>&lt;P&gt;Dear&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1103138"&gt;@Revitalizer&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your great solution. I am very appreciate your kindly help&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 08:45:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9806648#M31113</guid>
      <dc:creator>Sino.Pacific</dc:creator>
      <dc:date>2020-10-16T08:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the center point of elbow?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9806679#M31114</link>
      <description>&lt;P&gt;Thank you for your appreciation, and many thanks to Revitalizer for the nice example!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code would solve the task for that as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please confirm that it works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have not tested it myself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 09:03:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-calculate-the-center-point-of-elbow/m-p/9806679#M31114</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-10-16T09:03:40Z</dc:date>
    </item>
  </channel>
</rss>

