本文整理汇总了C#中ExporterIFC.PopExportState方法的典型用法代码示例。如果您正苦于以下问题:C# ExporterIFC.PopExportState方法的具体用法?C# ExporterIFC.PopExportState怎么用?C# ExporterIFC.PopExportState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExporterIFC
的用法示例。
在下文中一共展示了ExporterIFC.PopExportState方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportSpatialElement2ndLevel
//.........这里部分代码省略.........
try
{
model = EnergyAnalysisDetailModel.Create(document, options);
}
catch (System.Exception)
{
return exportedSpaceIds;
}
IList<EnergyAnalysisSpace> spaces = model.GetAnalyticalSpaces();
foreach (EnergyAnalysisSpace space in spaces)
{
SpatialElement spatialElement = document.GetElement(space.CADObjectUniqueId) as SpatialElement;
if (spatialElement == null)
continue;
//current view only
if (!ElementFilteringUtil.IsElementVisible(spatialElement))
continue;
if (!ElementFilteringUtil.ShouldElementBeExported(exporterIFC, spatialElement, false))
continue;
if (ElementFilteringUtil.IsRoomInInvalidPhase(spatialElement))
continue;
Options geomOptions = GeometryUtil.GetIFCExportGeometryOptions();
View ownerView = spatialElement.Document.GetElement(spatialElement.OwnerViewId) as View;
if (ownerView != null)
geomOptions.View = ownerView;
GeometryElement geomElem = spatialElement.get_Geometry(geomOptions);
try
{
exporterIFC.PushExportState(spatialElement, geomElem);
using (ProductWrapper productWrapper = ProductWrapper.Create(exporterIFC, true))
{
using (PlacementSetter setter = PlacementSetter.Create(exporterIFC, spatialElement))
{
// We won't use the SpatialElementGeometryResults, as these are 1st level boundaries, not 2nd level.
SpatialElementGeometryResults results = null;
if (!CreateIFCSpace(exporterIFC, spatialElement, productWrapper, setter, out results))
continue;
exportedSpaceIds.Add(spatialElement.Id);
XYZ offset = GetSpaceBoundaryOffset(setter);
//get boundary information from surfaces
IList<EnergyAnalysisSurface> surfaces = space.GetAnalyticalSurfaces();
foreach (EnergyAnalysisSurface surface in surfaces)
{
Element boundingElement = GetBoundaryElement(document, surface.CADLinkUniqueId, surface.CADObjectUniqueId);
IList<EnergyAnalysisOpening> openings = surface.GetAnalyticalOpenings();
IFCAnyHandle connectionGeometry = CreateConnectionSurfaceGeometry(exporterIFC, surface, openings, offset);
CreateIFCSpaceBoundary(file, exporterIFC, spatialElement, boundingElement, setter.LevelId, connectionGeometry);
// try to add doors and windows for host objects if appropriate.
if (boundingElement is HostObject)
{
foreach (EnergyAnalysisOpening opening in openings)
{
Element openingBoundingElem = GetBoundaryElement(document, opening.CADLinkUniqueId, opening.CADObjectUniqueId);
IFCAnyHandle openingConnectionGeom = CreateConnectionSurfaceGeometry(exporterIFC, opening, offset);
CreateIFCSpaceBoundary(file, exporterIFC, spatialElement, openingBoundingElem, setter.LevelId, openingConnectionGeom);
}
}
}
CreateZoneInfos(exporterIFC, file, spatialElement, productWrapper);
CreateSpaceOccupantInfo(exporterIFC, file, spatialElement, productWrapper);
ExporterUtil.ExportRelatedProperties(exporterIFC, spatialElement, productWrapper);
}
}
}
catch (Exception ex)
{
ifcExporter.HandleUnexpectedException(ex, exporterIFC, spatialElement);
}
finally
{
exporterIFC.PopExportState();
}
}
transaction.Commit();
}
}
finally
{
if (model != null)
EnergyAnalysisDetailModel.Destroy(model);
}
st.RollBack();
return exportedSpaceIds;
}
}
示例2: ExportElementImpl
//.........这里部分代码省略.........
}
else if (element is Railing)
{
if (ExporterCacheManager.RailingCache.Contains(element.Id))
RailingExporter.ExportRailingElement(exporterIFC, element as Railing, productWrapper);
else
{
ExporterCacheManager.RailingCache.Add(element.Id);
RailingExporter.AddSubElementsToCache(element as Railing);
shouldPreserveParameterCache = true;
}
}
else if (RampExporter.IsRamp(element))
{
RampExporter.Export(exporterIFC, element, geomElem, productWrapper);
}
else if (element is RoofBase)
{
RoofBase roofElement = element as RoofBase;
RoofExporter.Export(exporterIFC, roofElement, geomElem, productWrapper);
}
else if (element is SpatialElement)
{
SpatialElement spatialElem = element as SpatialElement;
SpatialElementExporter.ExportSpatialElement(exporterIFC, spatialElem, productWrapper);
}
else if (IsStairs(element))
{
StairsExporter.Export(exporterIFC, element, geomElem, productWrapper);
}
else if (element is TextNote)
{
TextNote textNote = element as TextNote;
TextNoteExporter.Export(exporterIFC, textNote, productWrapper);
}
else if (element is TopographySurface)
{
TopographySurface topSurface = element as TopographySurface;
SiteExporter.ExportTopographySurface(exporterIFC, topSurface, geomElem, productWrapper);
}
else if (element is Truss)
{
if (ExporterCacheManager.TrussCache.Contains(element.Id))
AssemblyInstanceExporter.ExportTrussElement(exporterIFC, element as Truss, productWrapper);
else
{
ExporterCacheManager.TrussCache.Add(element.Id);
shouldPreserveParameterCache = true;
}
}
else if (element is Wall)
{
Wall wallElem = element as Wall;
WallExporter.Export(exporterIFC, wallElem, geomElem, productWrapper);
}
else if (element is WallSweep)
{
WallSweep wallSweep = element as WallSweep;
WallSweepExporter.Export(exporterIFC, wallSweep, geomElem, productWrapper);
}
else if (element is Zone)
{
if (ExporterCacheManager.ZoneCache.Contains(element.Id))
ZoneExporter.ExportZone(exporterIFC, element as Zone, productWrapper);
else
{
ExporterCacheManager.ZoneCache.Add(element.Id);
shouldPreserveParameterCache = true;
}
}
else
{
string ifcEnumType;
IFCExportType exportType = ExporterUtil.GetExportType(exporterIFC, element, out ifcEnumType);
bool exported = false;
if (IsMEPType(exporterIFC, element, exportType))
exported = GenericMEPExporter.Export(exporterIFC, element, geomElem, exportType, ifcEnumType, productWrapper);
else if (ExportAsProxy(element, exportType))
exported = ProxyElementExporter.Export(exporterIFC, element, geomElem, productWrapper);
// For ducts and pipes, we will add a IfcRelCoversBldgElements during the end of export.
if (exported && (element is Duct || element is Pipe))
ExporterCacheManager.MEPCache.CoveredElementsCache.Add(element.Id);
}
if (element.AssemblyInstanceId != ElementId.InvalidElementId)
ExporterCacheManager.AssemblyInstanceCache.RegisterElements(element.AssemblyInstanceId, productWrapper);
if (element.GroupId != ElementId.InvalidElementId)
ExporterCacheManager.GroupCache.RegisterElements(element.GroupId, productWrapper);
st.RollBack();
}
}
finally
{
exporterIFC.PopExportState();
ExporterStateManager.PreserveElementParameterCache(element, shouldPreserveParameterCache);
}
}
示例3: ExportSpatialElement2ndLevel
//.........这里部分代码省略.........
spaceExported = false;
return;
}
IList<EnergyAnalysisSpace> spaces = model.GetAnalyticalSpaces();
spaceExported = true;
foreach (EnergyAnalysisSpace space in spaces)
{
SpatialElement spatialElement = document.GetElement(space.SpatialElementId) as SpatialElement;
if (spatialElement == null)
continue;
//quick reject
bool isArea = spatialElement is Area;
if (isArea)
{
if (!IsAreaGrossInterior(exporterIFC, spatialElement))
continue;
}
//current view only
if (filterView != null && !ElementFilteringUtil.IsElementVisible(filterView, spatialElement))
continue;
//
if (!ElementFilteringUtil.ShouldCategoryBeExported(exporterIFC, spatialElement))
continue;
Options geomOptions = GeometryUtil.GetIFCExportGeometryOptions();
View ownerView = spatialElement.Document.GetElement(spatialElement.OwnerViewId) as View;
if (ownerView != null)
geomOptions.View = ownerView;
GeometryElement geomElem = spatialElement.get_Geometry(geomOptions);
try
{
exporterIFC.PushExportState(spatialElement, geomElem);
using (ProductWrapper productWrapper = ProductWrapper.Create(exporterIFC, true))
{
ElementId levelId = spatialElement.Level != null ? spatialElement.Level.Id : ElementId.InvalidElementId;
using (IFCPlacementSetter setter = IFCPlacementSetter.Create(exporterIFC, spatialElement, null, null, levelId))
{
if (!CreateIFCSpace(exporterIFC, spatialElement, productWrapper, setter))
continue;
XYZ offset = GetSapceBoundaryOffset(setter);
//get boundary information from surfaces
IList<EnergyAnalysisSurface> surfaces = space.GetAnalyticalSurfaces();
foreach (EnergyAnalysisSurface surface in surfaces)
{
Element boundingElement = GetBoundaryElement(document, surface.OriginatingElementId);
IList<EnergyAnalysisOpening> openings = surface.GetAnalyticalOpenings();
IFCAnyHandle connectionGeometry = CreateConnectionSurfaceGeometry(file, surface, openings, offset);
CreateIFCSpaceBoundary(file, exporterIFC, spatialElement, boundingElement, setter.LevelId, connectionGeometry);
// try to add doors and windows for host objects if appropriate.
if (boundingElement is HostObject)
{
foreach (EnergyAnalysisOpening opening in openings)
{
Element openingBoundingElem = GetBoundaryElement(document, opening.OriginatingElementId);
IFCAnyHandle openingConnectionGeom = CreateConnectionSurfaceGeometry(file, opening, offset);
CreateIFCSpaceBoundary(file, exporterIFC, spatialElement, openingBoundingElem, setter.LevelId, openingConnectionGeom);
}
}
}
PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, spatialElement, productWrapper);
CreateZoneInfos(exporterIFC, file, spatialElement, productWrapper);
CreateSpaceOccupantInfo(exporterIFC, file, spatialElement, productWrapper);
ifcExporter.ExportElementProperties(exporterIFC, spatialElement, productWrapper);
ifcExporter.ExportElementQuantities(exporterIFC, spatialElement, productWrapper);
}
}
}
catch (Exception ex)
{
ifcExporter.HandleUnexpectedException(ex, exporterIFC, spatialElement);
}
finally
{
exporterIFC.PopExportState();
}
}
transaction.Commit();
}
}
finally
{
if (model != null)
EnergyAnalysisDetailModel.Destroy(model);
}
st.RollBack();
}
}
示例4: ExportSpatialElement2ndLevel
//.........这里部分代码省略.........
continue;
}
//get boundary information from surfaces
IList<EnergyAnalysisSurface> surfaces = space.GetAnalyticalSurfaces();
foreach (EnergyAnalysisSurface surface in surfaces)
{
Element boundingElement = GetBoundaryElement(document, surface.OriginatingElementId);
if (boundingElement == null)
continue;
IList<EnergyAnalysisOpening> openings = surface.GetAnalyticalOpenings();
IFCAnyHandle connectionGeometry = CreateConnectionSurfaceGeometry(file, surface, openings);
CreateIFCSpaceBoundary(file, exporterIFC, spatialElement, boundingElement, connectionGeometry);
// try to add doors and windows for host objects if appropriate.
if (boundingElement is HostObject)
{
foreach (EnergyAnalysisOpening opening in openings)
{
Element openingBoundingElem = GetBoundaryElement(document, opening.OriginatingElementId);
IFCAnyHandle openingConnectionGeom = CreateConnectionSurfaceGeometry(file, opening);
CreateIFCSpaceBoundary(file, exporterIFC, spatialElement, openingBoundingElem, openingConnectionGeom);
}
}
}
ExporterIFCUtils.CreateSpatialElementPropertySet(exporterIFC, spatialElement, productWrapper);
ifcExporter.ExportElementProperties(exporterIFC, spatialElement, productWrapper);
ifcExporter.ExportElementQuantities(exporterIFC, spatialElement, productWrapper);
}
}
}
finally
{
exporterIFC.PopExportState();
}
}
tr.Commit();
}
}
catch (System.Exception ex)
{
document.Application.WriteJournalComment("IFC error: " + ex.ToString(), true);
}
finally
{
if (model != null)
EnergyAnalysisDetailModel.Destroy(model);
}
//if failed, just export the space element
if (createEnergyAnalysisDetailModelFailed)
{
IFCFile file = exporterIFC.GetFile();
using (IFCTransaction tr = new IFCTransaction(file))
{
ElementFilter spatialElementFilter = ElementFilteringUtil.GetSpatialElementFilter(document, exporterIFC);
FilteredElementCollector collector = (filterView == null) ? new FilteredElementCollector(document) : new FilteredElementCollector(document, filterView.Id);
collector.WherePasses(spatialElementFilter);
foreach (Element elem in collector)
{
SpatialElement spatialElement = elem as SpatialElement;
if (spatialElement == null)
continue;
//current view only
示例5: ExportElementImpl
//.........这里部分代码省略.........
else if (element is Part)
{
Part part = element as Part;
if (ExporterCacheManager.ExportOptionsCache.ExportPartsAsBuildingElements)
PartExporter.ExportPartAsBuildingElement(exporterIFC, part, geomElem, productWrapper);
else
PartExporter.ExportStandalonePart(exporterIFC, part, geomElem, productWrapper);
}
else if (element is Railing)
{
if (ExporterCacheManager.RailingCache.Contains(element.Id))
RailingExporter.ExportRailingElement(exporterIFC, element as Railing, productWrapper);
else
{
ExporterCacheManager.RailingCache.Add(element.Id);
RailingExporter.AddSubElementsToCache(element as Railing);
}
}
else if (RampExporter.IsRamp(element))
{
RampExporter.Export(exporterIFC, element, geomElem, productWrapper);
}
else if (element is Rebar || element is AreaReinforcement || element is PathReinforcement)
{
RebarExporter.Export(exporterIFC, element, filterView, productWrapper);
}
else if (element is SpatialElement)
{
SpatialElement spatialElem = element as SpatialElement;
SpatialElementExporter.ExportSpatialElement(exporterIFC, spatialElem, productWrapper);
}
else if (IsStairs(element))
{
StairsExporter.Export(exporterIFC, element, geomElem, productWrapper);
}
else if (element is TextNote)
{
TextNote textNote = element as TextNote;
TextNoteExporter.Export(exporterIFC, textNote, productWrapper);
}
else if (element is TopographySurface)
{
TopographySurface topSurface = element as TopographySurface;
SiteExporter.ExportTopographySurface(exporterIFC, topSurface, geomElem, productWrapper);
}
else if (element is Wall)
{
Wall wallElem = element as Wall;
WallExporter.Export(exporterIFC, wallElem, geomElem, productWrapper);
}
else if (element is FaceWall)
{
WallExporter.ExportWall(exporterIFC, element, geomElem, productWrapper);
}
else if (element is WallSweep)
{
WallSweep wallSweep = element as WallSweep;
WallSweepExporter.Export(exporterIFC, wallSweep, geomElem, productWrapper);
}
else if (element is RoofBase)
{
RoofBase roofElement = element as RoofBase;
RoofExporter.Export(exporterIFC, roofElement, geomElem, productWrapper);
}
else if (element is CurtainSystem)
{
CurtainSystem curtainSystem = element as CurtainSystem;
CurtainSystemExporter.ExportCurtainSystem(exporterIFC, curtainSystem, productWrapper);
}
else if (CurtainSystemExporter.IsLegacyCurtainElement(element))
{
CurtainSystemExporter.ExportLegacyCurtainElement(exporterIFC, element, productWrapper);
PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, element, productWrapper);
}
else
{
string ifcEnumType;
IFCExportType exportType = ExporterUtil.GetExportType(exporterIFC, element, out ifcEnumType);
if (IsMEPType(exporterIFC, element, exportType))
{
GenericMEPExporter.Export(exporterIFC, element, geomElem, productWrapper);
}
else if (ExportAsProxy(element, exportType))
{
ProxyElementExporter.Export(exporterIFC, element, geomElem, productWrapper);
}
}
if (element.AssemblyInstanceId != ElementId.InvalidElementId)
ExporterCacheManager.AssemblyInstanceCache.RegisterElements(element.AssemblyInstanceId, productWrapper);
st.RollBack();
}
}
finally
{
exporterIFC.PopExportState();
}
}
示例6: ExportElementImpl
/// <summary>
/// Implements the export of element.
/// </summary>
/// <param name="exporterIFC">The IFC exporter object.</param>
/// <param name="element ">The element to export.</param>
/// <param name="productWrapper">The IFCProductWrapper object.</param>
private void ExportElementImpl(ExporterIFC exporterIFC, Element element, IFCProductWrapper productWrapper)
{
Options options = new Options();
View ownerView = element.Document.get_Element(element.OwnerViewId) as View;
if (ownerView != null)
options.View = ownerView;
GeometryElement geomElem = element.get_Geometry(options);
try
{
exporterIFC.PushExportState(element, geomElem);
using (SubTransaction st = new SubTransaction(element.Document))
{
st.Start();
if (element is CurveElement)
{
CurveElement curveElem = element as CurveElement;
CurveElementExporter.ExportCurveElement(exporterIFC, curveElem, geomElem, productWrapper, m_CurveAnnotationCache);
}
else if (element is FamilyInstance)
{
FamilyInstance familyInstanceElem = element as FamilyInstance;
FamilyInstanceExporter.ExportFamilyInstanceElement(exporterIFC, familyInstanceElem, geomElem, productWrapper);
}
else if (element is Floor)
{
Floor floorElem = element as Floor;
FloorExporter.ExportFloor(exporterIFC, floorElem, geomElem, productWrapper);
}
else if (element is SpatialElement)
{
SpatialElement spatialElem = element as SpatialElement;
SpatialElementExporter.ExportSpatialElement(exporterIFC, spatialElem, productWrapper);
}
else if (element is TextNote)
{
TextNote textNote = element as TextNote;
TextNoteExporter.Export(exporterIFC, textNote, productWrapper, m_PresentationStyleCache);
}
else if (element is Wall)
{
Wall wallElem = element as Wall;
WallExporter.Export(exporterIFC, wallElem, geomElem, productWrapper);
}
else if (IsMEPType(exporterIFC, element))
{
GenericMEPExporter.Export(exporterIFC, element, geomElem, productWrapper);
}
else if (element is FilledRegion)
{
// FilledRegion is still handled by internal Revit code, but the get_Geometry call makes sure
// that the Owner view is clean before we get the region's GeometryElement.
ExporterIFCUtils.ExportElementInternal(exporterIFC, element, productWrapper);
}
st.RollBack();
}
}
finally
{
exporterIFC.PopExportState();
}
}
示例7: ExportElementImpl
//.........这里部分代码省略.........
{
RebarExporter.Export(exporterIFC, element, productWrapper);
}
else if (element is RoofBase)
{
RoofBase roofElement = element as RoofBase;
RoofExporter.Export(exporterIFC, roofElement, geomElem, productWrapper);
}
else if (element is SpatialElement)
{
SpatialElement spatialElem = element as SpatialElement;
SpatialElementExporter.ExportSpatialElement(exporterIFC, spatialElem, productWrapper);
}
else if (IsStairs(element))
{
StairsExporter.Export(exporterIFC, element, geomElem, productWrapper);
}
else if (element is TextNote)
{
TextNote textNote = element as TextNote;
TextNoteExporter.Export(exporterIFC, textNote, productWrapper);
}
else if (element is TopographySurface)
{
TopographySurface topSurface = element as TopographySurface;
SiteExporter.ExportTopographySurface(exporterIFC, topSurface, geomElem, productWrapper);
}
else if (element is Truss)
{
if (ExporterCacheManager.TrussCache.Contains(element.Id))
AssemblyInstanceExporter.ExportTrussElement(exporterIFC, element as Truss, productWrapper);
else
{
ExporterCacheManager.TrussCache.Add(element.Id);
shouldPreserveParameterCache = true;
}
}
else if (element is Wall)
{
Wall wallElem = element as Wall;
WallExporter.Export(exporterIFC, wallElem, geomElem, productWrapper);
}
else if (element is WallSweep)
{
WallSweep wallSweep = element as WallSweep;
WallSweepExporter.Export(exporterIFC, wallSweep, geomElem, productWrapper);
}
else if (element is Zone)
{
if (ExporterCacheManager.ZoneCache.Contains(element.Id))
ZoneExporter.ExportZone(exporterIFC, element as Zone, productWrapper);
else
{
ExporterCacheManager.ZoneCache.Add(element.Id);
shouldPreserveParameterCache = true;
}
}
else
{
string ifcEnumType;
IFCExportType exportType = ExporterUtil.GetExportType(exporterIFC, element, out ifcEnumType);
// The intention with the code below is to make this the "generic" element exporter, which would export any Revit element as any IFC instance.
// We would then in addition have specialized functions that would convert specific Revit elements to specific IFC instances where extra information
// could be gathered from the element.
bool exported = false;
if (IsMEPType(exporterIFC, element, exportType))
exported = GenericMEPExporter.Export(exporterIFC, element, geomElem, exportType, ifcEnumType, productWrapper);
else if (ExportAsProxy(element, exportType))
exported = ProxyElementExporter.Export(exporterIFC, element, geomElem, productWrapper);
else if ((element is HostObject) || (element is DirectShape))
{
// This is intended to work for any element. However, there are some hidden elements that we likely want to ignore.
// As such, this is currently limited to the two types of elements that we know we want to export that aren't covered above.
// Note the general comment that we would like to revamp this whole routine to be cleaner and simpler.
// Note 2: Known lists of DirectShapes that aren't exported:
// 1. IfcSpace (roundtripped IFC spaces).
// 2. Railings
exported = FamilyInstanceExporter.ExportGenericBuildingElement(exporterIFC, element, geomElem, exportType, ifcEnumType, productWrapper);
}
// For ducts and pipes, we will add a IfcRelCoversBldgElements during the end of export.
if (exported && (element is Duct || element is Pipe))
ExporterCacheManager.MEPCache.CoveredElementsCache.Add(element.Id);
}
if (element.AssemblyInstanceId != ElementId.InvalidElementId)
ExporterCacheManager.AssemblyInstanceCache.RegisterElements(element.AssemblyInstanceId, productWrapper);
if (element.GroupId != ElementId.InvalidElementId)
ExporterCacheManager.GroupCache.RegisterElements(element.GroupId, productWrapper);
st.RollBack();
}
}
finally
{
exporterIFC.PopExportState();
ExporterStateManager.PreserveElementParameterCache(element, shouldPreserveParameterCache);
}
}