예제 #1
0
        private List <String> GetSetupNames()
        {
            // Get setup names
            List <string> setupNames = BaseExportOptions.GetPredefinedSetupNames(this.Doc).ToList();

            return(setupNames);
        }
예제 #2
0
        private bool ExportDWG(Document doc, string folder, string name, ElementId viewid, string optionname)
        {
            DWGExportOptions dwgOptions = null;
            IList <string>   setupNames = BaseExportOptions.GetPredefinedSetupNames(doc);
            List <ElementId> ids        = new List <ElementId>();

            foreach (string n in setupNames)
            {
                if (n == optionname)
                {
                    dwgOptions = DWGExportOptions.GetPredefinedOptions(doc, name);
                }
            }

            ids.Add(viewid);

            try
            {
                doc.Export(folder, name, ids, dwgOptions);
                return(true);
            }
            catch (Exception e)
            {
                string message = e.Message;

                return(false);
            }
        }
예제 #3
0
        private DWGExportOptions GetDwgOptions()
        {
            List <string> setupNames = BaseExportOptions.GetPredefinedSetupNames(this.Doc).ToList();

            string prompt = "";

            prompt += "setupNames: \n";
            foreach (string setupName in setupNames)
            {
                prompt += "  " + setupName + "\n";
            }

            prompt += "this.SetupName: \n";
            prompt += this.SetupName;


            if (!(from name in setupNames select name.ToLower()).Contains(this.SetupName.ToLower()))
            {
                System.Windows.Forms.MessageBox.Show(String.Format("Não há configuração de exportação." +
                                                                   "Crie uma configuração com nome {0}, que será utilizada para exportar.", this.SetupName));
                return(null);
            }
            DWGExportOptions dwgExportOptions = DWGExportOptions.GetPredefinedOptions(this.Doc, this.SetupName);

            return(dwgExportOptions);
        }
예제 #4
0
        internal static IList <string> optionname(Document doc)
        {
            IList <string> setupNames = BaseExportOptions.GetPredefinedSetupNames(doc);

            if (setupNames.Count == 0)
            {
                setupNames.Add("<in-session export setup>");
            }
            return(setupNames);
        }
예제 #5
0
        public static bool ExportDWG(Document document, Autodesk.Revit.DB.View view, string setupName, string fileName, string folder)
        {
            bool exported = false;
            // Get the predefined setups and use the one with the given name.
            IList <string> setupNames = BaseExportOptions.GetPredefinedSetupNames(document);

            foreach (string name in setupNames)
            {
                if (name.CompareTo(setupName) == 0)
                {
                    // Export using the predefined options
                    DWGExportOptions dwgOptions = DWGExportOptions.GetPredefinedOptions(document, name);
                    // Export the active view
                    ICollection <ElementId> views = new List <ElementId>();
                    views.Add(view.Id);
                    // The document has to be saved already, therefore it has a valid PathName.
                    exported = document.Export(folder, fileName, views, dwgOptions);
                    break;
                }
            }

            return(exported);
        }