/// <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 (StairsExporter.IsLegacyStairs(element)) { double riserHeight, treadLength, treadLengthAtInnerSide, nosingLength, waistThickness = 0; int numberOfTreads = 0; ExporterIFCUtils.GetLegacyStairsProperties(exporterIFC, element, out m_NumberOfRisers, out numberOfTreads, out riserHeight, out treadLength, out treadLengthAtInnerSide, out nosingLength, out waistThickness); } else if (element is Stairs) { Stairs stairs = element as Stairs; m_NumberOfRisers = stairs.ActualRisersNumber; } else if (element is StairsRun) { StairsRun stairsRun = element as StairsRun; StairsRunType stairsRunType = stairsRun.Document.GetElement(stairsRun.GetTypeId()) as StairsRunType; m_NumberOfRisers = stairsRun.ActualRisersNumber; } else { valid = false; } // Get override from parameter ParameterUtil.GetIntValueFromElementOrSymbol(element, "NumberOfRiser", out m_NumberOfRisers); 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) { 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> /// 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, treadLengthAtInnerSide, nosingLength, waistThickness = 0; int numberOfRisers, numberOfTreads = 0; ExporterIFCUtils.GetLegacyStairsProperties(exporterIFC, element, out numberOfRisers, out numberOfTreads, out riserHeight, out treadLength, out treadLengthAtInnerSide, out nosingLength, out waistThickness); m_WalkingLineOffset = waistThickness / 2.0; // !! The waist thickness seems to be wrongly associated with the width of the run! } else if (element is Stairs) { Stairs stairs = element as Stairs; ICollection <ElementId> stairRuns = stairs.GetStairsRuns(); if (stairRuns.Count > 0) { // Get the run width from one of the run/flight to compute the walking line offset StairsRun run = stairs.Document.GetElement(stairRuns.First()) as StairsRun; m_WalkingLineOffset = run.ActualRunWidth / 2.0; } } else if (element is StairsRun) { StairsRun stairsRun = element as StairsRun; StairsRunType stairsRunType = stairsRun.Document.GetElement(stairsRun.GetTypeId()) as StairsRunType; m_WalkingLineOffset = stairsRun.ActualRunWidth / 2.0; } else { valid = false; } // Get override from parameter double walkingLineOffsetOverride = 0.0; if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.RevitParameterName, out walkingLineOffsetOverride) != null || ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.CompatibleRevitParameterName, out walkingLineOffsetOverride) != null) { m_WalkingLineOffset = UnitUtil.ScaleArea(walkingLineOffsetOverride); } 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, treadLengthAtInnerSide, nosingLength, waistThickness = 0; int numberOfRisers, numberOfTreads = 0; ExporterIFCUtils.GetLegacyStairsProperties(exporterIFC, element, out numberOfRisers, out numberOfTreads, out riserHeight, out treadLength, out treadLengthAtInnerSide, out nosingLength, out waistThickness); m_TreadLengthAtOffset = treadLength; } else if (element is Stairs) { Stairs stairs = element as Stairs; m_TreadLengthAtOffset = UnitUtil.ScaleLength(stairs.ActualTreadDepth); } else if (element is StairsRun) { StairsRun stairsRun = element as StairsRun; Stairs stairs = stairsRun.GetStairs(); m_TreadLengthAtOffset = UnitUtil.ScaleLength(stairs.ActualTreadDepth); } else { valid = false; } // Get override from parameter double treadLengthAtOffset = 0.0; if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.RevitParameterName, out treadLengthAtOffset) != null || ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.CompatibleRevitParameterName, out treadLengthAtOffset) != null) { m_TreadLengthAtOffset = UnitUtil.ScaleArea(treadLengthAtOffset); } 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, treadLengthAtInnerSide, waistThickness = 0; int numberOfRisers, numberOfTreads = 0; ExporterIFCUtils.GetLegacyStairsProperties(exporterIFC, element, out numberOfRisers, out numberOfTreads, out riserHeight, out treadLength, out treadLengthAtInnerSide, out m_NosingLength, out waistThickness); } else if (element is Stairs) { Stairs stairs = element as Stairs; ICollection <ElementId> stairRuns = stairs.GetStairsRuns(); if (stairRuns.Count > 0) { // Get the run width from one of the run/flight to compute the walking line offset StairsRun run = stairs.Document.GetElement(stairRuns.First()) as StairsRun; StairsRunType stairsRunType = run.Document.GetElement(run.GetTypeId()) as StairsRunType; m_NosingLength = UnitUtil.ScaleLength(stairsRunType.NosingLength); } } else if (element is StairsRun) { StairsRun stairsRun = element as StairsRun; StairsRunType stairsRunType = stairsRun.Document.GetElement(stairsRun.GetTypeId()) as StairsRunType; m_NosingLength = UnitUtil.ScaleLength(stairsRunType.NosingLength); } 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) { 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); }