Revit怎么导出其他文件格式
这篇文章主要介绍“Revit怎么导出其他文件格式”,在日常操作中,相信很多人在Revit怎么导出其他文件格式问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Revit怎么导出其他文件格式”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
创新互联建站专注于企业营销型网站建设、网站重做改版、茅箭网站定制设计、自适应品牌网站建设、H5场景定制、商城网站建设、集团公司官网建设、成都外贸网站制作、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为茅箭等各大城市提供网站开发制作服务。
Revit 可以导出多种其他文件格式,比如:DWG,DWF,IFC,NWC等等,主要通过API:doc.Export()方法.
实例代码:
public class ExportToOtherCommand : IExternalCommand { public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiapp = commandData.Application; UIDocument uidoc = uiapp.ActiveUIDocument; Document doc = uidoc.Document; string projectName = Path.GetFileNameWithoutExtension(doc.PathName); string viewName = doc.ActiveView.Name; ////导出Dwf //using (Transaction trans = new Transaction(doc, "Export to Dwf file")) //{ // trans.Start(); // ExportToDWF(doc, $"D:\\Shared\\{projectName}_{viewName}.dwf"); // trans.Commit(); //} ////导出Nwc //ExportToNwc(doc, $"D:\\Shared\\{projectName}_{viewName}.nwc"); ExportToDwg(doc, $"D:\\Shared\\{projectName}_{viewName}.dwg",false); return Result.Succeeded; } ////// 导出Nwc文件,不需要开启事务 /// /// /// public void ExportToNwc(Document document, string pathFullName) { NavisworksExportOptions nweOptions = new NavisworksExportOptions(); nweOptions.ExportScope = NavisworksExportScope.Model; nweOptions.ViewId = document.ActiveView.Id; //导出是否包括链接模型 nweOptions.ExportLinks = true; //判断是否安装了Navisworks bool isExporterAvailable = OptionalFunctionalityUtils.IsNavisworksExporterAvailable(); if (isExporterAvailable) { string folder = Path.GetDirectoryName(pathFullName); string name = Path.GetFileNameWithoutExtension(pathFullName); document.Export(folder, name, nweOptions); } else { TaskDialog.Show("tip", "导出失败!没有安装Navisworks"); } } ////// 导出dwf , 导出需要开启事务 /// /// /// /// public void ExportToDWF(Document document, string pathFullName, bool isActiveView = true) { FilteredElementCollector collector = new FilteredElementCollector(document); collector.OfClass(typeof(View)).OfCategory(BuiltInCategory.OST_Views); DWFExportOptions dwfOptions = new DWFExportOptions { CropBoxVisible = true, ExportingAreas = true, ExportTexture = false }; ViewSet views = new ViewSet(); if (isActiveView) { views.Insert(document.ActiveView); } else { //多个视图 foreach (View view in collector.ToElements()) { if (view.CanBePrinted) { views.Insert(view); } } } string folder = Path.GetDirectoryName(pathFullName); string name = Path.GetFileNameWithoutExtension(pathFullName); document.Export(folder,name, views, dwfOptions); } public void ExportToDwg(Document document, string pathFullName, bool isActiveView = true) { FilteredElementCollector collector = new FilteredElementCollector(document); collector.OfClass(typeof(View)).OfCategory(BuiltInCategory.OST_Views); DWGExportOptions dwgOptions = new DWGExportOptions { FileVersion = ACADVersion.R2010, }; string folder = Path.GetDirectoryName(pathFullName); string name = Path.GetFileNameWithoutExtension(pathFullName); ListviewIds = new List (); if (isActiveView) { viewIds.Add(document.ActiveView.Id); } else { //多个视图 foreach (View view in collector.ToElements()) { if (view.CanBePrinted) { viewIds.Add(view.Id); } } } document.Export(folder, name, viewIds, dwgOptions); } }
到此,关于“Revit怎么导出其他文件格式”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注创新互联网站,小编会继续努力为大家带来更多实用的文章!
当前名称:Revit怎么导出其他文件格式
网页网址:http://ybzwz.com/article/pshhsi.html