这是显示在 revit api 中获得的对象的执行方法,下面是有问题的代码。无法获得对文档或应用程序对象的引用,这是我从 ms visual stud 中的错误报告中收集到的。我试过添加一个全局参考,即。文件文件;与其他全局变量一起但是这并没有修改无参考错误。
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { //获取应用程序和文档对象 UIApplication uiApp = commandData.Application; UIDocument uiDoc = uiApp.ActiveUIDocument;
try
{
Application app = uiApp.Application;
Document doc = uiDoc.Document;
... rest of code not included
//mouse button click event
public void btn1_Click(object sender, EventArgs e)
{
//call to method using the Document doc revit api handle
MethodThatRequiresDoc(doc);
}
MethodThatRequiresDoc(Document doc);
{
//Call to copy and paste between docs new revit 2014 method
CopyPasteMassesBetweenDocs(doc, app);
}