This is the execute method to show the objects obtained in the revit api, following that is the code in question. The reference to the document or application objects cant be obtained, this is what I have gleaned from the error report in ms visual stud. I have tried adding a global reference ie. Document doc; in with the other global variables however this didn't amend the no reference error.
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { //Get application and document objects 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);
}