private RevitStairRun StairRunToSpeckle(StairsRun revitStairRun) { var stairType = Doc.GetElement(revitStairRun.GetTypeId()) as StairsRunType; var run = new RevitStairRun(); run.family = stairType.FamilyName; run.type = stairType.Name; run.risersNumber = revitStairRun.ActualRisersNumber; run.runWidth = ScaleToSpeckle(revitStairRun.ActualRunWidth); run.treadsNumber = revitStairRun.ActualTreadsNumber; run.height = ScaleToSpeckle(revitStairRun.Height); run.baseElevation = ScaleToSpeckle(revitStairRun.BaseElevation); run.topElevation = ScaleToSpeckle(revitStairRun.TopElevation); run.beginsWithRiser = revitStairRun.BeginsWithRiser; run.endsWithRiser = revitStairRun.EndsWithRiser; run.extensionBelowRiserBase = ScaleToSpeckle(revitStairRun.ExtensionBelowRiserBase); run.extensionBelowTreadBase = ScaleToSpeckle(revitStairRun.ExtensionBelowTreadBase); run.runStyle = revitStairRun.StairsRunStyle.ToString(); run.units = ModelUnits; run.path = CurveLoopToSpeckle(revitStairRun.GetStairsPath()); run.outline = CurveLoopToSpeckle(revitStairRun.GetFootprintBoundary()); GetAllRevitParamsAndIds(run, revitStairRun); return(run); }
/// <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, 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, treadLengthAtInnerSide, nosingLength, waistThickness = 0; int numberOfRisers, numberOfTreads = 0; ExporterIFCUtils.GetLegacyStairsProperties(exporterIFC, element, out numberOfRisers, out numberOfTreads, out riserHeight, out m_TreadLength, out treadLengthAtInnerSide, out nosingLength, out waistThickness); } else if (element is Stairs) { Stairs stairs = element as Stairs; m_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(); m_TreadLength = UnitUtil.ScaleLength(stairs.ActualTreadDepth); } else { valid = false; } // Get override from parameter double treadLengthOverride = 0.0; if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.RevitParameterName, out treadLengthOverride) != null || ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.CompatibleRevitParameterName, out treadLengthOverride) != null) { m_TreadLength = UnitUtil.ScaleArea(treadLengthOverride); } 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); }