In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how to export other file formats from Revit". In daily operation, I believe many people have doubts about how to export other file formats from Revit. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "how to export other file formats by Revit". Next, please follow the editor to study!
Revit can export a variety of other file formats, such as DWG,DWF,IFC,NWC, etc., mainly through the API:doc.Export () method.
Example code:
Public class ExportToOtherCommand: IExternalCommand {public Result Execute (ExternalCommandData commandData, ref string message, ElementSet elements) {UIApplication uiapp = commandData.Application; UIDocument uidoc = uiapp.ActiveUIDocument; Document doc = uidoc.Document; string projectName = Path.GetFileNameWithoutExtension (doc.PathName); string viewName = doc.ActiveView.Name / Export Dwf / / using (Transaction trans = new Transaction (doc, "Export to Dwf file")) / / {/ / trans.Start (); / / ExportToDWF (doc, $"D:\\ Shared\\ {projectName} _ {viewName} .dwf"); / / trans.Commit () / / Export Nwc / / ExportToNwc (doc, $"D:\\ Shared\\ {projectName} _ {viewName} .nwc"); ExportToDwg (doc, $"D:\\ Shared\\ {projectName} _ {viewName} .dwg", false); return Result.Succeeded } / Export Nwc file without opening transaction / public void ExportToNwc (Document document, string pathFullName) {NavisworksExportOptions nweOptions = new NavisworksExportOptions (); nweOptions.ExportScope = NavisworksExportScope.Model; nweOptions.ViewId = document.ActiveView.Id / / whether the export includes a linked model nweOptions.ExportLinks = true; / / determine whether Navisworks bool isExporterAvailable = OptionalFunctionalityUtils.IsNavisworksExporterAvailable () is installed; if (isExporterAvailable) {string folder = Path.GetDirectoryName (pathFullName); string name = Path.GetFileNameWithoutExtension (pathFullName); document.Export (folder, name, nweOptions) } else {TaskDialog.Show ("tip", "Export failed! Navisworks ");}} / Export dwf is not installed. Export requires opening transaction / public void ExportToDWF (Document document, string pathFullName, bool isActiveView = true) {FilteredElementCollector collector = new FilteredElementCollector (document) Collector.OfClass (typeof (View)) .OfCategory (BuiltInCategory.OST_Views); DWFExportOptions dwfOptions = new DWFExportOptions {CropBoxVisible = true, ExportingAreas = true, ExportTexture = false}; ViewSet views = new ViewSet () If (isActiveView) {views.Insert (document.ActiveView) } else {/ / multiple views foreach (View view in collector.ToElements ()) {if (view.CanBePrinted) {views.Insert (view) } string folder = Path.GetDirectoryName (pathFullName); string name = Path.GetFileNameWithoutExtension (pathFullName); document.Export (folder,name, views, dwfOptions);} public void ExportToDwg (Document document, string pathFullName, bool isActiveView = true) {FilteredElementCollector collector = new FilteredElementCollector (document) Collector.OfClass (typeof (View)) .OfCategory (BuiltInCategory.OST_Views); DWGExportOptions dwgOptions = new DWGExportOptions {FileVersion = ACADVersion.R2010,}; string folder = Path.GetDirectoryName (pathFullName); string name = Path.GetFileNameWithoutExtension (pathFullName); List viewIds = new List () If (isActiveView) {viewIds.Add (document.ActiveView.Id) } else {/ / multiple views foreach (View view in collector.ToElements ()) {if (view.CanBePrinted) {viewIds.Add (view.Id) } document.Export (folder, name, viewIds, dwgOptions);}} at this point, the study on "how to export other file formats by Revit" is over. I hope I can solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.