Revit文件導出二維視圖(view2D)

不廢話,直接上源代碼。

如果有設置了二維視圖的生成設置,請添加setupName進行過濾。如果沒有,請直接按第一個設置選項導出。

        private bool ExportDWGF(Document document,View view,string setupName)
        {
            bool exported = false;
            IList<string> setupNames = BaseExportOptions.GetPredefinedSetupNames(document);
            foreach(string name in setupNames)
            {
               // if(name.CompareTo(setupName)==0)
               // {               
                    DWGExportOptions dwgOptions = DWGExportOptions.GetPredefinedOptions(document, name);
                    ICollection<ElementId> views = new List<ElementId>();
                    views.Add(view.Id);
                    exported = document.Export(Path.GetDirectoryName(document.PathName), Path.GetFileNameWithoutExtension(document.PathName),
                        views, dwgOptions);
                    break;
            //    }
            }
            return exported;
        }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章