예제 #1
0
 public ElementSet(string label, ICollection<Autodesk.Revit.DB.ElementId> val, Autodesk.Revit.DB.Document doc)
     : base(label)
 {
     m_val = new Autodesk.Revit.DB.ElementSet();
     foreach(Autodesk.Revit.DB.ElementId elemId in val)
     {
         if(Autodesk.Revit.DB.ElementId.InvalidElementId == elemId)
             continue;
         Autodesk.Revit.DB.Element elem = doc.GetElement(elemId);
         if(null != elem)
             m_val.Insert(elem);
     }
 }
예제 #2
0
        public Enumerable(string label, IEnumerable val, Autodesk.Revit.DB.Document doc)
            : base(label)
        {
            m_val = val;

            // iterate over the collection and put them in an ArrayList so we can pass on
            // to our Form
            if (m_val != null)
            {
                IEnumerator iter = m_val.GetEnumerator();
                while (iter.MoveNext())
                {
                    if (iter.Current is Autodesk.Revit.DB.ElementId)    // it's more useful for user to view element rather than element id.
                    {
                        Autodesk.Revit.DB.ElementId elemId = iter.Current as Autodesk.Revit.DB.ElementId;
                        m_objs.Add(doc.GetElement(elemId));
                    }
                    else
                        m_objs.Add(iter.Current);
                }
            }
        }
예제 #3
0
 /// <summary>
 /// Export Area Schemes.
 /// </summary>
 /// <param name="document">The Revit document.</param>
 /// <param name="exporterIFC">The exporterIFC class.</param>
 protected void ExportAreaSchemes(ExporterIFC exporterIFC, Autodesk.Revit.DB.Document document)
 {
     foreach (ElementId elementId in ExporterCacheManager.AreaSchemeCache.Keys)
     {
         Element element = document.GetElement(elementId);
         ExportElement(exporterIFC, element);
     }
 }
예제 #4
0
 /// <summary>
 /// Export BeamSystems.  These could be in assemblies, so do before assembly export, but after beams are exported.
 /// </summary>
 /// <param name="document">The Revit document.</param>
 /// <param name="exporterIFC">The exporterIFC class.</param>
 protected void ExportBeamSystems(ExporterIFC exporterIFC, Autodesk.Revit.DB.Document document)
 {
     foreach (ElementId elementId in ExporterCacheManager.BeamSystemCache)
     {
         Element element = document.GetElement(elementId);
         ExportElement(exporterIFC, element);
     }
 }
예제 #5
0
 /// <summary>
 /// Export FabricAreas cached during non-spatial element export.  
 /// We export whatever FabricAreas actually have handles as IfcGroup.
 /// </summary>
 /// <param name="document">The Revit document.</param>
 /// <param name="exporterIFC">The exporterIFC class.</param>
 protected void ExportCachedFabricAreas(ExporterIFC exporterIFC, Autodesk.Revit.DB.Document document)
 {
     foreach (ElementId elementId in ExporterCacheManager.FabricAreaHandleCache.Keys)
     {
         Element element = document.GetElement(elementId);
         ExportElement(exporterIFC, element);
     }
 }
예제 #6
0
 /// <summary>
 /// Export railings cached during spatial element export.  
 /// Railings are exported last as their containment is not known until all stairs have been exported.
 /// This is a very simple sorting, and further containment issues could require a more robust solution in the future.
 /// </summary>
 /// <param name="document">The Revit document.</param>
 /// <param name="exporterIFC">The exporterIFC class.</param>
 protected void ExportCachedRailings(ExporterIFC exporterIFC, Autodesk.Revit.DB.Document document)
 {
     foreach (ElementId elementId in ExporterCacheManager.RailingCache)
     {
         Element element = document.GetElement(elementId);
         ExportElement(exporterIFC, element);
     }
 }
예제 #7
0
파일: Exporter.cs 프로젝트: whztt07/BIM-IFC
        /// <summary>
        /// Implements the method that Autodesk Revit will invoke to perform an export to IFC.
        /// </summary>
        /// <param name="document">The document to export.</param>
        /// <param name="exporterIFC">The IFC exporter object.</param>
        /// <param name="filterView">The view whose filter visibility settings govern the export.</param>
        public void ExportIFC(Autodesk.Revit.DB.Document document, ExporterIFC exporterIFC, Autodesk.Revit.DB.View filterView)
        {
            try
            {
                // cache options
                ExportOptionsCache exportOptionsCache = ExportOptionsCache.Create(exporterIFC, filterView);
                ExporterCacheManager.ExportOptionsCache = exportOptionsCache;

                ElementFilteringUtil.InitCategoryVisibilityCache();
                
                //begin export
                BeginExport(exporterIFC, document);

                FilteredElementCollector spatialElementCollector;
                FilteredElementCollector otherElementCollector;
                ICollection<ElementId> idsToExport = exportOptionsCache.ElementsForExport;
                if (idsToExport.Count > 0)
                {
                    spatialElementCollector = new FilteredElementCollector(document, idsToExport);
                    otherElementCollector = new FilteredElementCollector(document, idsToExport);
                }
                else
                {
                    spatialElementCollector = (filterView == null) ?
                        new FilteredElementCollector(document) : new FilteredElementCollector(document, filterView.Id);
                    otherElementCollector = (filterView == null) ?
                        new FilteredElementCollector(document) : new FilteredElementCollector(document, filterView.Id);
                }

                bool spaceExported = true;
                if (exportOptionsCache.SpaceBoundaryLevel == 2)
                {
                    SpatialElementExporter.ExportSpatialElement2ndLevel(this, exporterIFC, document, filterView, ref spaceExported);
                }

                //export spatial element - none or 1st level room boundaries
                //  or create IFC Space only if 2nd level room boundaries export failed
                if (exportOptionsCache.SpaceBoundaryLevel == 0 || exportOptionsCache.SpaceBoundaryLevel == 1 || !spaceExported)
                {
                    SpatialElementExporter.InitializeSpatialElementGeometryCalculator(document, exporterIFC);
                    ElementFilter spatialElementFilter = ElementFilteringUtil.GetSpatialElementFilter(document, exporterIFC, filterView);
                    spatialElementCollector.WherePasses(spatialElementFilter);
                    foreach (Element element in spatialElementCollector)
                    {
                        ExportElement(exporterIFC, filterView, element);
                    }
                }

                //export other elements
                ElementFilter nonSpatialElementFilter = ElementFilteringUtil.GetNonSpatialElementFilter(document, exporterIFC, filterView);
                otherElementCollector.WherePasses(nonSpatialElementFilter);
                foreach (Element element in otherElementCollector)
                {
                    ExportElement(exporterIFC, filterView, element);
                }

                // Export railings cached above.  Railings are exported last as their containment is not known until all stairs have been exported.
                // This is a very simple sorting, and further containment issues could require a more robust solution in the future.
                foreach (ElementId elementId in ExporterCacheManager.RailingCache)
                {
                    Element element = document.GetElement(elementId);
                    ExportElement(exporterIFC, filterView, element);
                }

                ConnectorExporter.Export(exporterIFC);

                // end export
                EndExport(exporterIFC, document);
            }
            finally
            {
                ExporterCacheManager.Clear();

                if (m_Writer != null)
                    m_Writer.Close();

                if (m_IfcFile != null)
                {
                    m_IfcFile.Close();
                    m_IfcFile = null;
                }
            }
        }
