Example #1
0
        /// <summary>
        /// Metodo per l'apertura della VIEW SCELTA
        /// </summary>
        public void SingleOpenView(UIApplication uiapp, string viewName)
        {
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Document   doc   = uidoc.Document;

            FilteredElementCollector viewCollector = new FilteredElementCollector(doc);

            viewCollector.OfClass(typeof(Autodesk.Revit.DB.View));

            //string[] elevations = new string[] { "Exterior", "Interior", "Left", "Right" };

            // Cambia il valore booleano per attestare che la richiesta della view è singola
            _single = true;

            foreach (Autodesk.Revit.DB.View viewElement in viewCollector)
            {
                if (viewElement.Name == viewName)
                {
                    uidoc.RequestViewChange(viewElement);
                    _imageViewed = viewElement.Name;
                    // Chiama la Form
                    modelessForm = App.thisApp.RetriveForm();
                    // Mostra nella combobox la vista attiva
                    modelessForm.AssignValueComboBox();
                    // Salvo ed esco
                    uidoc.SaveAndClose();
                }
            }
        }
Example #2
0
        /// <summary>
        /// Metodo per l'apertura della view
        /// </summary>
        private void OpenView(UIApplication uiapp)
        {
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Document   doc   = uidoc.Document;

            Autodesk.Revit.DB.View viewActive = doc.ActiveView;

            FilteredElementCollector viewCollector = new FilteredElementCollector(doc);

            viewCollector.OfClass(typeof(Autodesk.Revit.DB.View));

            //string[] elevations = new string[] { "Exterior", "Interior", "Left", "Right" };

            // Cambia il valore booleano per attestare che la richiesta della view è multipla
            _single = false;

            // Cambia la lingua del name in Inglese
            string nameViewActive = viewActive.Name;

            if (nameViewActive == "Exterior" || nameViewActive == "Arrière" || nameViewActive == "Extérieur" || nameViewActive == "Esteriore")
            {
                nameViewActive = "Exterior";
            }
            else if (nameViewActive == "Interior" || nameViewActive == "Avant" || nameViewActive == "Intérieur" || nameViewActive == "Interiore")
            {
                nameViewActive = "Interior";
            }
            else if (nameViewActive == "Left" || nameViewActive == "Gauche" || nameViewActive == "Sinistra")
            {
                nameViewActive = "Left";
            }
            else if (nameViewActive == "Right" || nameViewActive == "Droite" || nameViewActive == "Destra")
            {
                nameViewActive = "Right";
            }

            // Verifica se il file si apre su Exterior e nel caso salta direttamente all'esportazione dell'immagine
            if (nameViewActive == "Exterior" && _imageViewed == "")
            {
                _imageViewed = nameViewActive;
                // Chiama la Form
                modelessForm = App.thisApp.RetriveForm();
                // Mostra nella combobox la vista attiva
                modelessForm.AssignValueComboBox();
                // Salvo ed esco
                uidoc.SaveAndClose();
            }

            foreach (Autodesk.Revit.DB.View viewElement in viewCollector)
            {
                var name = viewElement.Name;

                // Cambia la lingua del name in Inglese
                if (name == "Exterior" || name == "Arrière" || name == "Extérieur" || name == "Esteriore")
                {
                    name = "Exterior";
                }
                else if (name == "Interior" || name == "Avant" || name == "Intérieur" || name == "Interiore")
                {
                    name = "Interior";
                }
                else if (name == "Left" || name == "Gauche" || name == "Sinistra")
                {
                    name = "Left";
                }
                else if (name == "Right" || name == "Droite" || name == "Destra")
                {
                    name = "Right";
                }

                switch (name)
                {
                case "Exterior":
                    if (nameViewActive != "Exterior" && nameViewActive != "Interior" && nameViewActive != "Left" && nameViewActive != "Right")
                    {
                        uidoc.RequestViewChange(viewElement);
                        _imageViewed = name;
                        // Chiama la Form
                        modelessForm = App.thisApp.RetriveForm();
                        // Mostra nella combobox la vista attiva
                        modelessForm.AssignValueComboBox();
                        // Salvo ed esco
                        uidoc.SaveAndClose();
                    }
                    break;

                case "Interior":
                    if (nameViewActive != "Interior" && nameViewActive != "Left" && nameViewActive != "Right")
                    {
                        uidoc.RequestViewChange(viewElement);
                        _imageViewed = name;
                        // Chiama la Form
                        modelessForm = App.thisApp.RetriveForm();
                        // Mostra nella combobox la vista attiva
                        modelessForm.AssignValueComboBox();
                        // Salvo ed esco
                        uidoc.SaveAndClose();
                    }
                    break;

                case "Left":
                    if (nameViewActive != "Left" && nameViewActive != "Right")
                    {
                        uidoc.RequestViewChange(viewElement);
                        _imageViewed = name;
                        // Chiama la Form
                        modelessForm = App.thisApp.RetriveForm();
                        // Mostra nella combobox la vista attiva
                        modelessForm.AssignValueComboBox();
                        // Salvo ed esco
                        uidoc.SaveAndClose();
                    }
                    break;

                case "Right":
                    if (nameViewActive != "Right")
                    {
                        uidoc.RequestViewChange(viewElement);
                        _imageViewed = name;
                        // Chiama la Form
                        modelessForm = App.thisApp.RetriveForm();
                        // Mostra nella combobox la vista attiva
                        modelessForm.AssignValueComboBox();
                        // Salvo ed esco
                        uidoc.SaveAndClose();
                    }
                    break;
                }
            }
        }