ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

Revit Api打印当前项目的所有的可打印视图

2026/8/7 20:06:43 拓冰建站 浏览量
Revit Api打印当前项目的所有的可打印视图

Revit Api打印当前项目的所有的可打印视图

打印当前文档中的可打印视图

public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
{Document doc = commandData.Application.ActiveUIDocument.Document;FilteredElementCollector collector = new FilteredElementCollector(doc).OfClass(typeof(ViewPlan));IList<Element> viewElems = collector.ToElements();ViewSet printableViews = new ViewSet();// 找出全部可打印视图foreach (View view in viewElems){if (!view.IsTemplate && view.CanBePrinted){printableViews.Insert(view);}}PrintManager pm = doc.PrintManager;pm.PrintRange = PrintRange.Select;pm.SelectNewPrintDriver(@"\\server\printer01");pm.Apply();// 打印全部可打印视图doc.Print(printableViews);return IAsyncResult.Succeeded;
}