예제 #8
0
 /// <summary>
 /// Export Zones.
 /// </summary>
 /// <param name="document">The Revit document.</param>
 /// <param name="exporterIFC">The exporterIFC class.</param>
 protected void ExportZones(ExporterIFC exporterIFC, Autodesk.Revit.DB.Document document)
 {
     HashSet<ElementId> zoneCollection = ExporterCacheManager.ZoneCache;
     int zoneIndex = 1;
  int zoneCollectionCount = zoneCollection.Count;
     foreach (ElementId elementId in ExporterCacheManager.ZoneCache)
     {
     statusBar.Set(String.Format(Resources.IFCProcessingExportZones, zoneIndex, zoneCollectionCount, elementId));
     zoneIndex++;
         Element element = document.GetElement(elementId);
         ExportElement(exporterIFC, element);
     }
 }
예제 #9
0
 /// <summary>
 /// Export BeamSystems.  These could be in assemblies, so do before assembly export, but after beams are exported.
 /// </summary>
 /// <param name="document">The Revit document.</param>
 /// <param name="exporterIFC">The exporterIFC class.</param>
 protected void ExportBeamSystems(ExporterIFC exporterIFC, Autodesk.Revit.DB.Document document)
 {
    HashSet<ElementId> beamSystemCollection = ExporterCacheManager.BeamSystemCache;
    int beamSystemIndex = 1;
  int beamSystemCollectionCount = beamSystemCollection.Count;
     foreach (ElementId elementId in ExporterCacheManager.BeamSystemCache)
     {
     statusBar.Set(String.Format(Resources.IFCProcessingBeamSystems, beamSystemIndex, beamSystemCollectionCount, elementId));
        beamSystemIndex++;
         Element element = document.GetElement(elementId);
         ExportElement(exporterIFC, element);
     }
 }
예제 #10
0
 /// <summary>
 /// Export FabricAreas cached during non-spatial element export.  
 /// We export whatever FabricAreas actually have handles as IfcGroup.
 /// </summary>
 /// <param name="document">The Revit document.</param>
 /// <param name="exporterIFC">The exporterIFC class.</param>
 protected void ExportCachedFabricAreas(ExporterIFC exporterIFC, Autodesk.Revit.DB.Document document)
 {
    IDictionary<ElementId, HashSet<IFCAnyHandle>> fabricAreaCollection = ExporterCacheManager.FabricAreaHandleCache;
    int fabricAreaIndex = 1;
  int fabricAreaCollectionCount = fabricAreaCollection.Count;
     foreach (ElementId elementId in ExporterCacheManager.FabricAreaHandleCache.Keys)
     {
     statusBar.Set(String.Format(Resources.IFCProcessingFabricAreas, fabricAreaIndex, fabricAreaCollectionCount, elementId));
         fabricAreaIndex++;
         Element element = document.GetElement(elementId);
         ExportElement(exporterIFC, element);
     }
 }
예제 #11
0
 /// <summary>
 /// Export railings cached during spatial element export.  
 /// Railings are exported last as their containment is not known until all stairs have been exported.
 /// This is a very simple sorting, and further containment issues could require a more robust solution in the future.
 /// </summary>
 /// <param name="document">The Revit document.</param>
 /// <param name="exporterIFC">The exporterIFC class.</param>
 protected void ExportCachedRailings(ExporterIFC exporterIFC, Autodesk.Revit.DB.Document document)
 {
     HashSet<ElementId> railingCollection = ExporterCacheManager.RailingCache;
     int railingIndex = 1;
  int railingCollectionCount = railingCollection.Count;
     foreach (ElementId elementId in ExporterCacheManager.RailingCache)
     {
     statusBar.Set(String.Format(Resources.IFCProcessingRailings, railingIndex, railingCollectionCount, elementId));
         railingIndex++;
         Element element = document.GetElement(elementId);
         ExportElement(exporterIFC, element);
     }
 }