Ejemplo n.º 1
0
        public static Element Wrap(Autodesk.Revit.DB.View view, bool isRevitOwned)
        {
            switch (view.ViewType)
            {
            case ViewType.Legend:
                return(Legend.FromExisting(view, isRevitOwned));

            default:
                return(UnknownElement.FromExisting(view, true));
            }
        }
Ejemplo n.º 2
0
 public static Element Wrap(Autodesk.Revit.DB.ViewPlan view, bool isRevitOwned)
 {
     if (view.ViewType == ViewType.CeilingPlan)
     {
         return(CeilingPlanView.FromExisting(view, isRevitOwned));
     }
     else if (view.ViewType == ViewType.FloorPlan)
     {
         return(FloorPlanView.FromExisting(view, isRevitOwned));
     }
     else
     {
         // unknown type of plan view, just wrap as unknown
         return(UnknownElement.FromExisting(view));
     }
 }
Ejemplo n.º 3
0
        public static Element Wrap(Autodesk.Revit.DB.ViewPlan view, bool isRevitOwned)
        {
            switch (view.ViewType)
            {
            case ViewType.CeilingPlan:
                return(CeilingPlanView.FromExisting(view, isRevitOwned));

            case ViewType.FloorPlan:
                return(FloorPlanView.FromExisting(view, isRevitOwned));

            case ViewType.EngineeringPlan:
                return(StructuralPlanView.FromExisting(view, isRevitOwned));

            default:
                return(UnknownElement.FromExisting(view, true));
            }
        }
Ejemplo n.º 4
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());
        }
Ejemplo n.º 5
0
 public static UnknownElement Wrap(Autodesk.Revit.DB.Element element, bool isRevitOwned)
 {
     return(UnknownElement.FromExisting(element));
 }
Ejemplo n.º 6
0
        public CurtainPanel[] SupportedPanels()
        {
            var elementAsMullion = InternalElement as Autodesk.Revit.DB.Mullion;

            if (elementAsMullion == null)
            {
                throw new Exception("Mullion should represent Revit's Mullion");
            }

            var host = elementAsMullion.Host;

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

            var panels = CurtainPanel.ByElement(UnknownElement.FromExisting(host));

            var result = new List <CurtainPanel>();

            var thisCurve = this.LocationCurve;

            int numberPanels = panels.Length;

            for (int index = 0; index < numberPanels; index++)
            {
                var panelAtIndex = panels[index] as CurtainPanel;
                if (panelAtIndex == null)
                {
                    continue;
                }
                var  bounds     = panelAtIndex.Boundaries;
                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(panelAtIndex);
                }
            }
            return(result.ToArray());
        }