本文整理汇总了C#中ExporterIFC.GetOwnerHistoryHandle方法的典型用法代码示例。如果您正苦于以下问题:C# ExporterIFC.GetOwnerHistoryHandle方法的具体用法?C# ExporterIFC.GetOwnerHistoryHandle怎么用?C# ExporterIFC.GetOwnerHistoryHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExporterIFC
的用法示例。
在下文中一共展示了ExporterIFC.GetOwnerHistoryHandle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportFabricArea
/// <summary>
/// Exports a FabricArea as an IfcGroup. There is no geometry to export.
/// </summary>
/// <param name="exporterIFC">The ExporterIFC object.</param>
/// <param name="element">The element.</param>
/// <param name="productWrapper">The ProductWrapper.</param>
/// <returns>True if exported successfully, false otherwise.</returns>
public static bool ExportFabricArea(ExporterIFC exporterIFC, Element element, ProductWrapper productWrapper)
{
if (element == null)
return false;
HashSet<IFCAnyHandle> fabricSheetHandles = null;
if (!ExporterCacheManager.FabricAreaHandleCache.TryGetValue(element.Id, out fabricSheetHandles))
return false;
if (fabricSheetHandles == null || fabricSheetHandles.Count == 0)
return false;
IFCFile file = exporterIFC.GetFile();
using (IFCTransaction tr = new IFCTransaction(file))
{
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 fabricArea = IFCInstanceExporter.CreateGroup(file, guid,
ownerHistory, name, description, objectType);
productWrapper.AddElement(element, fabricArea);
IFCInstanceExporter.CreateRelAssignsToGroup(file, GUIDUtil.CreateGUID(), ownerHistory,
null, null, fabricSheetHandles, null, fabricArea);
tr.Commit();
return true;
}
}
示例2: ExportAssemblyInstanceElement
/// <summary>
/// Exports an element as an IFC assembly.
/// </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 IFCProductWrapper.</param>
/// <returns>True if exported successfully, false otherwise.</returns>
public static bool ExportAssemblyInstanceElement(ExporterIFC exporterIFC, AssemblyInstance element,
IFCProductWrapper productWrapper)
{
if (element == null)
return false;
IFCFile file = exporterIFC.GetFile();
using (IFCTransaction tr = new IFCTransaction(file))
{
using (IFCPlacementSetter placementSetter = IFCPlacementSetter.Create(exporterIFC, element))
{
string guid = ExporterIFCUtils.CreateGUID(element);
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
string name = exporterIFC.GetName();
string objectType = exporterIFC.GetFamilyName();
IFCAnyHandle localPlacement = placementSetter.GetPlacement();
IFCAnyHandle representation = null;
string elementTag = NamingUtil.CreateIFCElementId(element);
IFCElementAssemblyType predefinedType = GetPredefinedTypeFromObjectType(objectType);
IFCAnyHandle assemblyInstanceHnd = IFCInstanceExporter.CreateElementAssembly(file, guid,
ownerHistory, name, null, objectType, localPlacement, representation, elementTag,
IFCAssemblyPlace.NotDefined, predefinedType);
productWrapper.AddElement(assemblyInstanceHnd, placementSetter.GetLevelInfo(), null, true);
PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, element, productWrapper);
ExporterCacheManager.AssemblyInstanceCache.RegisterAssemblyInstance(element.Id, assemblyInstanceHnd);
}
tr.Commit();
return true;
}
}
示例3: CreateUniformatClassification
/// <summary>
/// Creates uniformat classification.
/// </summary>
/// <param name="exporterIFC">The ExporterIFC.</param>
/// <param name="file">The file.</param>
/// <param name="element">The element.</param>
/// <param name="elemHnd">The element handle.</param>
public static void CreateUniformatClassification(ExporterIFC exporterIFC, IFCFile file, Element element, IFCAnyHandle elemHnd)
{
// Create Uniformat classification, if it is set.
string uniformatCode = "";
if (ParameterUtil.GetStringValueFromElementOrSymbol(element, BuiltInParameter.UNIFORMAT_CODE, false, out uniformatCode) ||
ParameterUtil.GetStringValueFromElementOrSymbol(element, "Assembly Code", out uniformatCode))
{
string uniformatDescription = "";
if (!ParameterUtil.GetStringValueFromElementOrSymbol(element, BuiltInParameter.UNIFORMAT_DESCRIPTION, false, out uniformatDescription))
ParameterUtil.GetStringValueFromElementOrSymbol(element, "Assembly Description", out uniformatDescription);
IFCAnyHandle classification;
if (!ExporterCacheManager.ClassificationCache.TryGetValue("UniFormat", out classification))
{
classification = IFCInstanceExporter.CreateClassification(file, "http://www.csiorg.net/uniformat", "1998", null, "UniFormat");
ExporterCacheManager.ClassificationCache.Add("UniFormat", classification);
}
IFCAnyHandle classificationReference = IFCInstanceExporter.CreateClassificationReference(file,
"http://www.csiorg.net/uniformat", uniformatCode, uniformatDescription, classification);
HashSet<IFCAnyHandle> relatedObjects = new HashSet<IFCAnyHandle>();
relatedObjects.Add(elemHnd);
IFCAnyHandle relAssociates = IFCInstanceExporter.CreateRelAssociatesClassification(file, ExporterIFCUtils.CreateGUID(),
exporterIFC.GetOwnerHistoryHandle(), "UniFormatClassification", "", relatedObjects, classificationReference);
}
}
示例4: 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);
IFCSolidMeshGeometryInfo solidMeshInfo = ExporterIFCUtils.GetSolidMeshGeometry(exporterIFC, geometryElement, Transform.Identity);
IList<Solid> solids = solidMeshInfo.GetSolids();
IList<Mesh> polyMeshes = solidMeshInfo.GetMeshes();
bool tryToExportAsExtrusion = true;
if (solids.Count != 1 || polyMeshes.Count != 0)
tryToExportAsExtrusion = false;
IFCAnyHandle shapeRep = BodyExporter.ExportBody(mullion.Document.Application, exporterIFC, catId, solids, polyMeshes, tryToExportAsExtrusion, extraParams);
IList<IFCAnyHandle> shapeReps = new List<IFCAnyHandle>();
shapeReps.Add(shapeRep);
IFCAnyHandle repHnd = file.CreateProductDefinitionShape(IFCLabel.Create(), IFCLabel.Create(), shapeReps);
IFCLabel elemGUID = IFCLabel.CreateGUID(mullion);
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
IFCLabel elemObjectType = NamingUtil.CreateIFCObjectName(exporterIFC, mullion);
IFCLabel elemId = NamingUtil.CreateIFCElementId(mullion);
//IFCLabel elemType = IFCLabel.Create("MULLION");
IFCAnyHandle mullionHnd = file.CreateMember(elemGUID, ownerHistory, elemObjectType, IFCLabel.Create(), elemObjectType,
localPlacement, repHnd, elemId);
productWrapper.AddElement(mullionHnd, setter, extraParams, true);
}
示例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="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);
}
示例6: Export
/// <summary>
/// Exports a Rebar, AreaReinforcement or PathReinforcement to IFC ReinforcingBar.
/// </summary>
/// <param name="exporterIFC">The exporter.</param>
/// <param name="element">The element.</param>
/// <param name="productWrapper">The product wrapper.</param>
public static void Export(ExporterIFC exporterIFC, Element element, ProductWrapper productWrapper)
{
ISet<IFCAnyHandle> createdRebars = null;
if (element is Rebar)
{
ExportRebar(exporterIFC, element, productWrapper);
}
else if (element is AreaReinforcement)
{
AreaReinforcement areaReinforcement = element as AreaReinforcement;
IList<ElementId> rebarIds = areaReinforcement.GetRebarInSystemIds();
Document doc = areaReinforcement.Document;
foreach (ElementId id in rebarIds)
{
Element rebarInSystem = doc.GetElement(id);
createdRebars = ExportRebar(exporterIFC, rebarInSystem, productWrapper);
}
}
else if (element is PathReinforcement)
{
PathReinforcement pathReinforcement = element as PathReinforcement;
IList<ElementId> rebarIds = pathReinforcement.GetRebarInSystemIds();
Document doc = pathReinforcement.Document;
foreach (ElementId id in rebarIds)
{
Element rebarInSystem = doc.GetElement(id);
createdRebars = ExportRebar(exporterIFC, rebarInSystem, productWrapper);
}
}
if (createdRebars != null && createdRebars.Count > 1)
{
IFCFile file = exporterIFC.GetFile();
using (IFCTransaction tr = new IFCTransaction(file))
{
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 rebarGroup = IFCInstanceExporter.CreateGroup(file, guid,
ownerHistory, name, description, objectType);
productWrapper.AddElement(element, rebarGroup);
IFCInstanceExporter.CreateRelAssignsToGroup(file, GUIDUtil.CreateGUID(), ownerHistory,
null, null, createdRebars, null, rebarGroup);
tr.Commit();
}
}
}
示例7: 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;
}
}
示例8: 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;
}
}
示例9: 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 = 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));
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;
}
示例10: 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;
}
}
}
示例11: ExportZone
/// <summary>
/// Exports an element as a zone.
/// </summary>
/// <param name="exporterIFC">The ExporterIFC object.</param>
/// <param name="element">The element.</param>
/// <param name="productWrapper">The ProductWrapper.</param>
public static void ExportZone(ExporterIFC exporterIFC, Zone element,
ProductWrapper productWrapper)
{
if (element == null)
return;
HashSet<IFCAnyHandle> spaceHnds = new HashSet<IFCAnyHandle>();
SpaceSet spaces = element.Spaces;
foreach (Space space in spaces)
{
if (space == null)
continue;
IFCAnyHandle spaceHnd = ExporterCacheManager.SpatialElementHandleCache.Find(space.Id);
if (!IFCAnyHandleUtil.IsNullOrHasNoValue(spaceHnd))
spaceHnds.Add(spaceHnd);
}
if (spaceHnds.Count == 0)
return;
IFCFile file = exporterIFC.GetFile();
using (IFCTransaction tr = new IFCTransaction(file))
{
string guid = GUIDUtil.CreateGUID(element);
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
string name = NamingUtil.GetNameOverride(element, NamingUtil.GetIFCName(element));
string description = NamingUtil.GetDescriptionOverride(element, null);
string objectType = NamingUtil.GetObjectTypeOverride(element, exporterIFC.GetFamilyName());
IFCAnyHandle zoneHnd = IFCInstanceExporter.CreateZone(file, guid, ownerHistory, name, description, objectType);
productWrapper.AddElement(element, zoneHnd);
string relAssignsGuid = GUIDUtil.CreateSubElementGUID(element, (int) IFCZoneSubElements.RelAssignsToGroup);
IFCInstanceExporter.CreateRelAssignsToGroup(file, relAssignsGuid, ownerHistory, null, null, spaceHnds, null, zoneHnd);
tr.Commit();
return;
}
}
示例12: GetMemberTypeHandle
/// <summary>
/// The IfcMemberType shared by all stringers to keep their type. This is a placeholder IfcMemberType.
/// </summary>
public static IFCAnyHandle GetMemberTypeHandle(ExporterIFC exporterIFC, Element stringer)
{
Element stringerType = stringer.Document.GetElement(stringer.GetTypeId());
IFCAnyHandle memberType = ExporterCacheManager.ElementToHandleCache.Find(stringerType.Id);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(memberType))
{
IFCFile file = exporterIFC.GetFile();
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
string stringerTypeGUID = ExporterIFCUtils.CreateGUID(stringerType);
string origInstanceName = stringerType.Name;
string stringerTypeName = NamingUtil.GetNameOverride(stringerType, origInstanceName);
string stringerTypeDescription = NamingUtil.GetDescriptionOverride(stringerType, null);
string stringerTypeElemId = NamingUtil.CreateIFCElementId(stringerType);
memberType = IFCInstanceExporter.CreateMemberType(file, ExporterIFCUtils.CreateGUID(),
ownerHistory, stringerTypeName, stringerTypeDescription, null, null, null, stringerTypeElemId,
null, IFCMemberType.Stringer);
ExporterCacheManager.ElementToHandleCache.Register(stringerType.Id, memberType);
}
return memberType;
}
示例13: GetMemberTypeHandle
/// <summary>
/// The IfcMemberType shared by all stringers to keep their type. This is a placeholder IfcMemberType.
/// </summary>
public static IFCAnyHandle GetMemberTypeHandle(ExporterIFC exporterIFC, Element stringer)
{
Element stringerType = stringer.Document.GetElement(stringer.GetTypeId());
IFCAnyHandle memberType = ExporterCacheManager.ElementToHandleCache.Find(stringerType.Id);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(memberType))
{
IFCFile file = exporterIFC.GetFile();
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
string stringerTypeGUID = GUIDUtil.CreateGUID(stringerType);
string stringerTypeName = NamingUtil.GetNameOverride(stringerType, NamingUtil.GetIFCName(stringerType));
string stringerTypeDescription = NamingUtil.GetDescriptionOverride(stringerType, null);
string stringerTypeTag = NamingUtil.GetTagOverride(stringerType, NamingUtil.CreateIFCElementId(stringerType));
string stringerApplicableOccurence = NamingUtil.GetOverrideStringValue(stringerType, "IfcApplicableOccurence", null);
string stringerElementType = NamingUtil.GetOverrideStringValue(stringerType, "IfcElementType", null);
memberType = IFCInstanceExporter.CreateMemberType(file, stringerTypeGUID,
ownerHistory, stringerTypeName, stringerTypeDescription, stringerApplicableOccurence, null, null, stringerTypeTag,
stringerElementType, IFCMemberType.Stringer);
ExporterCacheManager.ElementToHandleCache.Register(stringerType.Id, memberType);
}
return memberType;
}
示例14: ExportAreaScheme
/// <summary>
/// Exports an element as a group.
/// </summary>
/// <param name="exporterIFC">The ExporterIFC object.</param>
/// <param name="element">The element.</param>
/// <param name="productWrapper">The ProductWrapper.</param>
public static void ExportAreaScheme(ExporterIFC exporterIFC, AreaScheme element,
ProductWrapper productWrapper)
{
if (element == null)
return;
HashSet<IFCAnyHandle> areaHandles = null;
if (!ExporterCacheManager.AreaSchemeCache.TryGetValue(element.Id, out areaHandles))
return;
if (areaHandles == null || areaHandles.Count == 0)
return;
IFCFile file = exporterIFC.GetFile();
using (IFCTransaction tr = new IFCTransaction(file))
{
string guid = GUIDUtil.CreateGUID(element);
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
string name = NamingUtil.GetNameOverride(element, element.Name);
string description = NamingUtil.GetDescriptionOverride(element, null);
string objectType = NamingUtil.GetObjectTypeOverride(element, exporterIFC.GetFamilyName());
string elementTag = NamingUtil.CreateIFCElementId(element);
IFCAnyHandle areaScheme = IFCInstanceExporter.CreateGroup(file, guid,
ownerHistory, name, description, objectType);
productWrapper.AddElement(element, areaScheme);
IFCInstanceExporter.CreateRelAssignsToGroup(file, GUIDUtil.CreateGUID(), ownerHistory,
null, null, areaHandles, null, areaScheme);
tr.Commit();
return;
}
}
示例15: ExportGroupElement
/// <summary>
/// Exports a Group as an IfcGroup.
/// </summary>
/// <param name="exporterIFC">The ExporterIFC object.</param>
/// <param name="element">The element.</param>
/// <param name="productWrapper">The ProductWrapper.</param>
/// <returns>True if exported successfully, false otherwise.</returns>
public static bool ExportGroupElement(ExporterIFC exporterIFC, Group element,
ProductWrapper productWrapper)
{
if (element == null)
return false;
IFCFile file = exporterIFC.GetFile();
using (IFCTransaction tr = new IFCTransaction(file))
{
IFCAnyHandle groupHnd = null;
string guid = GUIDUtil.CreateGUID(element);
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
string name = NamingUtil.GetNameOverride(element, NamingUtil.GetIFCName(element));
string description = NamingUtil.GetDescriptionOverride(element, null);
string objectType = NamingUtil.GetObjectTypeOverride(element, exporterIFC.GetFamilyName());
string ifcEnumType;
IFCExportType exportAs = ExporterUtil.GetExportType(exporterIFC, element, out ifcEnumType);
if (exportAs == IFCExportType.ExportGroup)
{
groupHnd = IFCInstanceExporter.CreateGroup(file, guid, ownerHistory, name, description, objectType);
}
if (groupHnd == null)
return false;
productWrapper.AddElement(element, groupHnd);
ExporterCacheManager.GroupCache.RegisterGroup(element.Id, groupHnd);
tr.Commit();
return true;
}
}