网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

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);

            List viewIds = 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://bjjierui.cn/article/pshhsi.html

其他资讯