Exemplo n.º 1
0
 /// <summary>
 /// change selected ViewPlan
 /// </summary>
 /// <param name="sender">object who sent this event</param>
 /// <param name="e">event args</param>
 private void ViewComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     // choose another view for the truss creation
     if (this.ViewComboBox.SelectedIndex < m_views.Count())
     {
         m_selectedView = m_views.ElementAt(this.ViewComboBox.SelectedIndex);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Create from existing Element
        /// </summary>
        /// <param name="plan"></param>
        /// <param name="isRevitOwned"></param>
        /// <returns></returns>
        internal static CeilingPlanView FromExisting(Autodesk.Revit.DB.ViewPlan plan, bool isRevitOwned)
        {
            if (plan == null)
            {
                throw new ArgumentNullException("plan");
            }

            return(new CeilingPlanView(plan)
            {
                IsRevitOwned = isRevitOwned
            });
        }
Exemplo n.º 3
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));
     }
 }
Exemplo n.º 4
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));
            }
        }
        private void CreateDesignOptions(int id)
        {
            int curScale = GetScaleFromString(requestData.scaleName);

            for (int r = 0; r < requestData.optionsInfos.Count; r++)
            {
                Tuple <string, string, string, string, string, string> curDesignOptionInfo = requestData.optionsInfos[r];

                DesignOption curDesignOption = getDesignOptionIdByNames(curDesignOptionInfo.Item1, curDesignOptionInfo.Item2);

                if (curDesignOption != null)
                {
                    Autodesk.Revit.DB.Level curLevel = GetLevelFromString(curDesignOptionInfo.Item4);

                    if (curLevel != null)
                    {
                        try
                        {
                            Autodesk.Revit.DB.ViewPlan curViewPlan = createViewPlan(curLevel, curDesignOptionInfo.Item3);
                            foreach (Parameter curParameter in curViewPlan.Parameters)
                            {
                                if (curParameter.Definition.Name == "Visible In Option")
                                {
                                    curParameter.Set(curDesignOption.Id);
                                    break;
                                }
                            }

                            if (curViewPlan != null)
                            {
                                Autodesk.Revit.DB.ViewSheet curViewSheet = createViewSheet(curDesignOptionInfo.Item5, curDesignOptionInfo.Item6, requestData.titleBlockName);

                                if (curViewSheet != null)
                                {
                                    SetViewForSheet(curViewPlan, curViewSheet, curScale);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            TaskDialog.Show("Excepion", ex.Message + "  " + curDesignOptionInfo.Item4);
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        private void resetActiveView()
        {
            FilteredElementCollector docFilter = new FilteredElementCollector(doc);

            if (docFilter != null)
            {
                FilteredElementIterator viewPlansIterator = docFilter.OfClass(typeof(Autodesk.Revit.DB.ViewPlan)).GetElementIterator();

                while (viewPlansIterator.MoveNext())
                {
                    Autodesk.Revit.DB.ViewPlan curViewPlan = viewPlansIterator.Current as Autodesk.Revit.DB.ViewPlan;

                    if (curViewPlan != null)
                    {
                        uiapp.ActiveUIDocument.ActiveView = curViewPlan;
                        break;
                    }
                }
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Initialize a CeilingPlanView element
 /// </summary>
 private void InitCeilingPlanView(Autodesk.Revit.DB.ViewPlan view)
 {
     InternalSetPlanView(view);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Private constructor
 /// </summary>
 private CeilingPlanView(Autodesk.Revit.DB.ViewPlan view)
 {
     SafeInit(() => InitCeilingPlanView(view));
 }
Exemplo n.º 9
0
 /// <summary>
 /// Initialize a StructuralPlanView element
 /// </summary>
 private void InitStructuralPlanView(Autodesk.Revit.DB.ViewPlan view)
 {
     InternalSetPlanView(view);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Private constructor
 /// </summary>
 private StructuralPlanView(Autodesk.Revit.DB.ViewPlan view)
 {
     SafeInit(() => InitStructuralPlanView(view));
 }
Exemplo n.º 11
0
 /// <summary>
 /// Private constructor
 /// </summary>
 private FloorPlanView(Autodesk.Revit.DB.ViewPlan view)
 {
     InternalSetPlanView(view);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Private constructor
 /// </summary>
 private FloorPlanView(Autodesk.Revit.DB.ViewPlan view)
 {
     SafeInit(() => InitFloorPlanView(view));
 }
Exemplo n.º 13
0
 /// <summary>
 /// change selected ViewPlan
 /// </summary>
 /// <param name="sender">object who sent this event</param>
 /// <param name="e">event args</param>
 private void ViewComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     // choose another view for the truss creation
     if (this.ViewComboBox.SelectedIndex < m_views.Count())
     { m_selectedView = m_views.ElementAt(this.ViewComboBox.SelectedIndex); }
 }
Exemplo n.º 14
0
 /// <summary>
 /// Set the InternalViewPlan property and the associated element id and unique id
 /// </summary>
 /// <param name="plan"></param>
 protected void InternalSetPlanView(Autodesk.Revit.DB.ViewPlan plan)
 {
     this.InternalViewPlan  = plan;
     this.InternalElementId = plan.Id;
     this.InternalUniqueId  = plan.UniqueId;
 }