简体   繁体   English

读取和导出使用c#api计划多个revit文件

[英]read and export schedules multiple revit file using c# api

I have 150 revit files in a folder. 我在一个文件夹中有150个revit文件。 I want to write c# console application that export schedules for each revit files in the folder. 我想编写c#console应用程序,为文件夹中的每个revit文件导出计划。

I found some samples in the forums, but I couldnt make it work. 我在论坛中发现了一些样本,但我无法让它发挥作用。

 public void Plot(string[] files)
        {
            ExternalCommandData commandData;
            UIApplication uiApplication = commandData.Application;

            foreach (string file in files)
            {
                Document document = uiApplication.OpenAndActivateDocument(@"C:\solar.rvt").Document;

            }
        }

Yes. 是。

You cannot make it work like that. 你无法让它像那样工作。

You cannot drive Revit from outside just like that. 你无法像这样从外面驾驶Revit。

You can, however, use Idling and External Events for Modeless Access and Driving Revit from Outside . 但是,您可以使用空闲和外部事件进行无模式访问和从外部驱动Revit

However, for the scenario you describe, the easiest solution will be to write a simple external command and launch that from inside Revit to drive the required functionality. 但是,对于您描述的场景,最简单的解决方案是编写一个简单的外部命令,并从Revit内部启动它以驱动所需的功能。 Modal, not modeless. 莫代尔,不是无模式的。

Implementing an external command is easy and covered in full right at the beginning of the material on getting started with the Revit API . 开始使用Revit API时 ,在材料的开头部分可以轻松实现外部命令。

Furthermore, you are in luck, because the functionality you describe is implemented by an existing sample described by The Building Coder in The Schedule API and Access to Schedule Data . 此外,您很幸运,因为您描述的功能是由建筑编码器在Schedule API和访问计划数据中描述的现有样本实现的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM