本文整理汇总了C#中ExporterIFC.FindType方法的典型用法代码示例。如果您正苦于以下问题:C# ExporterIFC.FindType方法的具体用法?C# ExporterIFC.FindType怎么用?C# ExporterIFC.FindType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExporterIFC
的用法示例。
在下文中一共展示了ExporterIFC.FindType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Export
/// <summary>
/// Exports a MEP family instance.
/// </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>
public static void Export(ExporterIFC exporterIFC, Element element, GeometryElement geometryElement, IFCProductWrapper productWrapper)
{
IFCFile file = exporterIFC.GetFile();
using (IFCTransaction tr = new IFCTransaction(file))
{
string ifcEnumType;
IFCExportType exportType = ExporterUtil.GetExportType(exporterIFC, element, out ifcEnumType);
using (IFCPlacementSetter setter = IFCPlacementSetter.Create(exporterIFC, element))
{
IFCAnyHandle localPlacementToUse = setter.GetPlacement();
IFCExtrusionCreationData extraParams = new IFCExtrusionCreationData();
ElementId catId = CategoryUtil.GetSafeCategoryId(element);
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(element.Document.Application, exporterIFC, catId, solids, polyMeshes, tryToExportAsExtrusion, extraParams);
if (!shapeRep.HasValue)
return;
IList<IFCAnyHandle> shapeReps = new List<IFCAnyHandle>();
shapeReps.Add(shapeRep);
IFCAnyHandle productRepresentation = file.CreateProductDefinitionShape(IFCLabel.Create(), IFCLabel.Create(), shapeReps);
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
ElementId typeId = element.GetTypeId();
ElementType type = element.Document.get_Element(typeId) as ElementType;
IFCTypeInfo currentTypeInfo = exporterIFC.FindType(typeId, false);
bool found = currentTypeInfo.IsValid();
if (!found)
{
IFCLabel typeGUID = IFCLabel.CreateGUID(type);
IFCLabel origTypeName = NamingUtil.CreateIFCName(exporterIFC, -1);
IFCLabel typeName = NamingUtil.GetNameOverride(type, origTypeName);
IFCLabel typeObjectType = NamingUtil.CreateIFCObjectName(exporterIFC, type);
IFCLabel applicableOccurance = NamingUtil.GetObjectTypeOverride(type, typeObjectType);
IFCLabel typeDescription = NamingUtil.GetDescriptionOverride(type, IFCLabel.Create());
IFCLabel typeElemId = NamingUtil.CreateIFCElementId(type);
HashSet<IFCAnyHandle> propertySetsOpt = new HashSet<IFCAnyHandle>();
IList<IFCAnyHandle> repMapListOpt = new List<IFCAnyHandle>();
IFCAnyHandle styleHandle = FamilyExporterUtil.ExportGenericType(file, exportType, ifcEnumType, typeGUID, ownerHistory, typeName,
typeDescription, applicableOccurance, propertySetsOpt, repMapListOpt, typeElemId, typeName, element, type);
if (styleHandle.HasValue)
{
currentTypeInfo.SetStyle(styleHandle);
exporterIFC.AddType(typeId, false, currentTypeInfo);
}
}
IFCLabel instanceGUID = IFCLabel.CreateGUID(element);
IFCLabel origInstanceName = NamingUtil.CreateIFCName(exporterIFC, -1);
IFCLabel instanceName = NamingUtil.GetNameOverride(element, origInstanceName);
IFCLabel objectType = NamingUtil.CreateIFCObjectName(exporterIFC, element);
IFCLabel instanceObjectType = NamingUtil.GetObjectTypeOverride(element, objectType);
IFCLabel instanceDescription = NamingUtil.GetDescriptionOverride(element, IFCLabel.Create());
IFCLabel instanceElemId = NamingUtil.CreateIFCElementId(element);
bool roomRelated = !FamilyExporterUtil.IsDistributionFlowElementSubType(exportType);
ElementId roomId = ElementId.InvalidElementId;
if (roomRelated)
{
roomId = setter.UpdateRoomRelativeCoordinates(element, out localPlacementToUse);
}
IFCAnyHandle instanceHandle = IFCAnyHandle.Create();
if (FamilyExporterUtil.IsFurnishingElementSubType(exportType))
{
instanceHandle = file.CreateFurnishingElement(instanceGUID, ownerHistory,
instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceElemId);
}
else if (FamilyExporterUtil.IsDistributionFlowElementSubType(exportType))
{
instanceHandle = file.CreateDistributionFlowElement(instanceGUID, ownerHistory,
instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceElemId);
//.........这里部分代码省略.........
示例2: ExportFamilyInstanceAsMappedItem
/// <summary>
/// Exports a family instance as a mapped item.
/// </summary>
/// <param name="exporterIFC">
/// The ExporterIFC object.
/// </param>
/// <param name="familyInstance">
/// The family instance to be exported.
/// </param>
/// <param name="exportType">
/// The export type.
/// </param>
/// <param name="ifcEnumType">
/// The string value represents the IFC type.
/// </param>
/// <param name="wrapper">
/// The IFCProductWrapper.
/// </param>
/// <param name="overrideLevelId">
/// The level id.
/// </param>
/// <param name="range">
/// The range of this family instance to be exported.
/// </param>
public static void ExportFamilyInstanceAsMappedItem(ExporterIFC exporterIFC,
FamilyInstance familyInstance, IFCExportType exportType, string ifcEnumType,
IFCProductWrapper wrapper, ElementId overrideLevelId, UV range)
{
Document doc = familyInstance.Document;
IFCFile file = exporterIFC.GetFile();
FamilySymbol familySymbol = ExporterIFCUtils.GetOriginalSymbol(familyInstance);
if (familySymbol == null)
return;
IFCProductWrapper familyProductWrapper = IFCProductWrapper.Create(wrapper);
double scale = exporterIFC.LinearScale;
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
HostObject hostElement = familyInstance.Host as HostObject; //hostElement could be null
ElementId categoryId = CategoryUtil.GetSafeCategoryId(familySymbol);
//string emptyString = "";
string familyName = familySymbol.Name;
IFCLabel objectType = IFCLabel.Create(familyName);
// A Family Instance can have its own copy of geometry, or use the symbol's copy with a transform.
// The routine below tells us whether to use the Instance's copy or the Symbol's copy.
bool useInstanceGeometry = ExporterIFCUtils.UsesInstanceGeometry(familyInstance);
IList<IFCExtrusionData> cutPairOpeningsForColumns = new List<IFCExtrusionData>();
IFCExtrusionCreationData extraParams = new IFCExtrusionCreationData();
Transform trf = familyInstance.GetTransform();
// Extra information if we are exporting a door or a window.
IFCDoorWindowInfo doorWindowInfo = null;
if (exportType == IFCExportType.ExportDoorType)
doorWindowInfo = IFCDoorWindowInfo.CreateDoorInfo(exporterIFC, familyInstance, familySymbol, hostElement, overrideLevelId, trf);
else if (exportType == IFCExportType.ExportWindowType)
doorWindowInfo = IFCDoorWindowInfo.CreateWindowInfo(exporterIFC, familyInstance, familySymbol, hostElement, overrideLevelId, trf);
IFCTypeInfo typeInfo = new IFCTypeInfo();
XYZ extraOffset = XYZ.Zero;
bool flipped = doorWindowInfo != null ? doorWindowInfo.IsSymbolFlipped : false;
IFCTypeInfo currentTypeInfo = exporterIFC.FindType(familySymbol.Id, flipped);
bool found = currentTypeInfo.IsValid();
Family family = familySymbol.Family;
// TODO: this code to be removed by ExtrusionAnalyzer code.
bool trySpecialColumnCreation = ((exportType == IFCExportType.ExportColumnType) && (!family.IsInPlace));
// We will create a new mapped type if:
// 1. We are exporting part of a column or in-place wall (range != null), OR
// 2. We are using the instance's copy of the geometry (that it, it has unique geometry), OR
// 3. We haven't already created the type.
bool creatingType = ((range != null) || useInstanceGeometry || !found);
if (creatingType)
{
IFCAnyHandle bodyRepresentation = IFCAnyHandle.Create();
IFCAnyHandle planRepresentation = IFCAnyHandle.Create();
// If we are using the instance geometry, ignore the transformation.
if (useInstanceGeometry)
trf = Transform.Identity;
// TODO: this code to be removed by ExtrusionAnalyzer code.
if (trySpecialColumnCreation)
{
XYZ rangeOffset = trf.Origin;
IFCFamilyInstanceExtrusionExportResults results;
if (range != null)
{
results = ExporterIFCUtils.ExportFamilyInstanceAsExtrusion(exporterIFC, familyInstance, useInstanceGeometry, range, overrideLevelId, extraParams);
}
else
{
//.........这里部分代码省略.........