/// <summary> /// Creates a new instance of StairsSingleCurvedRun at a specified location and orientation. /// </summary> /// <param name="stairs">The stairs element.</param> /// <param name="bottomLevel">The bottom level of the configuration.</param> /// <param name="innerRadius">The inner radius of the run curvature.</param> /// <param name="transform">The transform (containing location and orientation).</param> public StairsSingleCurvedRun(Stairs stairs, Level bottomLevel, double innerRadius, Transform transform) { StairsType stairsType = stairs.Document.GetElement(stairs.GetTypeId()) as StairsType; m_runConfigurations.Add(new CurvedStairsRunComponent(stairs.DesiredRisersNumber, bottomLevel.Elevation, stairsType.MinTreadDepth, stairsType.MinRunWidth, innerRadius, stairs.Document.Application.Create, transform)); }
/// <summary> /// Creates a new instance of StairsSingleSketchedStraightRun at the default location and orientation. /// </summary> /// <param name="stairs">The stairs element.</param> /// <param name="bottomLevel">The bottom level of the configuration.</param> public StairsSingleSketchedStraightRun(Stairs stairs, Level bottomLevel) { StairsType stairsType = stairs.Document.GetElement(stairs.GetTypeId()) as StairsType; m_runConfigurations.Add(new SketchedStraightStairsRunComponent(stairs.DesiredRisersNumber, bottomLevel.Elevation, stairsType.MinTreadDepth, stairsType.MinRunWidth)); }
/// <summary> /// Calculates number of risers for a stair. /// </summary> /// <param name="exporterIFC"> /// The ExporterIFC object. /// </param> /// <param name="extrusionCreationData"> /// The IFCExtrusionCreationData. /// </param> /// <param name="element"> /// The element to calculate the value. /// </param> /// <param name="elementType"> /// The element type. /// </param> /// <returns> /// True if the operation succeed, false otherwise. /// </returns> public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType) { bool valid = true; if (m_CurrentElement != element) { double scale = exporterIFC.LinearScale; m_CurrentElement = element; if (StairsExporter.IsLegacyStairs(element)) { ExporterIFCUtils.GetLegacyStairsProperties(exporterIFC, element, out m_NumberOfRisers, out m_NumberOfTreads, out m_RiserHeight, out m_TreadLength, out m_TreadLengthAtInnerSide, out m_NosingLength, out m_WaistThickness); m_TreadLengthAtOffset = m_TreadLength; m_WalkingLineOffset = m_WaistThickness / 2.0; } else if (element is Stairs) { Stairs stairs = element as Stairs; m_NumberOfRisers = stairs.ActualRisersNumber; m_NumberOfTreads = stairs.ActualTreadsNumber; m_RiserHeight = stairs.ActualRiserHeight * scale; m_TreadLength = stairs.ActualTreadDepth * scale; } else if (element is StairsRun) { StairsRun stairsRun = element as StairsRun; StairsRunType stairsRunType = stairsRun.Document.GetElement(stairsRun.GetTypeId()) as StairsRunType; Stairs stairs = stairsRun.GetStairs(); StairsType stairsType = stairs.Document.GetElement(stairs.GetTypeId()) as StairsType; m_NumberOfRisers = stairs.ActualRisersNumber; m_NumberOfTreads = stairs.ActualTreadsNumber; m_RiserHeight = stairs.ActualRiserHeight * scale; m_TreadLength = stairs.ActualTreadDepth * scale; m_TreadLengthAtOffset = m_TreadLength; m_NosingLength = stairsRunType.NosingLength * scale; m_WaistThickness = stairsRun.ActualRunWidth * scale; m_WalkingLineOffset = m_WaistThickness / 2.0; double treadLengthAtInnerSide; if (ParameterUtil.GetDoubleValueFromElement(stairsType, BuiltInParameter.STAIRSTYPE_MINIMUM_TREAD_WIDTH_INSIDE_BOUNDARY, out treadLengthAtInnerSide) != null) { m_TreadLengthAtInnerSide = treadLengthAtInnerSide * scale; } else { m_TreadLengthAtInnerSide = 0.0; } } else { valid = false; } } return(valid); }
/// <summary> /// Calculates number of risers for a stair. /// </summary> /// <param name="exporterIFC"> /// The ExporterIFC object. /// </param> /// <param name="extrusionCreationData"> /// The IFCExtrusionCreationData. /// </param> /// <param name="element"> /// The element to calculate the value. /// </param> /// <param name="elementType"> /// The element type. /// </param> /// <returns> /// True if the operation succeed, false otherwise. /// </returns> public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType, EntryMap entryMap) { bool valid = true; if (StairsExporter.IsLegacyStairs(element)) { double riserHeight, treadLength, nosingLength, waistThickness = 0; int numberOfRisers, numberOfTreads = 0; ExporterIFCUtils.GetLegacyStairsProperties(exporterIFC, element, out numberOfRisers, out numberOfTreads, out riserHeight, out treadLength, out m_TreadLengthAtInnerSide, out nosingLength, out waistThickness); } else if (element is Stairs || element is StairsRun) { Stairs stairs; if (element is StairsRun) { StairsRun stairsRun = element as StairsRun; stairs = stairsRun.GetStairs(); } else { stairs = element as Stairs; } StairsType stairsType = stairs.Document.GetElement(stairs.GetTypeId()) as StairsType; double treadLengthAtInnerSide; if (ParameterUtil.GetDoubleValueFromElement(stairsType, BuiltInParameter.STAIRSTYPE_MINIMUM_TREAD_WIDTH_INSIDE_BOUNDARY, out treadLengthAtInnerSide) != null) { m_TreadLengthAtInnerSide = UnitUtil.ScaleLength(treadLengthAtInnerSide); } if (m_TreadLengthAtInnerSide <= 0) { m_TreadLengthAtInnerSide = UnitUtil.ScaleLength(stairs.ActualTreadDepth); } } else { valid = false; } // Get override from parameter double treadLengthAtInnerSideOverride = 0.0; if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.RevitParameterName, out treadLengthAtInnerSideOverride) != null || ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.CompatibleRevitParameterName, out treadLengthAtInnerSideOverride) != null) { m_TreadLengthAtInnerSide = UnitUtil.ScaleArea(treadLengthAtInnerSideOverride); } return(valid); }
/// <summary> /// Creates a new StairsStandardConfiguration of runs and landings at a specified location and orientation. /// </summary> /// <param name="stairs">The stairs element.</param> /// <param name="bottomLevel">The bottom level.</param> /// <param name="numberOfLandings">The number of landings to be included.</param> /// <param name="transform">The transformation (location and orientation).</param> public StairsStandardConfiguration(Stairs stairs, Level bottomLevel, int numberOfLandings, Transform transform) { m_stairs = stairs; m_stairsType = m_stairs.Document.GetElement(m_stairs.GetTypeId()) as StairsType; m_bottomElevation = bottomLevel.Elevation; RiserNumber = stairs.DesiredRisersNumber; m_numberOfLandings = numberOfLandings; m_transform = transform; EqualizeRuns = false; }
/// <summary> /// Retrieve the system default stairs data, like run width and tread depth. /// </summary> /// <param name="rvtDoc">Revit Document</param> /// <param name="runWidth">Stairs run width</param> /// <param name="treadDepth">Stairs tread depth</param> private void GetStairsData(Document rvtDoc, out double runWidth, out double treadDepth) { FilteredElementCollector filterLevels = new FilteredElementCollector(rvtDoc); var levels = filterLevels.OfClass(typeof(Level)).ToElements(); if (levels.Count < 2) { throw new InvalidOperationException("Need two Levels to create Stairs."); } List <Element> levelList = new List <Element>(); levelList.AddRange(levels); levelList.Sort((a, b) => { return(((Level)a).Elevation.CompareTo(((Level)b).Elevation)); }); using (StairsEditScope stairsMode = new StairsEditScope(rvtDoc, "DUMMY STAIRS SCOPE")) { var stairsId = stairsMode.Start(levelList[0].Id, levelList[1].Id); Stairs stairs = rvtDoc.GetElement(stairsId) as Stairs; StairsType stairsType = rvtDoc.GetElement(stairs.GetTypeId()) as StairsType; runWidth = stairsType.MinRunWidth; treadDepth = stairs.ActualTreadDepth; } }
/// <summary> /// Calculates number of risers for a stair. /// </summary> /// <param name="exporterIFC">The ExporterIFC object.</param> /// <param name="extrusionCreationData">The IFCExtrusionCreationData.</param> /// <param name="element">The element to calculate the value.</param> /// <param name="elementType">The element type.</param> /// <returns>True if the operation succeed, false otherwise.</returns> public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType) { bool valid = true; if (CurrentElement != element) { CurrentElement = element; if (StairsExporter.IsLegacyStairs(element)) { int numberOfRisers, numberOfTreads; double riserHeight, treadLength, treadLengthAtInnerSide, nosingLength, waistThickness; ExporterIFCUtils.GetLegacyStairsProperties(exporterIFC, element, out numberOfRisers, out numberOfTreads, out riserHeight, out treadLength, out treadLengthAtInnerSide, out nosingLength, out waistThickness); NumberOfRisers = numberOfRisers; NumberOfTreads = numberOfTreads; RiserHeight = riserHeight; TreadLength = treadLength; TreadLengthAtInnerSide = treadLengthAtInnerSide; NosingLength = nosingLength; WaistThickness = waistThickness; TreadLengthAtOffset = TreadLength; WalkingLineOffset = WaistThickness / 2.0; } else if (element is Stairs) { Stairs stairs = element as Stairs; NumberOfRisers = stairs.ActualRisersNumber; NumberOfTreads = stairs.ActualTreadsNumber; RiserHeight = UnitUtil.ScaleLength(stairs.ActualRiserHeight); TreadLength = UnitUtil.ScaleLength(stairs.ActualTreadDepth); } else if (element is StairsRun) { StairsRun stairsRun = element as StairsRun; StairsRunType stairsRunType = stairsRun.Document.GetElement(stairsRun.GetTypeId()) as StairsRunType; Stairs stairs = stairsRun.GetStairs(); StairsType stairsType = stairs.Document.GetElement(stairs.GetTypeId()) as StairsType; NumberOfRisers = stairs.ActualRisersNumber; NumberOfTreads = stairs.ActualTreadsNumber; RiserHeight = UnitUtil.ScaleLength(stairs.ActualRiserHeight); TreadLength = UnitUtil.ScaleLength(stairs.ActualTreadDepth); TreadLengthAtOffset = TreadLength; NosingLength = UnitUtil.ScaleLength(stairsRunType.NosingLength); WaistThickness = UnitUtil.ScaleLength(stairsRun.ActualRunWidth); WalkingLineOffset = WaistThickness / 2.0; double treadLengthAtInnerSide; if (ParameterUtil.GetDoubleValueFromElement(stairsType, BuiltInParameter.STAIRSTYPE_MINIMUM_TREAD_WIDTH_INSIDE_BOUNDARY, out treadLengthAtInnerSide) != null) { TreadLengthAtInnerSide = UnitUtil.ScaleLength(treadLengthAtInnerSide); } else { TreadLengthAtInnerSide = 0.0; } } else { valid = false; } } return(valid); }