Message 1 of 9
Not applicable
07-18-2011
08:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey, I am having a problem with a recursive file export which applies templates to views prior to exporting.
Not exactly certain why it's not working, but the first recursion of the view seems to always export a 12.0kb file with no contents, and for the second view it seems to export the view properly, but not actually apply the template, so each view is identical...
Here is my code:
Autodesk.Revit.DB.ViewSet NewViewSet = new Autodesk.Revit.DB.ViewSet();
switch (comboBox1.SelectedItem.ToString())
{
case "DWG":
foreach (Autodesk.Revit.DB.View view in ViewsToExport)
{
foreach (Autodesk.Revit.DB.View template in Templates)
{
Application.DoEvents();
FileName = textBox2.Text + "_" + textBox3.Text + "_" + "#VWRP#" + "_" + "#TMRP#" + "_" + textBox5.Text + "_" + textBox4.Text;
FileName = FileName.Replace("#VWRP#", view.ViewName);
FileName = FileName.Replace("#TMRP#", template.ViewName);
IList<Autodesk.Revit.DB.ElementId> ExportView = new List<Autodesk.Revit.DB.ElementId>();
Autodesk.Revit.DB.View NewView = view;
NewView.ApplyTemplate(template);
NewViewSet.Insert(NewView);
ExportView.Add(NewView.Id);
if (ComData.Application.ActiveUIDocument.Document.Export(textBox1.Text, FileName, ExportView, dwgExportOptions))
{
progressBar1.Value++;
continue;
}
else
{
MessageBox.Show("Exporting failed on...\nView: " + view.ViewName + "\nTemplate: " + template.ViewName);
break;
}
}
}
break;Any help or information regarding this method, or why my implementation of it is not working would be appreciated.
Thanks, Kurt 🙂
Solved! Go to Solution.