本文整理汇总了C#中FamilyInstance.GetTransform方法的典型用法代码示例。如果您正苦于以下问题:C# FamilyInstance.GetTransform方法的具体用法?C# FamilyInstance.GetTransform怎么用?C# FamilyInstance.GetTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FamilyInstance
的用法示例。
在下文中一共展示了FamilyInstance.GetTransform方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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
{
//.........这里部分代码省略.........
示例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 ProductWrapper.
/// </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,
ProductWrapper wrapper, ElementId overrideLevelId, IFCRange range, IFCAnyHandle parentLocalPlacement)
{
bool exportParts = PartExporter.CanExportParts(familyInstance);
bool isSplit = range != null;
if (exportParts && !PartExporter.CanExportElementInPartExport(familyInstance, isSplit ? overrideLevelId : familyInstance.Level.Id, isSplit))
return;
Document doc = familyInstance.Document;
IFCFile file = exporterIFC.GetFile();
FamilySymbol familySymbol = ExporterIFCUtils.GetOriginalSymbol(familyInstance);
if (familySymbol == null)
return;
ProductWrapper familyProductWrapper = ProductWrapper.Create(wrapper);
double scale = exporterIFC.LinearScale;
Options options = GeometryUtil.GetIFCExportGeometryOptions();
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;
string objectType = 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>();
using (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);
FamilyTypeInfo typeInfo = new FamilyTypeInfo();
XYZ extraOffset = XYZ.Zero;
bool flipped = doorWindowInfo != null ? doorWindowInfo.IsSymbolFlipped : false;
FamilyTypeInfo currentTypeInfo = ExporterCacheManager.TypeObjectsCache.Find(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));
IList<GeometryObject> geomObjects = new List<GeometryObject>();
Transform brepOffsetTransform = null;
Transform doorWindowTrf = Transform.Identity;
// 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 = null;
IFCAnyHandle planRepresentation = null;
// 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)
//.........这里部分代码省略.........
示例3: 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 ProductWrapper.</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,
ProductWrapper wrapper, ElementId overrideLevelId, IFCRange range, IFCAnyHandle parentLocalPlacement)
{
bool exportParts = PartExporter.CanExportParts(familyInstance);
bool isSplit = range != null;
if (exportParts && !PartExporter.CanExportElementInPartExport(familyInstance, isSplit ? overrideLevelId : familyInstance.Level.Id, isSplit))
return;
Document doc = familyInstance.Document;
IFCFile file = exporterIFC.GetFile();
// The "originalFamilySymbol" has the right geometry, but should be used as little as possible.
FamilySymbol originalFamilySymbol = ExporterIFCUtils.GetOriginalSymbol(familyInstance);
FamilySymbol familySymbol = familyInstance.Symbol;
if (originalFamilySymbol == null || familySymbol == null)
return;
ProductWrapper familyProductWrapper = ProductWrapper.Create(wrapper);
double scale = exporterIFC.LinearScale;
Options options = GeometryUtil.GetIFCExportGeometryOptions();
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;
string revitObjectType = 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);
Transform trf = familyInstance.GetTransform();
using (IFCExtrusionCreationData extraParams = new IFCExtrusionCreationData())
{
bool exportingDoor = (exportType == IFCExportType.ExportDoorType);
bool exportingWindow = (exportType == IFCExportType.ExportWindowType);
bool exportingHostParts = PartExporter.CanExportParts(hostElement);
HostObject hostElementForDoorWindow = exportingHostParts ? null : hostElement;
// Extra information if we are exporting a door or a window.
IFCDoorWindowInfo doorWindowInfo = null;
if (exportingDoor)
doorWindowInfo = IFCDoorWindowInfo.CreateDoorInfo(exporterIFC, familyInstance, originalFamilySymbol, hostElementForDoorWindow, overrideLevelId, trf);
else if (exportingWindow)
doorWindowInfo = IFCDoorWindowInfo.CreateWindowInfo(exporterIFC, familyInstance, originalFamilySymbol, hostElementForDoorWindow, overrideLevelId, trf);
bool ignoreDoorWindowOpening = ((exportingDoor || exportingWindow) && exportingHostParts);
FamilyTypeInfo typeInfo = new FamilyTypeInfo();
bool flipped = doorWindowInfo != null ? doorWindowInfo.IsSymbolFlipped : false;
FamilyTypeInfo currentTypeInfo = ExporterCacheManager.TypeObjectsCache.Find(originalFamilySymbol.Id, flipped);
bool found = currentTypeInfo.IsValid();
Family family = familySymbol.Family;
IList<GeometryObject> geomObjects = new List<GeometryObject>();
Transform offsetTransform = null;
Transform doorWindowTrf = Transform.Identity;
// 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 = null;
IFCAnyHandle planRepresentation = null;
IFCAnyHandle dummyPlacement = null;
if (doorWindowInfo != null)
{
doorWindowTrf = ExporterIFCUtils.GetTransformForDoorOrWindow(familyInstance, originalFamilySymbol, doorWindowInfo);
}
else
{
dummyPlacement = IFCInstanceExporter.CreateLocalPlacement(file, null, ExporterUtil.CreateAxis2Placement3D(file));
extraParams.SetLocalPlacement(dummyPlacement);
}
bool needToCreate2d = ExporterCacheManager.ExportOptionsCache.ExportAnnotations;
GeometryElement exportGeometry =
useInstanceGeometry ? familyInstance.get_Geometry(options) : originalFamilySymbol.get_Geometry(options);
if (!exportParts)
//.........这里部分代码省略.........