<?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 How to get the centroid of a wall? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-centroid-of-a-wall/m-p/7244961#M57065</link>
    <description>&lt;P&gt;Can somebody help me with this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the workflow is ..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. pick a wall - done&lt;/P&gt;&lt;P&gt;2. get the centroid of a wall&lt;/P&gt;&lt;P&gt;3. create point to the centroid of the wall&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jul 2017 13:38:26 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-07-21T13:38:26Z</dc:date>
    <item>
      <title>How to get the centroid of a wall?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-centroid-of-a-wall/m-p/7244961#M57065</link>
      <description>&lt;P&gt;Can somebody help me with this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the workflow is ..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. pick a wall - done&lt;/P&gt;&lt;P&gt;2. get the centroid of a wall&lt;/P&gt;&lt;P&gt;3. create point to the centroid of the wall&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 13:38:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-centroid-of-a-wall/m-p/7244961#M57065</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-21T13:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the centroid of a wall?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-centroid-of-a-wall/m-p/7250245#M57066</link>
      <description>&lt;P&gt;This may help:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2015/06/dynamo-centroid-volume-calculation-migration-blitz.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2015/06/dynamo-centroid-volume-calculation-migration-blitz.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;(It's not a Dynamo macro!)&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 17:54:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-centroid-of-a-wall/m-p/7250245#M57066</guid>
      <dc:creator>matthew_taylor</dc:creator>
      <dc:date>2017-07-24T17:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the centroid of a wall?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-centroid-of-a-wall/m-p/7270339#M57067</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4604673" target="_self"&gt;&lt;SPAN&gt;napa2017&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the centeriod of a wall is the (BottomFace.origin+TopFace.origin)/2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sure,the wall must be regular.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hope is good for you&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt;        XYZ GetCenteriod(Solid solid)
        {
            XYZ BottomOrigin = null;
            XYZ TopOrigin = null;
            XYZ CenteriodPoint = null;
            string Message = null;
            PlanarFace pf = null;
            foreach (Face face in solid.Faces)
            {
                pf = face as PlanarFace;
                if (null != pf)
                {
                    if (Math.Abs(pf.FaceNormal.X) &amp;lt; 0.01 &amp;amp;&amp;amp; Math.Abs(pf.FaceNormal.Y) &amp;lt; 0.01 &amp;amp;&amp;amp; pf.FaceNormal.Z &amp;lt; 0)//Face.FaceNormal    Judge  TopFace or BottomFace
                    {
                        BottomOrigin = pf.Origin;
                        Message += BottomOrigin.ToString()+"BottomFace \n";
                        continue;
                    }
                    if (Math.Abs(pf.FaceNormal.X) &amp;lt; 0.01 &amp;amp;&amp;amp; Math.Abs(pf.FaceNormal.Y) &amp;lt; 0.01 &amp;amp;&amp;amp; pf.FaceNormal.Z &amp;gt; 0)//Face.FaceNormal     Judge  TopFace or BottomFace
                    {
                        TopOrigin = pf.Origin;
                        Message += TopOrigin.ToString() + "TopFace \n";
                        continue;
                    }
                }
            }
            CenteriodPoint = (TopOrigin + BottomOrigin) / 2;
            Message += CenterPoint.ToString()+"Centeriod \n";
            TaskDialog.Show("CenteriodPoint", Message);
            return CenteriodPoint;
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 07:00:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-centroid-of-a-wall/m-p/7270339#M57067</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-08-02T07:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the centroid of a wall?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-centroid-of-a-wall/m-p/7292186#M57068</link>
      <description>&lt;P&gt;the Solid class has a method &lt;SPAN style="color: rgb(25, 25, 112); font-weight: bold;"&gt;ComputeCentroid&lt;/SPAN&gt;().&lt;/P&gt;
&lt;P&gt;So from the wall Geometry you can get the Centroid&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;BR /&gt;			Options opt = new Options();
			opt.DetailLevel = ViewDetailLevel.Coarse;
			Solid wallSolid = null;
			foreach (GeometryObject obj in wall.get_Geometry(opt))
			{
				Solid s = obj as Solid;
				if (s!= null)
				{
					wallSolid = s;
					break;
				}
			}
			if (wallSolid!=null)
			{
				XYZ centre = wallSolid.ComputeCentroid();
			}
			&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Aug 2017 22:21:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-centroid-of-a-wall/m-p/7292186#M57068</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-08-10T22:21:30Z</dc:date>
    </item>
  </channel>
</rss>

