本文整理汇总了C#中ExporterIFC.GetLevelInfos方法的典型用法代码示例。如果您正苦于以下问题:C# ExporterIFC.GetLevelInfos方法的具体用法?C# ExporterIFC.GetLevelInfos怎么用?C# ExporterIFC.GetLevelInfos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExporterIFC
的用法示例。
在下文中一共展示了ExporterIFC.GetLevelInfos方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLevelInfo
/// <summary>
/// Get the IFCLevelInfo corresponding to a level.
/// </summary>
/// <param name="exporterIFC">The exporter data object.</param>
/// <param name="levelId">The level ElementId.</param>
/// <returns>The IFCLevelInfo.</returns>
public IFCLevelInfo GetLevelInfo(ExporterIFC exporterIFC, ElementId levelId)
{
return exporterIFC.GetLevelInfos()[levelId];
}
示例2: GetNonStoryLevelOffsetIfAny
/// <summary>
/// Gets offset of non-storey level.
/// </summary>
/// <param name="exporterIFC">
/// The ExporterIFC object.
/// </param>
/// <param name="level">
/// The level.
/// </param>
/// <returns>
/// The offset.
/// </returns>
public static double GetNonStoryLevelOffsetIfAny(ExporterIFC exporterIFC, Level level)
{
if ((level == null) || !LevelHasViews(level))
return 0.0;
Document document = level.Document;
const double veryNegativeHeight = -1000000000;
double levelHeight = level.Elevation;
double prevHeight = veryNegativeHeight;
IDictionary<ElementId, IFCLevelInfo> storeys = exporterIFC.GetLevelInfos();
foreach (KeyValuePair<ElementId, IFCLevelInfo> storey in storeys)
{
double currentHeight = storey.Value.Elevation;
if (currentHeight < levelHeight + MathUtil.Eps() && currentHeight > prevHeight)
prevHeight = currentHeight;
}
if (prevHeight > veryNegativeHeight)
return levelHeight - prevHeight;
else
return 0.0;
}
示例3: commonInit
/// <summary>
/// Attempt to determine the local placement of the element based on the element type and initial input.
/// </summary>
/// <param name="exporterIFC">The ExporterIFC class.</param>
/// <param name="elem">The element being exported.</param>
/// <param name="familyTrf">The optional family transform.</param>
/// <param name="orientationTrf">The optional orientation of the element based on IFC standards or agreements.</param>
/// <param name="overrideLevelId">The optional level to place the element, to be used instead of heuristics.</param>
private void commonInit(ExporterIFC exporterIFC, Element elem, Transform familyTrf, Transform orientationTrf, ElementId overrideLevelId)
{
ExporterIFC = exporterIFC;
// Convert null value to InvalidElementId.
if (overrideLevelId == null)
overrideLevelId = ElementId.InvalidElementId;
Document doc = elem.Document;
Element hostElem = elem;
ElementId elemId = elem.Id;
ElementId newLevelId = overrideLevelId;
bool useOverrideOrigin = false;
XYZ overrideOrigin = XYZ.Zero;
IDictionary<ElementId, IFCLevelInfo> levelInfos = exporterIFC.GetLevelInfos();
if (overrideLevelId == ElementId.InvalidElementId)
{
if (familyTrf == null)
{
// Override for CurveElems -- base level calculation on origin of sketch Plane.
if (elem is CurveElement)
{
SketchPlane sketchPlane = (elem as CurveElement).SketchPlane;
if (sketchPlane != null)
{
useOverrideOrigin = true;
overrideOrigin = sketchPlane.GetPlane().Origin;
}
}
else
{
ElementId hostElemId = ElementId.InvalidElementId;
// a bit of a hack. If we have a railing, we want it to have the same level base as its host Stair (because of
// the way the stairs place railings and stair flights together).
if (elem is Railing)
{
hostElemId = (elem as Railing).HostId;
}
else if (elem.Category.Id.IntegerValue == (int)BuiltInCategory.OST_Assemblies)
{
hostElemId = elem.AssemblyInstanceId;
}
if (hostElemId != ElementId.InvalidElementId)
{
hostElem = doc.GetElement(hostElemId);
}
newLevelId = hostElem != null ? hostElem.LevelId : ElementId.InvalidElementId;
if (newLevelId == ElementId.InvalidElementId)
{
ExporterIFCUtils.GetLevelIdByHeight(exporterIFC, hostElem);
}
}
}
// todo: store.
double bottomHeight = double.MaxValue;
ElementId bottomLevelId = ElementId.InvalidElementId;
if ((newLevelId == ElementId.InvalidElementId) || orientationTrf != null)
{
// if we have a trf, it might geometrically push the instance to a new level. Check that case.
// actually, we should ALWAYS check the bbox vs the settings
newLevelId = ElementId.InvalidElementId;
XYZ originToUse = XYZ.Zero;
bool originIsValid = useOverrideOrigin;
if (useOverrideOrigin)
{
originToUse = overrideOrigin;
}
else
{
BoundingBoxXYZ bbox = elem.get_BoundingBox(null);
if (bbox != null)
{
originToUse = bbox.Min;
originIsValid = true;
}
else if (hostElem.Id != elemId)
{
bbox = hostElem.get_BoundingBox(null);
if (bbox != null)
{
originToUse = bbox.Min;
originIsValid = true;
}
}
//.........这里部分代码省略.........
示例4: CreateSplitLevelRangesForElement
/// <summary>
/// Creates a list of ranges to split an element.
/// </summary>
/// <remarks>
/// We may need to split an element (e.g. column) into parts by level.
/// </remarks>
/// <param name="exporterIFC">
/// The ExporterIFC object.
/// </param>
/// <param name="exportType">
/// The export type.
/// </param>
/// <param name="element">
/// The element.
/// </param>
/// <param name="levels">
/// The levels to split the element.
/// </param>
/// <param name="ranges">
/// The ranges to split the element.
/// </param>
public static void CreateSplitLevelRangesForElement(ExporterIFC exporterIFC, IFCExportType exportType, Element elem,
out IList<ElementId> levels, out IList<UV> ranges)
{
// If we are exporting a column, we may need to split it into parts by level. Create a list of ranges.
levels = new List<ElementId>();
ranges = new List<UV>();
double extension = GetLevelExtension();
if ((exportType == IFCExportType.ExportColumnType) && (exporterIFC.WallAndColumnSplitting))
{
BoundingBoxXYZ boundingBox = elem.get_BoundingBox(null);
{
UV zSpan = new UV(boundingBox.Min.Z, boundingBox.Max.Z);
if (zSpan.U < zSpan.V)
{
IDictionary<ElementId, IFCLevelInfo> storeys = exporterIFC.GetLevelInfos();
foreach (KeyValuePair<ElementId, IFCLevelInfo> storey in storeys)
{
IFCLevelInfo levelInfo = storey.Value;
// endBelowLevel
if (zSpan.V < levelInfo.Elevation + extension)
continue;
// startAboveLevel
if ((!MathUtil.IsAlmostZero(levelInfo.DistanceToNextLevel)) &&
(zSpan.U > levelInfo.Elevation + levelInfo.DistanceToNextLevel - extension))
continue;
bool startBelowLevel = (zSpan.U < levelInfo.Elevation - extension);
bool endAboveLevel = ((!MathUtil.IsAlmostZero(levelInfo.DistanceToNextLevel)) &&
(zSpan.V > levelInfo.Elevation + levelInfo.DistanceToNextLevel + extension));
if (!startBelowLevel && !endAboveLevel)
break;
UV currentSpan = new UV(
startBelowLevel ? levelInfo.Elevation : zSpan.U,
endAboveLevel ? (levelInfo.Elevation + levelInfo.DistanceToNextLevel) : zSpan.V);
ranges.Add(currentSpan);
levels.Add(storey.Key);
}
}
}
}
}