/// <summary> /// Collect the parameters and export /// </summary> /// <returns></returns> public override bool Export() { base.Export(); bool exported = false; //parameter : views IList <ElementId> views = new List <ElementId>(); if (m_currentViewOnly) { views.Add(m_activeDoc.ActiveView.Id); } else { foreach (Autodesk.Revit.DB.View view in m_selectViewsData.SelectedViews) { views.Add(view.Id); } } // Default values m_exportFileVersion = ACADVersion.R2010; //parameter : DXFExportOptions dxfExportOptions DXFExportOptions dxfExportOptions = new DXFExportOptions(); dxfExportOptions.ExportingAreas = m_exportOptionsData.ExportAreas; dxfExportOptions.ExportOfSolids = m_exportOptionsData.ExportSolid; dxfExportOptions.FileVersion = m_exportFileVersion; dxfExportOptions.LayerMapping = m_exportOptionsData.ExportLayerMapping; dxfExportOptions.LineScaling = m_exportOptionsData.ExportLineScaling; //dxfExportOptions.MergedViews = m_exportOptionsData.ExportMergeFiles; dxfExportOptions.PropOverrides = m_exportOptionsData.ExportLayersAndProperties; dxfExportOptions.SharedCoords = m_exportOptionsData.ExportCoorSystem; dxfExportOptions.TargetUnit = m_exportOptionsData.ExportUnit; //Export exported = m_activeDoc.Export(m_exportFolder, m_exportFileName, views, dxfExportOptions); return(exported); }
private static void ViewToDxf(UIApplication uiapp, string source_path, string target_folder) { Application app = uiapp.Application; //copy from server string moved_path = FileManager.MoveAndRecord(source_path); moved_path = ReviFileManager.saveNewCentral(app, source_path, moved_path); //open and activate UIDocument uidoc = uiapp.OpenAndActivateDocument(moved_path); Document doc = uidoc.Document; //uiapp.DialogBoxShowing += new EventHandler<DialogBoxShowingEventArgs>(OnDialogBoxShowing); DXFExportOptions opt = new DXFExportOptions(); var dwgSettingsFilter = new ElementClassFilter(typeof(ExportDWGSettings)); var fc = new FilteredElementCollector(doc) .WherePasses(dwgSettingsFilter); foreach (ExportDWGSettings element in fc) { var options = element.GetDWGExportOptions(); var layerTable = options.GetExportLayerTable(); foreach (var layerItem in layerTable) { var layerInfo = layerItem.Value; //layerItem. if (layerInfo.CategoryType == LayerCategoryType.Model) { layerInfo.ClearCutLayerModifiers(); // layerInfo.LayerName = var modifiers = layerInfo.GetLayerModifiers(); foreach (var modifier in modifiers) { // get modifier type var modifierType = modifier.ModifierType; // get separator var separater = modifier.Separator; } } } } //string filename; using (Transaction tx = new Transaction(doc)) { tx.Start("Transaction Name"); // foreach (ElementId id in ids) // { // Element e = doc.GetElement(id); // . . . // view.IsolateElementTemporary(partId); // doc.Export(target_folder, filename, viewIds, opt); // } // We do not commit the transaction, because // we do not want any modifications saved. // The transaction is only created and started // because it is required by the // IsolateElementTemporary method. // Since the transaction is not committed, // the changes are automatically discarded. tx.Commit(); } }
/// <summary> /// Collect the parameters and export /// </summary> /// <returns></returns> public override bool Export() { base.Export(); bool exported = false; //parameter : views IList<ElementId> views = new List<ElementId>(); if (m_currentViewOnly) { views.Add(m_activeDoc.ActiveView.Id); } else { foreach (Autodesk.Revit.DB.View view in m_selectViewsData.SelectedViews) { views.Add(view.Id); } } // Default values m_exportFileVersion = ACADVersion.R2010; //parameter : DXFExportOptions dxfExportOptions DXFExportOptions dxfExportOptions = new DXFExportOptions(); dxfExportOptions.ExportingAreas = m_exportOptionsData.ExportAreas; dxfExportOptions.ExportOfSolids = m_exportOptionsData.ExportSolid; dxfExportOptions.FileVersion = m_exportFileVersion; dxfExportOptions.LayerMapping = m_exportOptionsData.ExportLayerMapping; dxfExportOptions.LineScaling = m_exportOptionsData.ExportLineScaling; //dxfExportOptions.MergedViews = m_exportOptionsData.ExportMergeFiles; dxfExportOptions.PropOverrides = m_exportOptionsData.ExportLayersAndProperties; dxfExportOptions.SharedCoords = m_exportOptionsData.ExportCoorSystem; dxfExportOptions.TargetUnit = m_exportOptionsData.ExportUnit; //Export exported = m_activeDoc.Export(m_exportFolder, m_exportFileName, views, dxfExportOptions); return exported; }