本文整理汇总了C#中IFCExtrusionCreationData.ClearOpenings方法的典型用法代码示例。如果您正苦于以下问题:C# IFCExtrusionCreationData.ClearOpenings方法的具体用法?C# IFCExtrusionCreationData.ClearOpenings怎么用?C# IFCExtrusionCreationData.ClearOpenings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFCExtrusionCreationData
的用法示例。
在下文中一共展示了IFCExtrusionCreationData.ClearOpenings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Export
/// <summary>
/// Exports mullion.
/// </summary>
/// <param name="exporterIFC">
/// The ExporterIFC object.
/// </param>
/// <param name="mullion">
/// The mullion object.
/// </param>
/// <param name="geometryElement">
/// The geometry element.
/// </param>
/// <param name="localPlacement">
/// The local placement handle.
/// </param>
/// <param name="extraParams">
/// The extrusion creation data.
/// </param>
/// <param name="setter">
/// The IFCPlacementSetter.
/// </param>
/// <param name="productWrapper">
/// The IFCProductWrapper.
/// </param>
public static void Export(ExporterIFC exporterIFC, Mullion mullion, GeometryElement geometryElement,
IFCAnyHandle localPlacement, IFCExtrusionCreationData extraParams, IFCPlacementSetter setter, IFCProductWrapper productWrapper)
{
IFCFile file = exporterIFC.GetFile();
ElementId catId = CategoryUtil.GetSafeCategoryId(mullion);
BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true);
IFCAnyHandle repHnd = RepresentationUtil.CreateBRepProductDefinitionShape(mullion.Document.Application, exporterIFC, mullion, catId,
geometryElement, bodyExporterOptions, null, extraParams);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(repHnd))
{
extraParams.ClearOpenings();
return;
}
string elemGUID = ExporterIFCUtils.CreateGUID(mullion);
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
string elemObjectType = NamingUtil.CreateIFCObjectName(exporterIFC, mullion);
string elemId = NamingUtil.CreateIFCElementId(mullion);
IFCAnyHandle mullionHnd = IFCInstanceExporter.CreateMember(file, elemGUID, ownerHistory, elemObjectType, null, elemObjectType,
localPlacement, repHnd, elemId);
productWrapper.AddElement(mullionHnd, setter, extraParams, LevelUtil.AssociateElementToLevel(mullion));
PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, mullion, productWrapper);
}
示例2: ExportDuctLining
/// <summary>
/// Exports an element as a covering of type insulation.
/// </summary>
/// <param name="exporterIFC">The ExporterIFC object.</param>
/// <param name="element">The element.</param>
/// <param name="geometryElement">The geometry element.</param>
/// <param name="productWrapper">The ProductWrapper.</param>
/// <returns>True if exported successfully, false otherwise.</returns>
public static bool ExportDuctLining(ExporterIFC exporterIFC, Element element,
GeometryElement geometryElement, ProductWrapper productWrapper)
{
if (element == null || geometryElement == null)
return false;
IFCFile file = exporterIFC.GetFile();
using (IFCTransaction tr = new IFCTransaction(file))
{
using (PlacementSetter placementSetter = PlacementSetter.Create(exporterIFC, element))
{
using (IFCExtrusionCreationData ecData = new IFCExtrusionCreationData())
{
ecData.SetLocalPlacement(placementSetter.LocalPlacement);
ElementId categoryId = CategoryUtil.GetSafeCategoryId(element);
BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true);
IFCAnyHandle representation = RepresentationUtil.CreateAppropriateProductDefinitionShape(exporterIFC, element,
categoryId, geometryElement, bodyExporterOptions, null, ecData, true);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(representation))
{
ecData.ClearOpenings();
return false;
}
string guid = GUIDUtil.CreateGUID(element);
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
string revitObjectType = exporterIFC.GetFamilyName();
string name = NamingUtil.GetNameOverride(element, revitObjectType);
string description = NamingUtil.GetDescriptionOverride(element, null);
string objectType = NamingUtil.GetObjectTypeOverride(element, revitObjectType);
IFCAnyHandle localPlacement = ecData.GetLocalPlacement();
string elementTag = NamingUtil.GetTagOverride(element, NamingUtil.CreateIFCElementId(element));
IFCAnyHandle ductLining = IFCInstanceExporter.CreateCovering(file, guid,
ownerHistory, name, description, objectType, localPlacement, representation, elementTag, "Wrapping");
ExporterCacheManager.ElementToHandleCache.Register(element.Id, ductLining);
productWrapper.AddElement(element, ductLining, placementSetter.LevelInfo, ecData, true);
ElementId matId = BodyExporter.GetBestMaterialIdFromGeometryOrParameter(geometryElement, exporterIFC, element);
CategoryUtil.CreateMaterialAssociation(exporterIFC, ductLining, matId);
}
}
tr.Commit();
return true;
}
}
示例3: ExportDuctLining
/// <summary>
/// Exports an element as a covering of type insulation.
/// </summary>
/// <param name="exporterIFC">The ExporterIFC object.</param>
/// <param name="element">The element.</param>
/// <param name="geometryElement">The geometry element.</param>
/// <param name="productWrapper">The ProductWrapper.</param>
/// <returns>True if exported successfully, false otherwise.</returns>
public static bool ExportDuctLining(ExporterIFC exporterIFC, Element element,
GeometryElement geometryElement, ProductWrapper productWrapper)
{
if (element == null || geometryElement == null)
return false;
IFCFile file = exporterIFC.GetFile();
using (IFCTransaction tr = new IFCTransaction(file))
{
using (IFCPlacementSetter placementSetter = IFCPlacementSetter.Create(exporterIFC, element))
{
using (IFCExtrusionCreationData ecData = new IFCExtrusionCreationData())
{
ecData.SetLocalPlacement(placementSetter.GetPlacement());
ElementId categoryId = CategoryUtil.GetSafeCategoryId(element);
BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true);
IFCAnyHandle representation = RepresentationUtil.CreateAppropriateProductDefinitionShape(exporterIFC, element,
categoryId, geometryElement, bodyExporterOptions, null, ecData);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(representation))
{
ecData.ClearOpenings();
return false;
}
string guid = GUIDUtil.CreateGUID(element);
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
string revitObjectType = exporterIFC.GetFamilyName();
string name = NamingUtil.GetNameOverride(element, revitObjectType);
string description = NamingUtil.GetDescriptionOverride(element, null);
string objectType = NamingUtil.GetObjectTypeOverride(element, revitObjectType);
IFCAnyHandle localPlacement = ecData.GetLocalPlacement();
string elementTag = NamingUtil.GetTagOverride(element, NamingUtil.CreateIFCElementId(element));
IFCAnyHandle ductLining = IFCInstanceExporter.CreateCovering(file, guid,
ownerHistory, name, description, objectType, localPlacement, representation, elementTag, IFCCoveringType.Wrapping);
productWrapper.AddElement(ductLining, placementSetter.GetLevelInfo(), ecData, LevelUtil.AssociateElementToLevel(element));
PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, element, productWrapper);
}
}
tr.Commit();
return true;
}
}
示例4: ExportBuildingElementProxy
/// <summary>
/// Exports an element as building element proxy.
/// </summary>
/// <remarks>
/// This function is called from the Export function, but can also be called directly if you do not
/// want CreateInternalPropertySets to be called.
/// </remarks>
/// <param name="exporterIFC">The ExporterIFC object.</param>
/// <param name="element">The element.</param>
/// <param name="geometryElement">The geometry element.</param>
/// <param name="productWrapper">The ProductWrapper.</param>
/// <returns>The handle if created, null otherwise.</returns>
public static IFCAnyHandle ExportBuildingElementProxy(ExporterIFC exporterIFC, Element element,
GeometryElement geometryElement, ProductWrapper productWrapper)
{
if (element == null || geometryElement == null)
return null;
IFCFile file = exporterIFC.GetFile();
IFCAnyHandle buildingElementProxy = null;
using (IFCTransaction tr = new IFCTransaction(file))
{
using (PlacementSetter placementSetter = PlacementSetter.Create(exporterIFC, element))
{
using (IFCExtrusionCreationData ecData = new IFCExtrusionCreationData())
{
ecData.SetLocalPlacement(placementSetter.LocalPlacement);
ElementId categoryId = CategoryUtil.GetSafeCategoryId(element);
BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true);
IFCAnyHandle representation = RepresentationUtil.CreateAppropriateProductDefinitionShape(exporterIFC, element,
categoryId, geometryElement, bodyExporterOptions, null, ecData, true);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(representation))
{
ecData.ClearOpenings();
return null;
}
string guid = GUIDUtil.CreateGUID(element);
IFCAnyHandle ownerHistory = ExporterCacheManager.OwnerHistoryHandle;
string revitObjectType = exporterIFC.GetFamilyName();
string name = NamingUtil.GetNameOverride(element, revitObjectType);
string description = NamingUtil.GetDescriptionOverride(element, null);
string objectType = NamingUtil.GetObjectTypeOverride(element, revitObjectType);
IFCAnyHandle localPlacement = ecData.GetLocalPlacement();
string elementTag = NamingUtil.GetTagOverride(element, NamingUtil.CreateIFCElementId(element));
buildingElementProxy = IFCInstanceExporter.CreateBuildingElementProxy(file, guid,
ownerHistory, name, description, objectType, localPlacement, representation, elementTag, null);
productWrapper.AddElement(element, buildingElementProxy, placementSetter.LevelInfo, ecData, true);
}
tr.Commit();
}
}
return buildingElementProxy;
}
示例5: Export
/// <summary>
/// Exports mullion.
/// </summary>
/// <param name="exporterIFC">
/// The ExporterIFC object.
/// </param>
/// <param name="mullion">
/// The mullion object.
/// </param>
/// <param name="geometryElement">
/// The geometry element.
/// </param>
/// <param name="localPlacement">
/// The local placement handle.
/// </param>
/// <param name="setter">
/// The IFCPlacementSetter.
/// </param>
/// <param name="productWrapper">
/// The ProductWrapper.
/// </param>
public static void Export(ExporterIFC exporterIFC, Mullion mullion, GeometryElement geometryElement,
IFCAnyHandle localPlacement, IFCPlacementSetter setter, ProductWrapper productWrapper)
{
IFCFile file = exporterIFC.GetFile();
using (IFCPlacementSetter mullionSetter = IFCPlacementSetter.Create(exporterIFC, mullion, null, null, ExporterUtil.GetBaseLevelIdForElement(mullion)))
{
using (IFCExtrusionCreationData extraParams = new IFCExtrusionCreationData())
{
IFCAnyHandle mullionPlacement = mullionSetter.GetPlacement();
Transform relTrf = ExporterIFCUtils.GetRelativeLocalPlacementOffsetTransform(localPlacement, mullionPlacement);
Transform inverseTrf = relTrf.Inverse;
IFCAnyHandle mullionRelativePlacement = ExporterUtil.CreateAxis2Placement3D(file, inverseTrf.Origin, inverseTrf.BasisZ, inverseTrf.BasisX);
IFCAnyHandle mullionLocalPlacement = IFCInstanceExporter.CreateLocalPlacement(file, localPlacement, mullionRelativePlacement);
extraParams.SetLocalPlacement(mullionLocalPlacement);
ElementId catId = CategoryUtil.GetSafeCategoryId(mullion);
BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true);
IFCAnyHandle repHnd = RepresentationUtil.CreateAppropriateProductDefinitionShape(exporterIFC, mullion, catId,
geometryElement, bodyExporterOptions, null, extraParams, true);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(repHnd))
{
extraParams.ClearOpenings();
return;
}
string elemGUID = GUIDUtil.CreateGUID(mullion);
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
string elemObjectType = NamingUtil.CreateIFCObjectName(exporterIFC, mullion);
string name = NamingUtil.GetNameOverride(mullion, elemObjectType);
string description = NamingUtil.GetDescriptionOverride(mullion, null);
string objectType = NamingUtil.GetObjectTypeOverride(mullion, elemObjectType);
string elemTag = NamingUtil.GetTagOverride(mullion, NamingUtil.CreateIFCElementId(mullion));
IFCAnyHandle mullionHnd = IFCInstanceExporter.CreateMember(file, elemGUID, ownerHistory, name, description, objectType,
mullionLocalPlacement, repHnd, elemTag);
ExporterCacheManager.HandleToElementCache.Register(mullionHnd, mullion.Id);
productWrapper.AddElement(mullion, mullionHnd, mullionSetter, extraParams, false);
ElementId matId = BodyExporter.GetBestMaterialIdFromGeometryOrParameter(geometryElement, exporterIFC, mullion);
CategoryUtil.CreateMaterialAssociation(exporterIFC, mullionHnd, matId);
}
}
}
示例6: ExportBuildingElementProxy
/// <summary>
/// Exports an element as building element proxy.
/// </summary>
/// <remarks>
/// This function is called from the Export function, but can also be called directly if you do not
/// want CreateInternalPropertySets to be called.
/// </remarks>
/// <param name="exporterIFC">The ExporterIFC object.</param>
/// <param name="element">The element.</param>
/// <param name="geometryElement">The geometry element.</param>
/// <param name="productWrapper">The IFCProductWrapper.</param>
/// <returns>True if exported successfully, false otherwise.</returns>
public static bool ExportBuildingElementProxy(ExporterIFC exporterIFC, Element element,
GeometryElement geometryElement, IFCProductWrapper productWrapper)
{
if (element == null || geometryElement == null)
return false;
IFCFile file = exporterIFC.GetFile();
using (IFCTransaction tr = new IFCTransaction(file))
{
using (IFCPlacementSetter placementSetter = IFCPlacementSetter.Create(exporterIFC, element))
{
using (IFCExtrusionCreationData ecData = new IFCExtrusionCreationData())
{
ecData.SetLocalPlacement(placementSetter.GetPlacement());
ElementId categoryId = CategoryUtil.GetSafeCategoryId(element);
BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true);
IFCAnyHandle representation = RepresentationUtil.CreateBRepProductDefinitionShape(element.Document.Application, exporterIFC, element,
categoryId, geometryElement, bodyExporterOptions, null, ecData);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(representation))
{
ecData.ClearOpenings();
return false;
}
string guid = ExporterIFCUtils.CreateGUID(element);
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
string objectType = exporterIFC.GetFamilyName();
IFCAnyHandle localPlacement = ecData.GetLocalPlacement();
string elementTag = NamingUtil.CreateIFCElementId(element);
IFCAnyHandle buildingElementProxy = IFCInstanceExporter.CreateBuildingElementProxy(file, guid,
ownerHistory, objectType, null, objectType, localPlacement, representation, elementTag, Toolkit.IFCElementComposition.Element);
productWrapper.AddElement(buildingElementProxy, placementSetter.GetLevelInfo(), ecData, LevelUtil.AssociateElementToLevel(element));
}
tr.Commit();
return true;
}
}
}
示例7: ExportFloor
//.........这里部分代码省略.........
if (floorAndProperties.Data != null)
loopExtraParams.Add(floorAndProperties.Data);
}
}
}
}
}
// Use internal routine as backup that handles openings.
if (prodReps.Count == 0)
{
exportedAsInternalExtrusion = ExporterIFCUtils.ExportSlabAsExtrusion(exporterIFC, floorElement,
geometryElement, transformSetter, localPlacement, out localPlacements, out prodReps,
out extrusionLoops, out loopExtraParams, floorPlane);
for (int ii = 0; ii < prodReps.Count; ii++)
{
// all are extrusions
repTypes.Add(ShapeRepresentationType.SweptSolid);
}
}
if (prodReps.Count == 0)
{
using (IFCExtrusionCreationData ecData = new IFCExtrusionCreationData())
{
BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true);
bodyExporterOptions.TessellationLevel = BodyExporterOptions.BodyTessellationLevel.Coarse;
BodyData bodyData;
IFCAnyHandle prodDefHnd = RepresentationUtil.CreateBRepProductDefinitionShape(floorElement.Document.Application, exporterIFC,
floorElement, catId, geometryElement, bodyExporterOptions, null, ecData, out bodyData);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(prodDefHnd))
{
ecData.ClearOpenings();
return;
}
prodReps.Add(prodDefHnd);
repTypes.Add(bodyData.ShapeRepresentationType);
}
}
}
// Create the slab from either the extrusion or the BRep information.
string ifcGUID = GUIDUtil.CreateGUID(floorElement);
int numReps = exportParts ? 1 : prodReps.Count;
for (int ii = 0; ii < numReps; ii++)
{
string ifcName = NamingUtil.GetIFCNamePlusIndex(floorElement, ii == 0 ? -1 : ii + 1);
string ifcDescription = NamingUtil.GetDescriptionOverride(floorElement, null);
string ifcObjectType = NamingUtil.GetObjectTypeOverride(floorElement, exporterIFC.GetFamilyName());
string ifcElemId = NamingUtil.CreateIFCElementId(floorElement);
string currentGUID = (ii == 0) ? ifcGUID : GUIDUtil.CreateGUID();
IFCAnyHandle localPlacementHnd = exportedAsInternalExtrusion ? localPlacements[ii] : localPlacement;
IFCSlabType slabType = GetIFCSlabType(ifcEnumType);
IFCAnyHandle slabHnd = IFCInstanceExporter.CreateSlab(file, currentGUID, ownerHistory, ifcName,
ifcDescription, ifcObjectType, localPlacementHnd, exportParts ? null : prodReps[ii], ifcElemId, slabType);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(slabHnd))
return;
if (exportParts)
{
示例8: Export
/// <summary>
/// Exports mullion.
/// </summary>
/// <param name="exporterIFC">
/// The ExporterIFC object.
/// </param>
/// <param name="mullion">
/// The mullion object.
/// </param>
/// <param name="geometryElement">
/// The geometry element.
/// </param>
/// <param name="localPlacement">
/// The local placement handle.
/// </param>
/// <param name="setter">
/// The PlacementSetter.
/// </param>
/// <param name="productWrapper">
/// The ProductWrapper.
/// </param>
public static void Export(ExporterIFC exporterIFC, Mullion mullion, GeometryElement geometryElement,
IFCAnyHandle localPlacement, PlacementSetter setter, ProductWrapper productWrapper)
{
IFCFile file = exporterIFC.GetFile();
using (PlacementSetter mullionSetter = PlacementSetter.Create(exporterIFC, mullion))
{
using (IFCExtrusionCreationData extraParams = new IFCExtrusionCreationData())
{
IFCAnyHandle mullionPlacement = mullionSetter.LocalPlacement;
Transform relTrf = ExporterIFCUtils.GetRelativeLocalPlacementOffsetTransform(localPlacement, mullionPlacement);
Transform inverseTrf = relTrf.Inverse;
IFCAnyHandle mullionLocalPlacement = ExporterUtil.CreateLocalPlacement(file, localPlacement,
inverseTrf.Origin, inverseTrf.BasisZ, inverseTrf.BasisX);
extraParams.SetLocalPlacement(mullionLocalPlacement);
Transform extrusionLCS = null;
// Add a custom direction for trying to create an extrusion based on the base curve of the mullion, if it is a line and not an arc.
Curve baseCurve = mullion.LocationCurve;
if ((baseCurve != null) && (baseCurve is Line))
{
// We won't use curveBounds and origin yet; just need the axis for now.
IFCRange curveBounds;
XYZ origin, mullionDirection;
GeometryUtil.GetAxisAndRangeFromCurve(baseCurve, out curveBounds, out mullionDirection, out origin);
// approx 1.0/sqrt(2.0)
XYZ planeY = (Math.Abs(mullionDirection.Z) < 0.707) ? XYZ.BasisZ.CrossProduct(mullionDirection) : XYZ.BasisX.CrossProduct(mullionDirection);
planeY.Normalize();
XYZ projDir = mullionDirection.CrossProduct(planeY);
extrusionLCS = Transform.Identity;
extrusionLCS.BasisX = mullionDirection; extrusionLCS.BasisY = planeY; extrusionLCS.BasisZ = projDir; extrusionLCS.Origin = origin;
}
ElementId catId = CategoryUtil.GetSafeCategoryId(mullion);
BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true);
bodyExporterOptions.ExtrusionLocalCoordinateSystem = extrusionLCS;
IFCAnyHandle repHnd = RepresentationUtil.CreateAppropriateProductDefinitionShape(exporterIFC, mullion, catId,
geometryElement, bodyExporterOptions, null, extraParams, true);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(repHnd))
{
extraParams.ClearOpenings();
return;
}
string elemGUID = GUIDUtil.CreateGUID(mullion);
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
string elemObjectType = NamingUtil.CreateIFCObjectName(exporterIFC, mullion);
string name = NamingUtil.GetNameOverride(mullion, elemObjectType);
string description = NamingUtil.GetDescriptionOverride(mullion, null);
string objectType = NamingUtil.GetObjectTypeOverride(mullion, elemObjectType);
string elemTag = NamingUtil.GetTagOverride(mullion, NamingUtil.CreateIFCElementId(mullion));
IFCAnyHandle mullionHnd = IFCInstanceExporter.CreateMember(file, elemGUID, ownerHistory, name, description, objectType,
mullionLocalPlacement, repHnd, elemTag, "MULLION");
ExporterCacheManager.HandleToElementCache.Register(mullionHnd, mullion.Id);
productWrapper.AddElement(mullion, mullionHnd, mullionSetter, extraParams, false);
ElementId matId = BodyExporter.GetBestMaterialIdFromGeometryOrParameter(geometryElement, exporterIFC, mullion);
CategoryUtil.CreateMaterialAssociation(exporterIFC, mullionHnd, matId);
}
}
}
示例9: ExportCovering
/// <summary>
/// Exports an element as IFC covering.
/// </summary>
/// <param name="exporterIFC">
/// The ExporterIFC object.
/// </param>
/// <param name="element">
/// The element to be exported.
/// </param>
/// <param name="geometryElement">
/// The geometry element.
/// </param>
/// <param name="productWrapper">
/// The ProductWrapper.
/// </param>
public static void ExportCovering(ExporterIFC exporterIFC, Element element, GeometryElement geomElem, string ifcEnumType, ProductWrapper productWrapper)
{
bool exportParts = PartExporter.CanExportParts(element);
if (exportParts && !PartExporter.CanExportElementInPartExport(element, element.Level.Id, false))
return;
ElementType elemType = element.Document.GetElement(element.GetTypeId()) as ElementType;
IFCFile file = exporterIFC.GetFile();
using (IFCTransaction transaction = new IFCTransaction(file))
{
using (IFCPlacementSetter setter = IFCPlacementSetter.Create(exporterIFC, element))
{
using (IFCExtrusionCreationData ecData = new IFCExtrusionCreationData())
{
IFCAnyHandle prodRep = null;
if (!exportParts)
{
ecData.SetLocalPlacement(setter.GetPlacement());
ecData.PossibleExtrusionAxes = IFCExtrusionAxes.TryZ;
ElementId categoryId = CategoryUtil.GetSafeCategoryId(element);
BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true);
prodRep = RepresentationUtil.CreateAppropriateProductDefinitionShape(exporterIFC, element,
categoryId, geomElem, bodyExporterOptions, null, ecData);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(prodRep))
{
ecData.ClearOpenings();
return;
}
}
string instanceGUID = GUIDUtil.CreateGUID(element);
string instanceName = NamingUtil.GetIFCName(element);
string instanceDescription = NamingUtil.GetDescriptionOverride(element, null);
string instanceObjectType = NamingUtil.GetObjectTypeOverride(element, exporterIFC.GetFamilyName());
string instanceElemId = NamingUtil.GetTagOverride(element, NamingUtil.CreateIFCElementId(element));
Toolkit.IFCCoveringType coveringType = GetIFCCoveringType(element, ifcEnumType);
IFCAnyHandle covering = IFCInstanceExporter.CreateCovering(file, instanceGUID, exporterIFC.GetOwnerHistoryHandle(),
instanceName, instanceDescription, instanceObjectType, setter.GetPlacement(), prodRep, instanceElemId, coveringType);
if (exportParts)
{
PartExporter.ExportHostPart(exporterIFC, element, covering, productWrapper, setter, setter.GetPlacement(), null);
}
Boolean containInSpace = false;
IFCAnyHandle localPlacementToUse = setter.GetPlacement();
// Assign ceiling to room/IfcSpace if it is bounding a single Room for FMHandOver view only
ExportOptionsCache exportOptionsCache = ExporterCacheManager.ExportOptionsCache;
if (String.Compare(exportOptionsCache.SelectedConfigName, "FMHandOverView") == 0)
{
if (ExporterCacheManager.CeilingSpaceRelCache.ContainsKey(element.Id))
{
IList<ElementId> roomlist = ExporterCacheManager.CeilingSpaceRelCache[element.Id];
// Process Ceiling to be contained in a Space only when it is exactly bounding one Space
if (roomlist.Count == 1)
{
productWrapper.AddElement(covering, setter, null, false);
// Modify the Ceiling placement to be relative to the Space that it bounds
IFCAnyHandle roomPlacement = IFCAnyHandleUtil.GetObjectPlacement(ExporterCacheManager.SpatialElementHandleCache.Find(roomlist[0]));
Transform relTrf = ExporterIFCUtils.GetRelativeLocalPlacementOffsetTransform(roomPlacement, localPlacementToUse);
Transform inverseTrf = relTrf.Inverse;
IFCAnyHandle relLocalPlacement = ExporterUtil.CreateAxis2Placement3D(file, inverseTrf.Origin, inverseTrf.BasisZ, inverseTrf.BasisX);
IFCAnyHandleUtil.SetAttribute(localPlacementToUse, "PlacementRelTo", roomPlacement);
GeometryUtil.SetRelativePlacement(localPlacementToUse, relLocalPlacement);
exporterIFC.RelateSpatialElement(roomlist[0], covering);
containInSpace = true;
}
}
}
// if not contained in Space, assign it to default containment in Level
if (!containInSpace)
productWrapper.AddElement(covering, setter, null, LevelUtil.AssociateElementToLevel(element));
if (!exportParts)
{
Ceiling ceiling = element as Ceiling;
if (ceiling != null)
//.........这里部分代码省略.........
示例10: ExportPile
/// <summary>
/// Exports an element to IfcPile.
/// </summary>
/// <param name="exporterIFC">The ExporterIFC object.</param>
/// <param name="element">The element.</param>
/// <param name="geometryElement">The geometry element.</param>
/// <param name="ifcEnumType">The string value represents the IFC type.</param>
/// <param name="productWrapper">The ProductWrapper.</param>
public static void ExportPile(ExporterIFC exporterIFC, Element element, GeometryElement geometryElement,
string ifcEnumType, ProductWrapper productWrapper)
{
// export parts or not
bool exportParts = PartExporter.CanExportParts(element);
if (exportParts && !PartExporter.CanExportElementInPartExport(element, element.Level.Id, false))
return;
IFCFile file = exporterIFC.GetFile();
using (IFCTransaction tr = new IFCTransaction(file))
{
using (IFCPlacementSetter setter = IFCPlacementSetter.Create(exporterIFC, element))
{
using (IFCExtrusionCreationData ecData = new IFCExtrusionCreationData())
{
ecData.SetLocalPlacement(setter.GetPlacement());
IFCAnyHandle prodRep = null;
ElementId matId = ElementId.InvalidElementId;
if (!exportParts)
{
ElementId catId = CategoryUtil.GetSafeCategoryId(element);
matId = BodyExporter.GetBestMaterialIdFromGeometryOrParameter(geometryElement, exporterIFC, element);
BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true);
prodRep = RepresentationUtil.CreateAppropriateProductDefinitionShape(exporterIFC,
element, catId, geometryElement, bodyExporterOptions, null, ecData);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(prodRep))
{
ecData.ClearOpenings();
return;
}
}
string instanceGUID = GUIDUtil.CreateGUID(element);
string instanceName = NamingUtil.GetNameOverride(element, NamingUtil.GetIFCName(element));
string instanceDescription = NamingUtil.GetDescriptionOverride(element, null);
string instanceObjectType = NamingUtil.GetObjectTypeOverride(element, exporterIFC.GetFamilyName());
string instanceTag = NamingUtil.GetTagOverride(element, NamingUtil.CreateIFCElementId(element));
Toolkit.IFCPileType pileType = GetPileType(element, ifcEnumType);
IFCAnyHandle pile = IFCInstanceExporter.CreatePile(file, instanceGUID, exporterIFC.GetOwnerHistoryHandle(),
instanceName, instanceDescription, instanceObjectType, ecData.GetLocalPlacement(), prodRep, instanceTag, pileType, null);
if (exportParts)
{
PartExporter.ExportHostPart(exporterIFC, element, pile, productWrapper, setter, setter.GetPlacement(), null);
}
else
{
if (matId != ElementId.InvalidElementId)
{
CategoryUtil.CreateMaterialAssociation(element.Document, exporterIFC, pile, matId);
}
}
productWrapper.AddElement(pile, setter, ecData, LevelUtil.AssociateElementToLevel(element));
OpeningUtil.CreateOpeningsIfNecessary(pile, element, ecData, exporterIFC, ecData.GetLocalPlacement(), setter, productWrapper);
PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, element, productWrapper);
}
}
tr.Commit();
}
}
示例11: ExportFooting
/// <summary>
/// Exports an element to IFC footing.
/// </summary>
/// <param name="exporterIFC">
/// The ExporterIFC object.
/// </param>
/// <param name="element">
/// The element.
/// </param>
/// <param name="geometryElement">
/// The geometry element.
/// </param>
/// <param name="ifcEnumType">
/// The string value represents the IFC type.
/// </param>
/// <param name="productWrapper">
/// The IFCProductWrapper.
/// </param>
public static void ExportFooting(ExporterIFC exporterIFC, Element element, GeometryElement geometryElement,
string ifcEnumType, IFCProductWrapper productWrapper)
{
// export parts or not
bool exportParts = PartExporter.CanExportParts(element);
if (exportParts && !PartExporter.CanExportElementInPartExport(element, element.Level.Id, false))
return;
IFCFile file = exporterIFC.GetFile();
using (IFCTransaction tr = new IFCTransaction(file))
{
using (IFCPlacementSetter setter = IFCPlacementSetter.Create(exporterIFC, element))
{
using (IFCExtrusionCreationData ecData = new IFCExtrusionCreationData())
{
ecData.SetLocalPlacement(setter.GetPlacement());
IFCAnyHandle prodRep = null;
if (!exportParts)
{
ElementId catId = CategoryUtil.GetSafeCategoryId(element);
BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true);
prodRep = RepresentationUtil.CreateBRepProductDefinitionShape(element.Document.Application, exporterIFC,
element, catId, geometryElement, bodyExporterOptions, null, ecData);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(prodRep))
{
ecData.ClearOpenings();
return;
}
}
string instanceGUID = ExporterIFCUtils.CreateGUID(element);
string origInstanceName = exporterIFC.GetName();
string instanceName = NamingUtil.GetNameOverride(element, origInstanceName);
string instanceDescription = NamingUtil.GetDescriptionOverride(element, null);
string instanceObjectType = NamingUtil.GetObjectTypeOverride(element, exporterIFC.GetFamilyName());
string instanceElemId = NamingUtil.CreateIFCElementId(element);
Toolkit.IFCFootingType footingType = GetIFCFootingType(element, ifcEnumType);
IFCAnyHandle footing = IFCInstanceExporter.CreateFooting(file, instanceGUID, exporterIFC.GetOwnerHistoryHandle(),
instanceName, instanceDescription, instanceObjectType, ecData.GetLocalPlacement(), prodRep, instanceElemId, footingType);
if (exportParts)
{
PartExporter.ExportHostPart(exporterIFC, element, footing, productWrapper, setter, setter.GetPlacement(), null);
}
productWrapper.AddElement(footing, setter, ecData, LevelUtil.AssociateElementToLevel(element));
OpeningUtil.CreateOpeningsIfNecessary(footing, element, ecData, exporterIFC, ecData.GetLocalPlacement(), setter, productWrapper);
PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, element, productWrapper);
}
}
tr.Commit();
}
}
示例12: Export
/// <summary>
/// Exports mullion.
/// </summary>
/// <param name="exporterIFC">
/// The ExporterIFC object.
/// </param>
/// <param name="mullion">
/// The mullion object.
/// </param>
/// <param name="geometryElement">
/// The geometry element.
/// </param>
/// <param name="localPlacement">
/// The local placement handle.
/// </param>
/// <param name="extraParams">
/// The extrusion creation data.
/// </param>
/// <param name="setter">
/// The IFCPlacementSetter.
/// </param>
/// <param name="productWrapper">
/// The ProductWrapper.
/// </param>
public static void Export(ExporterIFC exporterIFC, Mullion mullion, GeometryElement geometryElement,
IFCAnyHandle localPlacement, IFCExtrusionCreationData extraParams, IFCPlacementSetter setter, ProductWrapper productWrapper)
{
IFCFile file = exporterIFC.GetFile();
using (IFCPlacementSetter mullionSetter = IFCPlacementSetter.Create(exporterIFC, mullion))
{
IFCAnyHandle mullionPlacement = mullionSetter.GetPlacement();
Transform relTrf = ExporterIFCUtils.GetRelativeLocalPlacementOffsetTransform(localPlacement, mullionPlacement);
Transform inverseTrf = relTrf.Inverse;
IFCAnyHandle mullionRelativePlacement = ExporterUtil.CreateAxis2Placement3D(file, inverseTrf.Origin, inverseTrf.BasisZ, inverseTrf.BasisX);
IFCAnyHandle mullionLocalPlacement = IFCInstanceExporter.CreateLocalPlacement(file, localPlacement, mullionRelativePlacement);
extraParams.SetLocalPlacement(mullionLocalPlacement);
ElementId catId = CategoryUtil.GetSafeCategoryId(mullion);
BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true);
IFCAnyHandle repHnd = RepresentationUtil.CreateBRepProductDefinitionShape(mullion.Document.Application, exporterIFC, mullion, catId,
geometryElement, bodyExporterOptions, null, extraParams);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(repHnd))
{
extraParams.ClearOpenings();
return;
}
string elemGUID = GUIDUtil.CreateGUID(mullion);
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
string elemObjectType = NamingUtil.CreateIFCObjectName(exporterIFC, mullion);
string elemId = NamingUtil.CreateIFCElementId(mullion);
IFCAnyHandle mullionHnd = IFCInstanceExporter.CreateMember(file, elemGUID, ownerHistory, elemObjectType, null, elemObjectType,
mullionLocalPlacement, repHnd, elemId);
productWrapper.AddElement(mullionHnd, mullionSetter, extraParams, false);
ElementId matId = BodyExporter.GetBestMaterialIdFromGeometryOrParameter(geometryElement, exporterIFC, mullion);
CategoryUtil.CreateMaterialAssociation(mullion.Document, exporterIFC, mullionHnd, matId);
PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, mullion, productWrapper);
}
}
示例13: CreateOpening
/// <summary>
/// Creates an opening from a solid.
/// </summary>
/// <param name="exporterIFC">The exporter.</param>
/// <param name="hostObjHnd">The host object handle.</param>
/// <param name="hostElement">The host element.</param>
/// <param name="insertElement">The insert element.</param>
/// <param name="openingGUID">The GUID for the opening, depending on how the opening is created.</param>
/// <param name="solid">The solid.</param>
/// <param name="scaledHostWidth">The scaled host width.</param>
/// <param name="isRecess">True if it is recess.</param>
/// <param name="extrusionCreationData">The extrusion creation data.</param>
/// <param name="setter">The placement setter.</param>
/// <param name="localWrapper">The product wrapper.</param>
/// <returns>The created opening handle.</returns>
static public IFCAnyHandle CreateOpening(ExporterIFC exporterIFC, IFCAnyHandle hostObjHnd, Element hostElement, Element insertElement, string openingGUID,
Solid solid, double scaledHostWidth, bool isRecess, IFCExtrusionCreationData extrusionCreationData, PlacementSetter setter, ProductWrapper localWrapper)
{
IFCFile file = exporterIFC.GetFile();
ElementId catId = CategoryUtil.GetSafeCategoryId(insertElement);
XYZ prepToWall;
bool isLinearWall = GetOpeningDirection(hostElement, out prepToWall);
if (isLinearWall)
{
extrusionCreationData.CustomAxis = prepToWall;
extrusionCreationData.PossibleExtrusionAxes = IFCExtrusionAxes.TryCustom;
}
BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true);
BodyData bodyData = BodyExporter.ExportBody(exporterIFC, insertElement, catId, ElementId.InvalidElementId,
solid, bodyExporterOptions, extrusionCreationData);
IFCAnyHandle openingRepHnd = bodyData.RepresentationHnd;
if (IFCAnyHandleUtil.IsNullOrHasNoValue(openingRepHnd))
{
extrusionCreationData.ClearOpenings();
return null;
}
IList<IFCAnyHandle> representations = new List<IFCAnyHandle>();
representations.Add(openingRepHnd);
IFCAnyHandle prodRep = IFCInstanceExporter.CreateProductDefinitionShape(file, null, null, representations);
IFCAnyHandle openingPlacement = extrusionCreationData.GetLocalPlacement();
IFCAnyHandle hostObjPlacementHnd = IFCAnyHandleUtil.GetObjectPlacement(hostObjHnd);
Transform relTransform = ExporterIFCUtils.GetRelativeLocalPlacementOffsetTransform(openingPlacement, hostObjPlacementHnd);
openingPlacement = ExporterUtil.CreateLocalPlacement(file, hostObjPlacementHnd,
relTransform.Origin, relTransform.BasisZ, relTransform.BasisX);
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
double scaledOpeningLength = extrusionCreationData.ScaledLength;
string openingObjectType = "Opening";
if (!MathUtil.IsAlmostZero(scaledHostWidth) && !MathUtil.IsAlmostZero(scaledOpeningLength))
openingObjectType = scaledOpeningLength < (scaledHostWidth - MathUtil.Eps()) ? "Recess" : "Opening";
else
openingObjectType = isRecess ? "Recess" : "Opening";
string openingName = NamingUtil.GetNameOverride(insertElement, null);
if (string.IsNullOrEmpty(openingName))
{
if (!IFCAnyHandleUtil.IsNullOrHasNoValue(hostObjHnd))
openingName = IFCAnyHandleUtil.GetStringAttribute(hostObjHnd, "Name");
else
openingName = NamingUtil.GetNameOverride(hostElement, NamingUtil.CreateIFCObjectName(exporterIFC, hostElement));
}
IFCAnyHandle openingHnd = IFCInstanceExporter.CreateOpeningElement(file, openingGUID, ownerHistory, openingName, null,
openingObjectType, openingPlacement, prodRep, null);
if (ExporterCacheManager.ExportOptionsCache.ExportBaseQuantities)
PropertyUtil.CreateOpeningQuantities(exporterIFC, openingHnd, extrusionCreationData);
if (localWrapper != null)
{
Element elementForProperties = null;
if (GUIDUtil.IsGUIDFor(insertElement, openingGUID))
elementForProperties = insertElement;
localWrapper.AddElement(insertElement, openingHnd, setter, extrusionCreationData, true);
}
string voidGuid = GUIDUtil.CreateGUID();
IFCInstanceExporter.CreateRelVoidsElement(file, voidGuid, ownerHistory, null, null, hostObjHnd, openingHnd);
return openingHnd;
}
示例14: ExportStairAsSingleGeometry
/// <summary>
/// Exports a staircase to IfcStair, without decomposing into separate runs and landings.
/// </summary>
/// <param name="exporterIFC">The ExporterIFC object.</param>
/// <param name="ifcEnumType">The stairs type.</param>
/// <param name="stair">The stairs element.</param>
/// <param name="geometryElement">The geometry element.</param>
/// <param name="numFlights">The number of flights for a multistory staircase.</param>
/// <param name="productWrapper">The IFCProductWrapper.</param>
public static void ExportStairAsSingleGeometry(ExporterIFC exporterIFC, string ifcEnumType, Element stair, GeometryElement geometryElement,
int numFlights, IFCProductWrapper productWrapper)
{
if (stair == null || geometryElement == null)
return;
IFCFile file = exporterIFC.GetFile();
using (IFCTransaction tr = new IFCTransaction(file))
{
using (IFCPlacementSetter placementSetter = IFCPlacementSetter.Create(exporterIFC, stair))
{
using (IFCExtrusionCreationData ecData = new IFCExtrusionCreationData())
{
ecData.SetLocalPlacement(placementSetter.GetPlacement());
ecData.ReuseLocalPlacement = false;
GeometryElement stairsGeom = GeometryUtil.GetOneLevelGeometryElement(geometryElement);
BodyData bodyData;
ElementId categoryId = CategoryUtil.GetSafeCategoryId(stair);
BodyExporterOptions bodyExporterOptions = new BodyExporterOptions();
IFCAnyHandle representation = RepresentationUtil.CreateBRepProductDefinitionShape(stair.Document.Application, exporterIFC,
stair, categoryId, stairsGeom, bodyExporterOptions, null, ecData, out bodyData);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(representation))
{
ecData.ClearOpenings();
return;
}
string containedStairGuid = ExporterIFCUtils.CreateSubElementGUID(stair, (int)IFCStairSubElements.ContainedStair);
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
string origStairName = exporterIFC.GetName();
string stairName = NamingUtil.GetNameOverride(stair, origStairName);
string stairDescription = NamingUtil.GetDescriptionOverride(stair, null);
string stairObjectType = NamingUtil.GetObjectTypeOverride(stair, NamingUtil.CreateIFCObjectName(exporterIFC, stair));
IFCAnyHandle containedStairLocalPlacement = ecData.GetLocalPlacement();
string elementTag = NamingUtil.CreateIFCElementId(stair);
IFCStairType stairType = GetIFCStairType(ifcEnumType);
List<IFCAnyHandle> components = new List<IFCAnyHandle>();
IList<IFCExtrusionCreationData> componentExtrusionData = new List<IFCExtrusionCreationData>();
IFCAnyHandle containedStairHnd = IFCInstanceExporter.CreateStair(file, containedStairGuid, ownerHistory, stairName,
stairDescription, stairObjectType, containedStairLocalPlacement, representation, elementTag, stairType);
components.Add(containedStairHnd);
componentExtrusionData.Add(ecData);
//productWrapper.AddElement(containedStairHnd, placementSetter.GetLevelInfo(), ecData, false);
string guid = ExporterIFCUtils.CreateGUID(stair);
IFCAnyHandle localPlacement = ecData.GetLocalPlacement();
IFCAnyHandle stairHnd = IFCInstanceExporter.CreateStair(file, guid, ownerHistory, stairName,
stairDescription, stairObjectType, localPlacement, null, elementTag, stairType);
productWrapper.AddElement(stairHnd, placementSetter.GetLevelInfo(), ecData, LevelUtil.AssociateElementToLevel(stair));
IFCAnyHandle emptyPlacement = null;
StairRampContainerInfo stairRampInfo = new StairRampContainerInfo(stairHnd, components, emptyPlacement);
ExporterCacheManager.StairRampContainerInfoCache.AddStairRampContainerInfo(stair.Id, stairRampInfo);
ExportMultistoryStair(exporterIFC, stair, numFlights, stairHnd, components, componentExtrusionData,
bodyData.MaterialIds, placementSetter, productWrapper);
}
tr.Commit();
}
}
}
示例15: ExportFamilyInstanceAsMappedItem
//.........这里部分代码省略.........
bodyRepresentation = ExtrusionExporter.CreateExtrusionWithClipping(exporterIFC, familyInstance,
categoryId, solids, plane, XYZ.BasisZ, null, out completelyClipped, out materialIds);
typeInfo.MaterialIds = materialIds;
}
}
else
{
extraParams.PossibleExtrusionAxes = IFCExtrusionAxes.TryXYZ;
}
BodyData bodyData = null;
if (IFCAnyHandleUtil.IsNullOrHasNoValue(bodyRepresentation))
{
BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(tryToExportAsExtrusion);
if (geomObjects.Count > 0)
{
bodyData = BodyExporter.ExportBody(familyInstance.Document.Application, exporterIFC, familyInstance, categoryId, ElementId.InvalidElementId,
geomObjects, bodyExporterOptions, extraParams);
typeInfo.MaterialIds = bodyData.MaterialIds;
}
else
{
IList<GeometryObject> exportedGeometries = new List<GeometryObject>();
exportedGeometries.Add(exportGeometry);
bodyData = BodyExporter.ExportBody(familyInstance.Document.Application, exporterIFC, familyInstance, categoryId, ElementId.InvalidElementId,
exportedGeometries, bodyExporterOptions, extraParams);
}
bodyRepresentation = bodyData.RepresentationHnd;
brepOffsetTransform = bodyData.BrepOffsetTransform;
}
if (IFCAnyHandleUtil.IsNullOrHasNoValue(bodyRepresentation))
{
extraParams.ClearOpenings();
return;
}
}
// By default: if exporting IFC2x3 or later, export 2D plan rep of family, if it exists, unless we are exporting Coordination View V2.
// This default can be overridden in the export options.
if (needToCreate2d)
{
XYZ curveOffset = new XYZ(0, 0, 0);
if (brepOffsetTransform != null)
curveOffset = -brepOffsetTransform.Origin / scale;
HashSet<IFCAnyHandle> curveSet = new HashSet<IFCAnyHandle>();
{
Transform planeTrf = doorWindowTrf.Inverse;
Plane plane = new Plane(planeTrf.get_Basis(0), planeTrf.get_Basis(1), planeTrf.Origin);
XYZ projDir = new XYZ(0, 0, 1);
IFCGeometryInfo IFCGeometryInfo = IFCGeometryInfo.CreateCurveGeometryInfo(exporterIFC, plane, projDir, true);
ExporterIFCUtils.CollectGeometryInfo(exporterIFC, IFCGeometryInfo, exportGeometry, curveOffset, false);
IList<IFCAnyHandle> curves = IFCGeometryInfo.GetCurves();
foreach (IFCAnyHandle curve in curves)
curveSet.Add(curve);
if (curveSet.Count > 0)
{
IFCAnyHandle contextOfItems2d = exporterIFC.Get2DContextHandle();
IFCAnyHandle curveRepresentationItem = IFCInstanceExporter.CreateGeometricSet(file, curveSet);
HashSet<IFCAnyHandle> bodyItems = new HashSet<IFCAnyHandle>();
bodyItems.Add(curveRepresentationItem);
planRepresentation = RepresentationUtil.CreateGeometricSetRep(exporterIFC, familyInstance, categoryId, "Annotation",