Example #1
0
      /// <summary>
      ///get curtain panel from element  
      /// </summary>
      /// <param name="mullionElement"></param>

      internal static Mullion ByElement(Mullion mullionElement)
      {
         var elementAsMullion = mullionElement.InternalElement as Autodesk.Revit.DB.Mullion;
         if (elementAsMullion == null)
            throw new Exception("Mullion should represent Revit's Mullion");
         return new Mullion(elementAsMullion);
      }
Example #2
0
        /// <summary>
        ///get curtain panel from element
        /// </summary>
        /// <param name="mullionElement"></param>

        internal static Mullion ByElement(Mullion mullionElement)
        {
            var elementAsMullion = mullionElement.InternalElement as Autodesk.Revit.DB.Mullion;

            if (elementAsMullion == null)
            {
                throw new Exception("Mullion should represent Revit's Mullion");
            }
            return(new Mullion(elementAsMullion));
        }
Example #3
0
        /// <summary>
        ///get curtain panel from element
        /// </summary>
        /// <param name="mullionElement"></param>

        internal static Mullion ByElement(Mullion mullionElement)
        {
            var elementAsMullion = mullionElement.InternalElement as Autodesk.Revit.DB.Mullion;

            if (elementAsMullion == null)
            {
                throw new Exception(Properties.Resources.MullionParseError);
            }
            return(new Mullion(elementAsMullion));
        }
Example #4
0
        public List <Element> GetMullions()
        {
            var mullionIds  = InternalCurtainGrid.GetMullionIds();
            var mullionEnum = mullionIds.GetEnumerator();
            var mullions    = new List <Element>();

            for (; mullionEnum.MoveNext();)
            {
                ElementId idMullion = mullionEnum.Current;
                var       mullion   = DocumentManager.Instance.CurrentDBDocument.GetElement(idMullion);
                mullions.Add(Mullion.FromExisting(mullion as Autodesk.Revit.DB.Mullion, true));
            }
            return(mullions);
        }
Example #5
0
        /// <summary>
        ///get all mullions of curtain wall, system or slope galzing roof
        /// </summary>
        /// <param name="hostingElement"></param>
        public static Mullion[] ByElement(Element hostingElement)
        {
            CurtainGridSet thisSet = CurtainGrid.AllCurtainGrids(hostingElement.InternalElement);
            var            result  = new List <Mullion>();

            var enumGrid = thisSet.GetEnumerator();

            for (; enumGrid.MoveNext();)
            {
                var grid   = (Autodesk.Revit.DB.CurtainGrid)enumGrid.Current;
                var ids    = grid.GetMullionIds();
                var idEnum = ids.GetEnumerator();
                for (; idEnum.MoveNext();)
                {
                    var idMullion = idEnum.Current;
                    var mullion   = DocumentManager.Instance.CurrentDBDocument.GetElement(idMullion);
                    result.Add(Mullion.FromExisting(mullion as Autodesk.Revit.DB.Mullion, true));
                }
            }
            return(result.ToArray());
        }
Example #6
0
        /// <summary>
        /// Gets Mullions hosting the specified curtain panel
        /// </summary>
        /// <returns></returns>
        public Mullion[] SupportingMullions()
        {
            var elementAsPanel = InternalElement as Autodesk.Revit.DB.Panel;

            if (elementAsPanel == null)
            {
                throw new Exception(Properties.Resources.CurtainPanelShouldRepresentRevitPanel);
            }
            var bounds = this.Boundaries;

            var host = elementAsPanel.Host;

            //var hostingGrid = CurtainGrid.ByElement(UnknownElement.FromExisting(host));

            var mullions       = Mullion.ByElement(UnknownElement.FromExisting(host, true));//hostingGrid.GetMullions();
            int numberMullions = mullions.Length;
            var result         = new List <Mullion>();

            for (int index = 0; index < numberMullions; index++)
            {
                var mullionAtIndex = mullions[index] as Mullion;
                if (mullionAtIndex == null)
                {
                    continue;
                }

                var thisCurve = mullionAtIndex.LocationCurve;

                var  enumBounds = bounds.GetEnumerator();
                bool neighbor   = false;
                for (; enumBounds.MoveNext() && !neighbor;)
                {
                    var polycrv = enumBounds.Current as PolyCurve;
                    if (polycrv == null)
                    {
                        continue;
                    }
                    var bndCrvs = polycrv.Curves();
                    var enumCrv = bndCrvs.GetEnumerator();
                    for (; enumCrv.MoveNext();)
                    {
                        var crv = enumCrv.Current as Autodesk.DesignScript.Geometry.Curve;
                        if (crv == null)
                        {
                            continue;
                        }
                        var midPoint = crv.PointAtParameter(0.5);
                        if (midPoint.DistanceTo(thisCurve) < 1.0e-7)
                        {
                            neighbor = true;
                            break;
                        }
                    }
                }
                if (neighbor)
                {
                    result.Add(mullionAtIndex);
                }
            }
            return(result.ToArray());
        }
Example #7
0
 public static Mullion Wrap(Autodesk.Revit.DB.Mullion ele, bool isRevitOwned)
 {
     return(Mullion.FromExisting(ele, isRevitOwned));
 }